Skip to content

Commit

Permalink
Use current color as initial color in color dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenCWills committed Sep 14, 2024
1 parent 5993d00 commit 8d9573a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/dialogs/importdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void ImportDialog::on_fontSymbolsEdit_textChanged(const QString &text)

void ImportDialog::on_fontColorButton_clicked()
{
QColor color = QColorDialog::getColor();
QColor color = QColorDialog::getColor(this->renderColor);

if (color.isValid())
setRenderColor(color);
Expand Down
6 changes: 4 additions & 2 deletions source/dialogs/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ void SettingsDialog::initialize()

void SettingsDialog::on_defaultPaletteColorPushButton_clicked()
{
QColor color = QColorDialog::getColor();
QColor color = QColor(ui->defaultPaletteColorLineEdit->text());
color = QColorDialog::getColor(color);

if (color.isValid())
this->ui->defaultPaletteColorLineEdit->setText(color.name());
}

void SettingsDialog::on_paletteSelectionBorderColorPushButton_clicked()
{
QColor color = QColorDialog::getColor();
QColor color = QColor(ui->paletteSelectionBorderColorLineEdit->text());
color = QColorDialog::getColor(color);

if (color.isValid())
this->ui->paletteSelectionBorderColorLineEdit->setText(color.name());
Expand Down
6 changes: 4 additions & 2 deletions source/widgets/palettewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,15 +861,17 @@ void PaletteWidget::on_colorLineEdit_returnPressed()

void PaletteWidget::on_colorPickPushButton_clicked()
{
QColor color = QColorDialog::getColor();
QColor color = this->pal->getColor(this->selectedFirstColorIndex);
color = QColorDialog::getColor(color);
if (!color.isValid())
return;

QColor colorEnd;
if (this->selectedFirstColorIndex == this->selectedLastColorIndex) {
colorEnd = color;
} else {
colorEnd = QColorDialog::getColor();
colorEnd = this->pal->getColor(this->selectedLastColorIndex);
colorEnd = QColorDialog::getColor(colorEnd);
if (!colorEnd.isValid())
return;
}
Expand Down

0 comments on commit 8d9573a

Please sign in to comment.