-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedittagdialog.cpp
49 lines (40 loc) · 1.34 KB
/
edittagdialog.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
46
47
48
#include "edittagdialog.h"
#include "ui_edittagdialog.h"
#include "qdragablelabel.h"
#include <QColorDialog>
EditTagDialog::EditTagDialog(QDragableLabel &tag, QWidget *parent)
: QDialog(parent)
, ui(new Ui::EditTagDialog)
, m_tag(tag)
{
ui->setupUi(this);
ui->fontCB->setCurrentFont(m_tag.getFont());
m_tagFront = m_tag.getFrontColor();
m_tagBackground = m_tag.getBackgroundColor();
ui->numberSB->setValue(m_tag.getNumber());
ui->shapeCB->setCurrentIndex((int)m_tag.getShape());
}
EditTagDialog::~EditTagDialog()
{
delete ui;
}
void EditTagDialog::on_buttonBox_accepted()
{
m_tag.setFont(ui->fontCB->currentFont());
m_tag.setFrontColor(m_tagFront);
m_tag.setBackgroundColor(m_tagBackground);
m_tag.setNumber(ui->numberSB->value());
m_tag.setShape((QDragableLabel::Shape)ui->shapeCB->currentIndex());
}
void EditTagDialog::on_frontColorPB_clicked()
{
QColor newFrontColor = QColorDialog::getColor(m_tagFront, this, trUtf8("Choose a text color"));
if (newFrontColor.isValid())
m_tagFront = newFrontColor;
}
void EditTagDialog::on_backgroundColorPB_clicked()
{
QColor newBackgroundColor = QColorDialog::getColor(m_tagBackground, this, trUtf8("Choose a background color"), QColorDialog::ShowAlphaChannel);
if (newBackgroundColor.isValid())
m_tagBackground = newBackgroundColor;
}