21 #include "ui_globalgradientdialog.h" 31 workspace_ = workspace;
44 if (name.isEmpty())
return;
45 workspace_->AddGlobalGradient(name, gradient_key, lower, upper);
49 void GlobalGradientDialog::on_addPushButton_clicked()
51 QString basename =
"Color Scale";
52 QString name = basename;
54 while (workspace_->GradientNames().contains(name))
55 name = basename +
" (" + QString::number(i++) +
")";
57 color_range_dialog_->
SetRange(0, 100);
58 color_range_dialog_->
SetName(name,
true);
59 color_range_dialog_->show();
62 void GlobalGradientDialog::on_editPushButton_clicked()
64 QString current_range_name = ui->gradientListWidget->currentItem()->text();
65 QCPRange current_range = workspace_->GetGlobalGradient(current_range_name).range;
67 color_range_dialog_->
SetName(ui->gradientListWidget->currentItem()->text(),
false);
68 color_range_dialog_->show();
71 void GlobalGradientDialog::on_removePushButton_clicked()
73 QString name = ui->gradientListWidget->currentItem()->text();
74 workspace_->RemoveColorRange(name);
78 void GlobalGradientDialog::on_recalculatePushButton_clicked()
80 QString name = ui->gradientListWidget->currentItem()->text();
81 workspace_->RecalculateGlobalGradient(name);
84 void GlobalGradientDialog::RefreshListWidget()
86 ui->gradientListWidget->clear();
87 ui->gradientListWidget->addItems(workspace_->GlobalGradientKeys());
void AddGradient(QString name, QString gradient_key, double lower, double upper)
void SetGradientNames(QStringList gradient_names)
void SetRange(double lower, double upper)
void SetName(QString name, bool editable)
Represents the range an axis is encompassing.
The MainWindow class The main window of the program, this is where the user performs most operations...
GlobalGradientDialog(MainWindow *parent, QSharedPointer< VespucciWorkspace > workspace)