-
Notifications
You must be signed in to change notification settings - Fork 59
/
contourrulerparams.cpp
45 lines (39 loc) · 1.22 KB
/
contourrulerparams.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "contourrulerparams.h"
#include "ui_contourrulerparams.h"
#include <QSettings>
#include <QColorDialog>
static inline QString colorButtonStyleSheet(const QColor &bgColor)
{
if (bgColor.isValid()) {
QString rc = QLatin1String("border: 2px solid black; border-radius: 2px; background:");
rc += bgColor.name();
return rc;
}
return QLatin1String("border: 2px dotted black; border-radius: 2px;");
}
ContourRulerParams::ContourRulerParams(QWidget *parent) :
QDialog(parent),
ui(new Ui::ContourRulerParams)
{
ui->setupUi(this);
QSettings set;
ui->setColorPB->setStyleSheet(colorButtonStyleSheet(set.value("contourRulerColor","grey").toString()));
}
ContourRulerParams::~ContourRulerParams()
{
delete ui;
}
void ContourRulerParams::on_radialAngleSB_valueChanged(int arg1)
{
QSettings set;
set.setValue("contourRulerRadialDeg", arg1);
emit updateParms();
}
void ContourRulerParams::on_setColorPB_clicked()
{
QColor color = QColorDialog::getColor( ui->setColorPB->palette().color(QPalette::Background));
QSettings set;
set.setValue("contourRulerColor", color.name());
ui->setColorPB->setStyleSheet(colorButtonStyleSheet(color));
emit updateParms();
}