Commit 81b55e046309277e06e7bef9ea6387e30fe0e564
1 parent
774c1995b2
Exists in
master
and in
2 other branches
config pannel button , config window 수정
-config pannel button : id 추가 -config window : slot 추가
Showing
6 changed files
with
160 additions
and
9 deletions
Show diff stats
app/gui/oven_control/configpanelbutton.cpp
| ... | ... | @@ -3,21 +3,27 @@ |
| 3 | 3 | |
| 4 | 4 | #include <QPixmap> |
| 5 | 5 | #include <QPainter> |
| 6 | +#include <QDebug> | |
| 6 | 7 | |
| 7 | -ConfigPanelButton::ConfigPanelButton(QWidget *parent) : | |
| 8 | +ConfigPanelButton::ConfigPanelButton(QWidget *parent, uint16_t btn_id) : | |
| 8 | 9 | QWidget(parent), |
| 9 | 10 | ui(new Ui::ConfigPanelButton) |
| 10 | 11 | { |
| 11 | 12 | ui->setupUi(this); |
| 12 | 13 | |
| 14 | + btnid = btn_id; | |
| 15 | + | |
| 13 | 16 | showingFavoriteButton = false; |
| 14 | 17 | ui->favoriteButton->hide(); |
| 15 | 18 | |
| 16 | 19 | textRect = QRect(20, 0, 556, 65); |
| 17 | 20 | valueRect = QRect(556, 0, 265, 65); |
| 18 | - connect(ui->pushButton, SIGNAL(pressed()), SIGNAL(pressed())); | |
| 19 | - connect(ui->pushButton, SIGNAL(released()), SIGNAL(released())); | |
| 20 | - connect(ui->pushButton, SIGNAL(clicked()), SIGNAL(clicked())); | |
| 21 | +// connect(ui->pushButton, SIGNAL(pressed()), SIGNAL(pressed())); | |
| 22 | +// connect(ui->pushButton, SIGNAL(released()), SIGNAL(released())); | |
| 23 | +// connect(ui->pushButton, SIGNAL(clicked()), SIGNAL(clicked())); | |
| 24 | + | |
| 25 | +// connect(ui->favoriteButton,SIGNAL(clicked(bool)),SIGNAL(checkButtonClicked(bool))); | |
| 26 | + | |
| 21 | 27 | } |
| 22 | 28 | |
| 23 | 29 | ConfigPanelButton::~ConfigPanelButton() |
| ... | ... | @@ -88,3 +94,36 @@ void ConfigPanelButton::updateIcon() |
| 88 | 94 | ui->pushButton->setIcon(icon); |
| 89 | 95 | ui->pushButton->setIconSize(pixmap.size()); |
| 90 | 96 | } |
| 97 | + | |
| 98 | +bool ConfigPanelButton::isFavoriteChecked(){ | |
| 99 | + return ui->favoriteButton->isChecked(); | |
| 100 | +} | |
| 101 | + | |
| 102 | +void ConfigPanelButton::setFavoriteCheck(bool checked){ | |
| 103 | + ui->favoriteButton->setChecked(checked); | |
| 104 | +} | |
| 105 | + | |
| 106 | +void ConfigPanelButton::on_favoriteButton_clicked(bool checked) | |
| 107 | +{ | |
| 108 | + emit checkButtonClicked(btnid,checked); | |
| 109 | +} | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | +void ConfigPanelButton::on_pushButton_clicked() | |
| 114 | +{ | |
| 115 | + emit clicked(btnid); | |
| 116 | +} | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | +void ConfigPanelButton::on_pushButton_released() | |
| 121 | +{ | |
| 122 | + emit released(btnid); | |
| 123 | +} | |
| 124 | + | |
| 125 | + | |
| 126 | +void ConfigPanelButton::on_pushButton_pressed() | |
| 127 | +{ | |
| 128 | + emit pressed(btnid); | |
| 129 | +} | ... | ... |
app/gui/oven_control/configpanelbutton.h
| ... | ... | @@ -12,7 +12,7 @@ class ConfigPanelButton : public QWidget |
| 12 | 12 | Q_OBJECT |
| 13 | 13 | |
| 14 | 14 | public: |
| 15 | - explicit ConfigPanelButton(QWidget *parent = 0); | |
| 15 | + explicit ConfigPanelButton(QWidget *parent = 0,uint16_t id = 0); | |
| 16 | 16 | ~ConfigPanelButton(); |
| 17 | 17 | |
| 18 | 18 | const QString &text() { return text_; } |
| ... | ... | @@ -23,6 +23,8 @@ public slots: |
| 23 | 23 | void setValue(const QString &value); |
| 24 | 24 | void showFavoriteButton(); |
| 25 | 25 | void hideFavoriteButton(); |
| 26 | + bool isFavoriteChecked(); | |
| 27 | + void setFavoriteCheck(bool checked); | |
| 26 | 28 | |
| 27 | 29 | private: |
| 28 | 30 | Ui::ConfigPanelButton *ui; |
| ... | ... | @@ -35,14 +37,24 @@ private: |
| 35 | 37 | |
| 36 | 38 | bool showingFavoriteButton; |
| 37 | 39 | bool isFavorited; |
| 40 | + uint16_t btnid; | |
| 38 | 41 | |
| 39 | 42 | private slots: |
| 40 | 43 | void updateIcon(); |
| 41 | 44 | |
| 45 | + void on_favoriteButton_clicked(bool checked); | |
| 46 | + | |
| 47 | + void on_pushButton_clicked(); | |
| 48 | + | |
| 49 | + void on_pushButton_released(); | |
| 50 | + | |
| 51 | + void on_pushButton_pressed(); | |
| 52 | + | |
| 42 | 53 | signals: |
| 43 | - void pressed(); | |
| 44 | - void released(); | |
| 45 | - void clicked(); | |
| 54 | + void pressed(uint16_t); | |
| 55 | + void released(uint16_t); | |
| 56 | + void clicked(uint16_t); | |
| 57 | + void checkButtonClicked(uint16_t, bool checked); | |
| 46 | 58 | }; |
| 47 | 59 | |
| 48 | 60 | #endif // CONFIGPANELBUTTON_H | ... | ... |
app/gui/oven_control/configpanelbutton.ui
| ... | ... | @@ -88,11 +88,17 @@ QPushButton:focus { background-image: url(:/images/config/pannel_ov.png); }</str |
| 88 | 88 | </property> |
| 89 | 89 | <property name="styleSheet"> |
| 90 | 90 | <string notr="true">QPushButton { background-image: url(:/images/config/088_fava_02.png); } |
| 91 | -QPushButton:pressed { background-image: url(:/images/config/088_fava_01.png); }</string> | |
| 91 | +QPushButton:checked { background-image: url(:/images/config/088_fava_01.png); }</string> | |
| 92 | 92 | </property> |
| 93 | 93 | <property name="text"> |
| 94 | 94 | <string/> |
| 95 | 95 | </property> |
| 96 | + <property name="checkable"> | |
| 97 | + <bool>true</bool> | |
| 98 | + </property> | |
| 99 | + <property name="checked"> | |
| 100 | + <bool>false</bool> | |
| 101 | + </property> | |
| 96 | 102 | </widget> |
| 97 | 103 | </widget> |
| 98 | 104 | <resources/> | ... | ... |
app/gui/oven_control/configwindow.cpp
| ... | ... | @@ -4,6 +4,8 @@ |
| 4 | 4 | #include "functiontestwindow.h" |
| 5 | 5 | #include "engineermenuwindow.h" |
| 6 | 6 | |
| 7 | +#include "configpanelbutton.h" | |
| 8 | + | |
| 7 | 9 | ConfigWindow::ConfigWindow(QWidget *parent) : |
| 8 | 10 | QMainWindow(parent), |
| 9 | 11 | ui(new Ui::ConfigWindow) |
| ... | ... | @@ -13,6 +15,18 @@ ConfigWindow::ConfigWindow(QWidget *parent) : |
| 13 | 15 | ui->clockContainer->setParent(ui->upperStack); |
| 14 | 16 | setAttribute(Qt::WA_DeleteOnClose); |
| 15 | 17 | |
| 18 | + ui->scrollAreaMenuLayout->setAlignment(Qt::AlignTop); | |
| 19 | + ConfigPanelButton *configbtn; | |
| 20 | + for(int i = 0;i <20;i++){ | |
| 21 | + configbtn = new ConfigPanelButton(this,i); | |
| 22 | + configbtn->showFavoriteButton(); | |
| 23 | + configbtn->setText("TEST"); | |
| 24 | + configbtn->setValue("test"); | |
| 25 | + ui->scrollAreaMenuLayout->addWidget(configbtn); | |
| 26 | + connect(configbtn,SIGNAL(clicked(uint16_t)),SLOT(onConfigBtnClicked(uint16_t))); | |
| 27 | + } | |
| 28 | + | |
| 29 | + | |
| 16 | 30 | |
| 17 | 31 | } |
| 18 | 32 | |
| ... | ... | @@ -37,3 +51,17 @@ void ConfigWindow::on_pushButton_3_clicked() |
| 37 | 51 | w->setWindowModality(Qt::WindowModal); |
| 38 | 52 | w->showFullScreen(); |
| 39 | 53 | } |
| 54 | + | |
| 55 | +void ConfigWindow::on_pushButton_8_clicked() | |
| 56 | +{ | |
| 57 | + | |
| 58 | +} | |
| 59 | + | |
| 60 | +void ConfigWindow::onConfigBtnClicked(uint16_t id){ | |
| 61 | + qDebug() << "pressed id " << id; | |
| 62 | +} | |
| 63 | + | |
| 64 | + | |
| 65 | +void ConfigWindow::onConfigCheckBtnClicked(uint16_t id, bool checked){ | |
| 66 | + | |
| 67 | +} | ... | ... |
app/gui/oven_control/configwindow.h
| ... | ... | @@ -13,6 +13,10 @@ class ConfigWindow : public QMainWindow |
| 13 | 13 | { |
| 14 | 14 | Q_OBJECT |
| 15 | 15 | |
| 16 | +private: | |
| 17 | + const uint16_t m_arrMaxMenuCount[7] ={ | |
| 18 | + 9,7, | |
| 19 | + }; | |
| 16 | 20 | public: |
| 17 | 21 | explicit ConfigWindow(QWidget *parent = 0); |
| 18 | 22 | ~ConfigWindow(); |
| ... | ... | @@ -24,6 +28,13 @@ private slots: |
| 24 | 28 | |
| 25 | 29 | void on_pushButton_3_clicked(); |
| 26 | 30 | |
| 31 | + void on_pushButton_8_clicked(); | |
| 32 | + | |
| 33 | + | |
| 34 | +public slots: | |
| 35 | + void onConfigBtnClicked(uint16_t id); | |
| 36 | + void onConfigCheckBtnClicked(uint16_t id, bool checked); | |
| 37 | + | |
| 27 | 38 | private: |
| 28 | 39 | Ui::ConfigWindow *ui; |
| 29 | 40 | }; | ... | ... |
app/gui/oven_control/configwindow.ui
| ... | ... | @@ -39,6 +39,9 @@ font-size: 30px; |
| 39 | 39 | <height>426</height> |
| 40 | 40 | </rect> |
| 41 | 41 | </property> |
| 42 | + <property name="currentIndex"> | |
| 43 | + <number>0</number> | |
| 44 | + </property> | |
| 42 | 45 | <widget class="QWidget" name="clockContainer"> |
| 43 | 46 | <property name="styleSheet"> |
| 44 | 47 | <string notr="true">#clockContainer { background-image: url(:/images/clock/background.png); }</string> |
| ... | ... | @@ -397,6 +400,58 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</str |
| 397 | 400 | </property> |
| 398 | 401 | </widget> |
| 399 | 402 | </widget> |
| 403 | + <widget class="QScrollArea" name="scrollArea"> | |
| 404 | + <property name="geometry"> | |
| 405 | + <rect> | |
| 406 | + <x>0</x> | |
| 407 | + <y>850</y> | |
| 408 | + <width>900</width> | |
| 409 | + <height>600</height> | |
| 410 | + </rect> | |
| 411 | + </property> | |
| 412 | + <property name="styleSheet"> | |
| 413 | + <string notr="true"/> | |
| 414 | + </property> | |
| 415 | + <property name="frameShape"> | |
| 416 | + <enum>QFrame::NoFrame</enum> | |
| 417 | + </property> | |
| 418 | + <property name="verticalScrollBarPolicy"> | |
| 419 | + <enum>Qt::ScrollBarAsNeeded</enum> | |
| 420 | + </property> | |
| 421 | + <property name="widgetResizable"> | |
| 422 | + <bool>true</bool> | |
| 423 | + </property> | |
| 424 | + <widget class="QWidget" name="scrollAreaMenu"> | |
| 425 | + <property name="geometry"> | |
| 426 | + <rect> | |
| 427 | + <x>0</x> | |
| 428 | + <y>0</y> | |
| 429 | + <width>900</width> | |
| 430 | + <height>600</height> | |
| 431 | + </rect> | |
| 432 | + </property> | |
| 433 | + <property name="sizePolicy"> | |
| 434 | + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> | |
| 435 | + <horstretch>0</horstretch> | |
| 436 | + <verstretch>0</verstretch> | |
| 437 | + </sizepolicy> | |
| 438 | + </property> | |
| 439 | + <property name="styleSheet"> | |
| 440 | + <string notr="true"/> | |
| 441 | + </property> | |
| 442 | + <layout class="QVBoxLayout" name="scrollAreaMenuLayout"> | |
| 443 | + <property name="spacing"> | |
| 444 | + <number>10</number> | |
| 445 | + </property> | |
| 446 | + <property name="sizeConstraint"> | |
| 447 | + <enum>QLayout::SetDefaultConstraint</enum> | |
| 448 | + </property> | |
| 449 | + <property name="rightMargin"> | |
| 450 | + <number>0</number> | |
| 451 | + </property> | |
| 452 | + </layout> | |
| 453 | + </widget> | |
| 454 | + </widget> | |
| 400 | 455 | </widget> |
| 401 | 456 | </widget> |
| 402 | 457 | <customwidgets> | ... | ... |