Skip to content
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

Usability improvements for instances of QColorDialog #151

Merged
merged 2 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions source/dialogs/importdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ void ImportDialog::on_fontSymbolsEdit_textChanged(const QString &text)

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

if (color.isValid())
setRenderColor(color);
}

void ImportDialog::on_importButton_clicked()
Expand Down
14 changes: 10 additions & 4 deletions source/dialogs/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,20 @@ void SettingsDialog::initialize()

void SettingsDialog::on_defaultPaletteColorPushButton_clicked()
{
QColor color = QColorDialog::getColor();
this->ui->defaultPaletteColorLineEdit->setText(color.name());
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();
this->ui->paletteSelectionBorderColorLineEdit->setText(color.name());
QColor color = QColor(ui->paletteSelectionBorderColorLineEdit->text());
color = QColorDialog::getColor(color);

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

void SettingsDialog::on_settingsOkButton_clicked()
Expand Down
11 changes: 9 additions & 2 deletions source/widgets/palettewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,12 +861,19 @@ 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;
}

// Build color editing command and connect it to the current palette widget
Expand Down
Loading