Skip to content

Commit

Permalink
fix hue slider redraw
Browse files Browse the repository at this point in the history
  • Loading branch information
njbrown committed Sep 29, 2024
1 parent f07d53a commit b60b874
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/colorpicker/colorpicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ class HueSlider : public QWidget {
float barHeight = height();
float barWidth = width();

// if (!selectorDrawn) {
if (true) {
if (!selectorDrawn) {
// if (true) {
selectorPixmap = QPixmap(barWidth, barHeight);
QPainter huePainter(&selectorPixmap);

Expand Down Expand Up @@ -218,6 +218,8 @@ class HueSlider : public QWidget {
painter.drawEllipse(QPointF(hue * width(), height() / 2), 5, 5);
}

void resizeEvent(QResizeEvent* event) override { selectorDrawn = false; }

void mousePressEvent(QMouseEvent* event) override
{
hue = event->pos().x() / (float)width();
Expand Down
2 changes: 1 addition & 1 deletion src/colorpicker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ int main(int argc, char* argv[])
ColorPicker dialog;

// dialog.resize(800, 600);
dialog.setColor(QColor(255, 0, 0));
dialog.setColor(QColor(50, 125, 125));
dialog.show();

return a.exec();
Expand Down

0 comments on commit b60b874

Please sign in to comment.