Skip to content

Commit

Permalink
fix setting color alpha to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Sep 24, 2020
1 parent a143ffd commit 952827e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/widgets/textproducerwidget.cpp
Expand Up @@ -69,10 +69,12 @@ void TextProducerWidget::on_colorButton_clicked()
dialog.setOption(QColorDialog::ShowAlphaChannel);
if (dialog.exec() == QDialog::Accepted) {
auto newColor = dialog.currentColor();
if (newColor.alpha() == 0 && newColor != color) {
auto rgb = newColor;
rgb.setAlpha(color.alpha());
if (newColor.alpha() == 0 && rgb != color) {
newColor.setAlpha(255);
}
ui->colorLabel->setText(colorToString(dialog.currentColor()));
ui->colorLabel->setText(colorToString(newColor));
ui->colorLabel->setStyleSheet(QString("color: %1; background-color: %2")
.arg((dialog.currentColor().value() < 150)? "white":"black")
.arg(dialog.currentColor().name()));
Expand Down

0 comments on commit 952827e

Please sign in to comment.