Closed prjemian closed 1 year ago
exit status | background color |
---|---|
success |
standard (alternate white and not white, Qt's choice) |
fail |
mistyrose (#ffe4e1) |
abort |
lightyellow (#ffffe0) |
other | lightslategrey (#778899) |
Example:
While researching Qt.BackgroundRole
, I found this list of common roles in the QAbstractItemModel
class for different kinds of data and formatting:
Qt.DisplayRole
: Data to be rendered as text.
Qt.DecorationRole
: Data to be rendered as an icon.
Qt.EditRole
: Data that can be edited.
Qt.ToolTipRole
: Data to be displayed as a tooltip.
Qt.StatusTipRole
: Data to be displayed in a status bar.
Qt.WhatsThisRole
: Data that can be used to populate "What's This?" help messages.
Qt.FontRole
: Font used to display data.
Qt.TextAlignmentRole
: Alignment of the data.
Qt.BackgroundRole
: Background color.
Qt.ForegroundRole
: Foreground color (e.g., text color).
Qt.CheckStateRole
: Check state (e.g., for checkable items).
We could use Qt.TextAlignmentRole
instead of a delegate to center the "Scan ID" and "#points" in the table:
if role == Qt.TextAlignmentRole:
if index.column() in [0,4]:
return Qt.AlignCenter
else:
return Qt.AlignLeft
with color 0xe2e2ec:
Just manufactured the variety of different cases we're showing:
@rodolakis This is ready now. I'm putting off the Qt.TextAlignmentRole
handling to a different issue. I'm glad you pointed that out!