776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
1
|
#include <QDebug>
|
63a45681f
고영탁
엔코더 기능 구현
|
2
|
#include <QKeyEvent>
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
3
4
|
#include "config1digitsetdlg.h"
#include "ui_config1digitsetdlg.h"
|
66e60ceb5
김태훈
모든 버튼에 음향 효과 추가
|
5
|
#include "soundplayer.h"
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
using namespace Define;
Config1DigitSetDlg::Config1DigitSetDlg(QWidget *parent, ConfigType type) :
QDialog(parent),
ui(new Ui::Config1DigitSetDlg)
{
Config* cfg = Config::getInstance();
QString strTemp1,strTemp2;
config_1digit_set setting_val;
config_item item;
ui->setupUi(this);
this->setWindowFlags( Qt::FramelessWindowHint);
this->setAttribute( Qt::WA_DeleteOnClose);
|
63a45681f
고영탁
엔코더 기능 구현
|
20
21
|
qApp->setActiveWindow(this);
this->setFocus();
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
22
|
|
66e60ceb5
김태훈
모든 버튼에 음향 효과 추가
|
23
24
|
foreach (QPushButton *button, findChildren<QPushButton *>())
connect(button, &QPushButton::pressed, SoundPlayer::playClick);
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
m_nType = type;
ui->ctrLbTitle->setText(cfg->getTitleString(m_nType));
item = cfg->getConfigValue(m_nType);
ui->ctrSpBxValue->setValue(item.d32);
switch(m_nType){
case config_set_auto_darkness:
setting_val = auto_darkness_dlgset;
break;
case config_set_load_ready:
setting_val = load_ready_dlgset;
break;
default:
setting_val.min = 0;
setting_val.str_unit[0] = 0;
setting_val.maxlen=2;
setting_val.max = 10;
break;
}
ui->ctrSpBxValue->setMaximum(setting_val.max);
ui->ctrSpBxValue->setMinimum(setting_val.min);
strTemp1.sprintf("(%%0%dd ~ %%0%dd %s)", setting_val.maxlen,setting_val.maxlen,setting_val.str_unit);
qDebug() <<strTemp1;
strTemp2.sprintf(strTemp1.toLocal8Bit().constData(), setting_val.min,setting_val.max);
ui->ctrLbRange->setText(strTemp2);
strTemp1.sprintf("%%0%d",setting_val.maxlen);
|
d0ee3ccc8
고영탁
버그 수정 및 비밀 번호 입력창 개발
|
55
|
ui->ctrSpBxValue->installEventFilter(this);
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
56
|
|
63a45681f
고영탁
엔코더 기능 구현
|
57
58
|
connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(keyEnter_clicked()));
connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(keyCancel_clicked()));
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
}
Config1DigitSetDlg::~Config1DigitSetDlg()
{
delete ui;
}
void Config1DigitSetDlg::on_ctrBtnOk_clicked()
{
Config* cfg = Config::getInstance();
config_item item;
item.d32 = ui->ctrSpBxValue->value();
cfg->setConfigValue(m_nType,item);
accept();
}
void Config1DigitSetDlg::on_ctrBtnCancel_clicked()
{
reject();
}
|
d0ee3ccc8
고영탁
버그 수정 및 비밀 번호 입력창 개발
|
79
80
81
82
83
84
85
86
87
88
|
bool Config1DigitSetDlg::eventFilter(QObject *object, QEvent *event){
if (object == ui->ctrSpBxValue && event->type() == QEvent::MouseButtonRelease )
{
ui->ctrSpBxValue->selectAll();
qDebug() << "Mouse Release2";
}
return QWidget::eventFilter(object, event);
}
|
63a45681f
고영탁
엔코더 기능 구현
|
89
90
91
92
93
|
void Config1DigitSetDlg::keyPressEvent(QKeyEvent *event){
int i = 0;
switch (event->key())
{
|
01249f413
김태훈
엔코더 방향 반전. 하드웨어가 변경됨
|
94
|
case 0x01000032: // Turn left
|
63a45681f
고영탁
엔코더 기능 구현
|
95
96
97
98
99
100
|
if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus();
else focusPreviousChild();
break;
case 0x01000031: // Push
break;
|
01249f413
김태훈
엔코더 방향 반전. 하드웨어가 변경됨
|
101
|
case 0x01000030: // Turn right
|
63a45681f
고영탁
엔코더 기능 구현
|
102
103
104
105
106
107
108
109
110
111
112
|
if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus();
else focusNextChild();
break;
}
}
void Config1DigitSetDlg::keyReleaseEvent(QKeyEvent *event){
int i = 0;
switch (event->key())
{
|
01249f413
김태훈
엔코더 방향 반전. 하드웨어가 변경됨
|
113
|
case 0x01000032: // Turn left
|
63a45681f
고영탁
엔코더 기능 구현
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus();
else focusPreviousChild();
break;
case 0x01000031: // Push
{
QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
if(btn != NULL){
btn->click();
}
else{
QSpinBox *spbx = qobject_cast<QSpinBox*>(focusWidget());
qDebug() << "grab keyboard";
if(spbx != NULL) {
m_nPrevValue = spbx->value();
ui->keyboardwidget->focusInKeyboard();
}
}
break;
}
|
01249f413
김태훈
엔코더 방향 반전. 하드웨어가 변경됨
|
133
|
case 0x01000030: // Turn right
|
63a45681f
고영탁
엔코더 기능 구현
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus();
else focusNextChild();
break;
}
}
void Config1DigitSetDlg::keyCancel_clicked(){
if(focusWidget() == ui->ctrSpBxValue) ui->ctrSpBxValue->setValue(m_nPrevValue);
ui->keyboardwidget->focusOutKeyboard();
}
void Config1DigitSetDlg::keyEnter_clicked(){
ui->keyboardwidget->focusOutKeyboard();
}
|