-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use palette colors in pieces bars #13256
Conversation
8e8c9d9
to
115dc65
Compare
115dc65
to
eeb218d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Good job!
There are some minor comments only...
P.S. Ideally we should get rid from all hardcoded colors, styles, etc.
src/gui/properties/piecesbar.cpp
Outdated
@@ -181,7 +181,7 @@ void PiecesBar::paintEvent(QPaintEvent *) | |||
QPainter painter(this); | |||
QRect imageRect(borderWidth, borderWidth, width() - 2 * borderWidth, height() - 2 * borderWidth); | |||
if (m_image.isNull()) { | |||
painter.setBrush(Qt::white); | |||
painter.setBrush(palette().base()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you use backgroundColor()
here?
@@ -127,7 +127,7 @@ bool PieceAvailabilityBar::updateImage(QImage &image) | |||
} | |||
|
|||
if (m_pieces.empty()) { | |||
image2.fill(Qt::white); | |||
image2.fill(palette().color(QPalette::Base)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you use backgroundColor()
here?
@@ -120,7 +120,7 @@ bool DownloadedPiecesBar::updateImage(QImage &image) | |||
} | |||
|
|||
if (m_pieces.isEmpty()) { | |||
image2.fill(Qt::white); | |||
image2.fill(palette().color(QPalette::Base)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you use backgroundColor()
here?
@@ -158,6 +158,10 @@ void PieceAvailabilityBar::clear() | |||
|
|||
QString PieceAvailabilityBar::simpleToolTipText() const | |||
{ | |||
return tr("White: Unavailable pieces") + '\n' | |||
+ tr("Blue: Available pieces") + '\n'; | |||
const QString colorBoxBorderColor = palette().color(QPalette::ToolTipText).name(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This color is common to all PiecesBar
subclasses, isn't it? Then I would make it accessible via its interface like other such colors (e.g. backgroundColor()
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not a property of Pieces Bar so I would like to leave it as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference with the other colors that are set there?
89405d1
to
94e59be
Compare
94e59be
to
d73757b
Compare
@jagannatharjun |
Use palette colors in pieces bars
No description provided.