Commit be2756ef5b70442ab456e57c58ab5d0f78f00b0f
1 parent
0e279295fd
Exists in
master
and in
2 other branches
패스워드 입력 디자인 변경 외 1건
- 패스워드 디자인 변경 - 실시간 포맷 설정 메뉴 명 변경
Showing
5 changed files
with
60 additions
and
28 deletions
Show diff stats
app/gui/oven_control/config.h
app/gui/oven_control/keyboardwidget.cpp
| ... | ... | @@ -118,6 +118,7 @@ void KeyboardWidget::on_pushButton_42_clicked() |
| 118 | 118 | |
| 119 | 119 | void KeyboardWidget::on_pushButton_39_clicked() |
| 120 | 120 | { |
| 121 | + qDebug() << qApp->focusObject(); | |
| 121 | 122 | QKeyEvent key(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier); |
| 122 | 123 | QGuiApplication::sendEvent(QApplication::focusObject(),&key); |
| 123 | 124 | emit onBackspaceKeyClicked(); | ... | ... |
app/gui/oven_control/servicepassinputdlg.cpp
| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | #include <QDebug> |
| 5 | 5 | #include "soundplayer.h" |
| 6 | 6 | |
| 7 | -#define PASS_WORD "0000" | |
| 8 | 7 | |
| 9 | 8 | ServicePassInputDlg::ServicePassInputDlg(QWidget *parent) : |
| 10 | 9 | QDialog(parent), |
| ... | ... | @@ -16,10 +15,12 @@ ServicePassInputDlg::ServicePassInputDlg(QWidget *parent) : |
| 16 | 15 | setAttribute(Qt::WA_TranslucentBackground); |
| 17 | 16 | setAttribute(Qt::WA_DeleteOnClose); |
| 18 | 17 | this->setResult(QDialog::Accepted); |
| 19 | - | |
| 20 | - | |
| 21 | 18 | foreach (QPushButton *button, findChildren<QPushButton *>()) |
| 22 | 19 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); |
| 20 | + ui->ctrProgressBar->setMaxProgress(0,4); | |
| 21 | + m_nCurInputCount = 0; | |
| 22 | + this->setFocus(); | |
| 23 | + memset(m_strInputPass, 0x00, MAX_PASSWORD+1); | |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | ServicePassInputDlg::~ServicePassInputDlg() |
| ... | ... | @@ -29,7 +30,7 @@ ServicePassInputDlg::~ServicePassInputDlg() |
| 29 | 30 | |
| 30 | 31 | void ServicePassInputDlg::on_ctrBtnOk_clicked() |
| 31 | 32 | { |
| 32 | - if(ui->lineEdit->text() == PASS_WORD){ | |
| 33 | + if( QString(m_strInputPass) == QString(PASS_WORD)){ | |
| 33 | 34 | qDebug() << this->parentWidget() <<this->parent(); |
| 34 | 35 | EngineerMenuWindow *w = new EngineerMenuWindow(this->parentWidget()); |
| 35 | 36 | connect(w,SIGNAL(destroyed(QObject*)),this,SLOT(close())); |
| ... | ... | @@ -38,7 +39,6 @@ void ServicePassInputDlg::on_ctrBtnOk_clicked() |
| 38 | 39 | this->hide(); |
| 39 | 40 | } |
| 40 | 41 | else { |
| 41 | - qDebug()<< "pass incorrect " << ui->lineEdit->text(); | |
| 42 | 42 | reject(); |
| 43 | 43 | } |
| 44 | 44 | } |
| ... | ... | @@ -47,3 +47,23 @@ void ServicePassInputDlg::on_ctrBtnCancel_clicked() |
| 47 | 47 | { |
| 48 | 48 | reject(); |
| 49 | 49 | } |
| 50 | + | |
| 51 | +void ServicePassInputDlg::keyPressEvent(QKeyEvent *event){ | |
| 52 | + if(event->key() == Qt::Key_Backspace){ | |
| 53 | + if(m_nCurInputCount>0) m_nCurInputCount--; | |
| 54 | + m_strInputPass[m_nCurInputCount] = 0; | |
| 55 | + qDebug() <<"back space input" << QString(m_strInputPass); | |
| 56 | + ui->ctrProgressBar->setCurrentProgress(m_nCurInputCount); | |
| 57 | + } | |
| 58 | +} | |
| 59 | + | |
| 60 | +void ServicePassInputDlg::inputMethodEvent(QInputMethodEvent *event){ | |
| 61 | + if(m_nCurInputCount < MAX_PASSWORD){ | |
| 62 | + if(!event->commitString().isEmpty()){ | |
| 63 | + const QChar* in = event->commitString().constData(); | |
| 64 | + m_strInputPass[m_nCurInputCount++] = in[0]; | |
| 65 | + qDebug() <<"input event" << QString(m_strInputPass); | |
| 66 | + ui->ctrProgressBar->setCurrentProgress(m_nCurInputCount); | |
| 67 | + } | |
| 68 | + } | |
| 69 | +} | ... | ... |
app/gui/oven_control/servicepassinputdlg.h
| ... | ... | @@ -2,6 +2,11 @@ |
| 2 | 2 | #define SERVICEPASSINPUTDLG_H |
| 3 | 3 | |
| 4 | 4 | #include <QDialog> |
| 5 | +#include <QKeyEvent> | |
| 6 | + | |
| 7 | + | |
| 8 | +#define PASS_WORD "0000" | |
| 9 | +#define MAX_PASSWORD 4 | |
| 5 | 10 | |
| 6 | 11 | namespace Ui { |
| 7 | 12 | class ServicePassInputDlg; |
| ... | ... | @@ -11,6 +16,12 @@ class ServicePassInputDlg : public QDialog |
| 11 | 16 | { |
| 12 | 17 | Q_OBJECT |
| 13 | 18 | |
| 19 | + void keyPressEvent(QKeyEvent *); | |
| 20 | + void inputMethodEvent(QInputMethodEvent* event); | |
| 21 | + | |
| 22 | + | |
| 23 | + QChar m_strInputPass[MAX_PASSWORD+1]; | |
| 24 | + | |
| 14 | 25 | public: |
| 15 | 26 | explicit ServicePassInputDlg(QWidget *parent = 0); |
| 16 | 27 | ~ServicePassInputDlg(); |
| ... | ... | @@ -22,6 +33,7 @@ private slots: |
| 22 | 33 | |
| 23 | 34 | private: |
| 24 | 35 | Ui::ServicePassInputDlg *ui; |
| 36 | + int m_nCurInputCount; | |
| 25 | 37 | }; |
| 26 | 38 | |
| 27 | 39 | #endif // SERVICEPASSINPUTDLG_H | ... | ... |
app/gui/oven_control/servicepassinputdlg.ui
| ... | ... | @@ -59,10 +59,10 @@ QPushButton::pressed, QPushButton::focus{ |
| 59 | 59 | <x>0</x> |
| 60 | 60 | <y>0</y> |
| 61 | 61 | <width>901</width> |
| 62 | - <height>441</height> | |
| 62 | + <height>431</height> | |
| 63 | 63 | </rect> |
| 64 | 64 | </property> |
| 65 | - <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,6,4"> | |
| 65 | + <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,5,4"> | |
| 66 | 66 | <property name="spacing"> |
| 67 | 67 | <number>0</number> |
| 68 | 68 | </property> |
| ... | ... | @@ -130,12 +130,12 @@ QPushButton::pressed, QPushButton::focus{ |
| 130 | 130 | </widget> |
| 131 | 131 | </item> |
| 132 | 132 | <item> |
| 133 | - <layout class="QGridLayout" name="gridLayout_2" columnstretch="94"> | |
| 133 | + <layout class="QGridLayout" name="gridLayout_2" columnstretch="0"> | |
| 134 | 134 | <property name="leftMargin"> |
| 135 | 135 | <number>20</number> |
| 136 | 136 | </property> |
| 137 | 137 | <property name="topMargin"> |
| 138 | - <number>30</number> | |
| 138 | + <number>0</number> | |
| 139 | 139 | </property> |
| 140 | 140 | <property name="rightMargin"> |
| 141 | 141 | <number>20</number> |
| ... | ... | @@ -147,25 +147,18 @@ QPushButton::pressed, QPushButton::focus{ |
| 147 | 147 | <number>0</number> |
| 148 | 148 | </property> |
| 149 | 149 | <item row="0" column="0"> |
| 150 | - <widget class="QLineEdit" name="lineEdit"> | |
| 151 | - <property name="font"> | |
| 152 | - <font> | |
| 153 | - <pointsize>30</pointsize> | |
| 154 | - </font> | |
| 155 | - </property> | |
| 156 | - <property name="styleSheet"> | |
| 157 | - <string notr="true"> QLineEdit[echoMode="2"] { | |
| 158 | - lineedit-password-character: 8251; | |
| 159 | - }</string> | |
| 160 | - </property> | |
| 161 | - <property name="inputMask"> | |
| 162 | - <string>9999</string> | |
| 150 | + <widget class="DotProgressBarWidget" name="ctrProgressBar" native="true"> | |
| 151 | + <property name="minimumSize"> | |
| 152 | + <size> | |
| 153 | + <width>0</width> | |
| 154 | + <height>150</height> | |
| 155 | + </size> | |
| 163 | 156 | </property> |
| 164 | - <property name="echoMode"> | |
| 165 | - <enum>QLineEdit::Password</enum> | |
| 166 | - </property> | |
| 167 | - <property name="alignment"> | |
| 168 | - <set>Qt::AlignCenter</set> | |
| 157 | + <property name="maximumSize"> | |
| 158 | + <size> | |
| 159 | + <width>400</width> | |
| 160 | + <height>150</height> | |
| 161 | + </size> | |
| 169 | 162 | </property> |
| 170 | 163 | </widget> |
| 171 | 164 | </item> |
| ... | ... | @@ -251,6 +244,12 @@ QPushButton::pressed, QPushButton::focus{ |
| 251 | 244 | <header>keyboardwidget.h</header> |
| 252 | 245 | <container>1</container> |
| 253 | 246 | </customwidget> |
| 247 | + <customwidget> | |
| 248 | + <class>DotProgressBarWidget</class> | |
| 249 | + <extends>QWidget</extends> | |
| 250 | + <header>dotprogressbarwidget.h</header> | |
| 251 | + <container>1</container> | |
| 252 | + </customwidget> | |
| 254 | 253 | </customwidgets> |
| 255 | 254 | <resources> |
| 256 | 255 | <include location="resources.qrc"/> | ... | ... |