summaryrefslogtreecommitdiffstats
path: root/qt-ui/templateedit.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-07-12 05:54:00 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-20 15:28:23 +0300
commite1dda8df636058734ff8ab79ade210c08339b978 (patch)
tree61c0066ad72ff6ca3235894b8a48db5d41c3344d /qt-ui/templateedit.cpp
parentad531c25fbf4094f2cbfd54018fe74d710b547f1 (diff)
downloadsubsurface-e1dda8df636058734ff8ab79ade210c08339b978.tar.gz
Printing: implement edit buttons in color tab
Add button group and attached edit buttons to it. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-ui/templateedit.cpp')
-rw-r--r--qt-ui/templateedit.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp
index bb545392a..3d84dd63b 100644
--- a/qt-ui/templateedit.cpp
+++ b/qt-ui/templateedit.cpp
@@ -4,6 +4,7 @@
#include "ui_templateedit.h"
#include <QMessageBox>
+#include <QColorDialog>
TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions, struct template_options *templateOptions) :
QDialog(parent),
@@ -28,12 +29,22 @@ TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions,
grantlee_template = TemplateLayout::readTemplate("custom.html");
}
+ // gui
+ btnGroup = new QButtonGroup;
+ btnGroup->addButton(ui->editButton1, 1);
+ btnGroup->addButton(ui->editButton2, 2);
+ btnGroup->addButton(ui->editButton3, 3);
+ btnGroup->addButton(ui->editButton4, 4);
+ btnGroup->addButton(ui->editButton5, 5);
+ connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(colorSelect(QAbstractButton*)));
+
ui->plainTextEdit->setPlainText(grantlee_template);
updatePreview();
}
TemplateEdit::~TemplateEdit()
{
+ delete btnGroup;
delete ui;
}
@@ -118,3 +129,31 @@ void TemplateEdit::on_buttonBox_clicked(QAbstractButton *button)
break;
}
}
+
+void TemplateEdit::colorSelect(QAbstractButton *button)
+{
+ QColor color;
+ switch (btnGroup->id(button)) {
+ case 1:
+ color = QColorDialog::getColor(newTemplateOptions.color_palette.color1, this);
+ newTemplateOptions.color_palette.color1 = color;
+ break;
+ case 2:
+ color = QColorDialog::getColor(newTemplateOptions.color_palette.color2, this);
+ newTemplateOptions.color_palette.color2 = color;
+ break;
+ case 3:
+ color = QColorDialog::getColor(newTemplateOptions.color_palette.color3, this);
+ newTemplateOptions.color_palette.color3 = color;
+ break;
+ case 4:
+ color = QColorDialog::getColor(newTemplateOptions.color_palette.color4, this);
+ newTemplateOptions.color_palette.color4 = color;
+ break;
+ case 5:
+ color = QColorDialog::getColor(newTemplateOptions.color_palette.color5, this);
+ newTemplateOptions.color_palette.color5 = color;
+ break;
+ }
+ updatePreview();
+}