diff --git a/src/colorbox.cpp b/src/colorbox.cpp index 95e3cc79..be67d368 100644 --- a/src/colorbox.cpp +++ b/src/colorbox.cpp @@ -9,6 +9,8 @@ ColorBox::ColorBox(QWidget *parent) : QWidget(parent) { _color = Qt::red; + _alpha = true; + setSizePolicy(QSizePolicy::QSizePolicy::Minimum, QSizePolicy::Fixed); } @@ -51,9 +53,9 @@ void ColorBox::mousePressEvent(QMouseEvent *event) { if (event->button() != Qt::LeftButton) return; - - QColor color = QColorDialog::getColor(_color, this, QString(), - QColorDialog::ShowAlphaChannel); + QColorDialog::ColorDialogOptions options = _alpha + ? QColorDialog::ShowAlphaChannel : (QColorDialog::ColorDialogOptions)0; + QColor color = QColorDialog::getColor(_color, this, QString(), options); if (color.isValid()) { _color = color; update(); diff --git a/src/colorbox.h b/src/colorbox.h index f596fcbc..7954b0b2 100644 --- a/src/colorbox.h +++ b/src/colorbox.h @@ -12,6 +12,7 @@ public: const QColor &color() const {return _color;} void setColor(const QColor &color); + void enableAlphaChannel(bool enable) {_alpha = enable;} QSize sizeHint() const; @@ -24,6 +25,7 @@ protected: private: QColor _color; + bool _alpha; }; #endif // COLORBOX_H diff --git a/src/optionsdialog.cpp b/src/optionsdialog.cpp index 1159388e..3caeae10 100644 --- a/src/optionsdialog.cpp +++ b/src/optionsdialog.cpp @@ -181,6 +181,7 @@ QWidget *OptionsDialog::createAppearancePage() _mapOpacity->setValue(_options->mapOpacity); _backgroundColor = new ColorBox(); _backgroundColor->setColor(_options->backgroundColor); + _backgroundColor->enableAlphaChannel(false); QFormLayout *mapLayout = new QFormLayout(); mapLayout->addRow(tr("Background color:"), _backgroundColor); mapLayout->addRow(tr("Map opacity:"), _mapOpacity);