From 81b55e046309277e06e7bef9ea6387e30fe0e564 Mon Sep 17 00:00:00 2001 From: byloveletter Date: Wed, 10 May 2017 14:15:01 +0900 Subject: [PATCH] =?UTF-8?q?config=20pannel=20button=20,=20config=20window?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -config pannel button : id 추가 -config window : slot 추가 --- app/gui/oven_control/configpanelbutton.cpp | 47 ++++++++++++++++++++++--- app/gui/oven_control/configpanelbutton.h | 20 ++++++++--- app/gui/oven_control/configpanelbutton.ui | 8 ++++- app/gui/oven_control/configwindow.cpp | 28 +++++++++++++++ app/gui/oven_control/configwindow.h | 11 ++++++ app/gui/oven_control/configwindow.ui | 55 ++++++++++++++++++++++++++++++ 6 files changed, 160 insertions(+), 9 deletions(-) diff --git a/app/gui/oven_control/configpanelbutton.cpp b/app/gui/oven_control/configpanelbutton.cpp index 903e787..33240b4 100644 --- a/app/gui/oven_control/configpanelbutton.cpp +++ b/app/gui/oven_control/configpanelbutton.cpp @@ -3,21 +3,27 @@ #include #include +#include -ConfigPanelButton::ConfigPanelButton(QWidget *parent) : +ConfigPanelButton::ConfigPanelButton(QWidget *parent, uint16_t btn_id) : QWidget(parent), ui(new Ui::ConfigPanelButton) { ui->setupUi(this); + btnid = btn_id; + showingFavoriteButton = false; ui->favoriteButton->hide(); textRect = QRect(20, 0, 556, 65); valueRect = QRect(556, 0, 265, 65); - connect(ui->pushButton, SIGNAL(pressed()), SIGNAL(pressed())); - connect(ui->pushButton, SIGNAL(released()), SIGNAL(released())); - connect(ui->pushButton, SIGNAL(clicked()), SIGNAL(clicked())); +// connect(ui->pushButton, SIGNAL(pressed()), SIGNAL(pressed())); +// connect(ui->pushButton, SIGNAL(released()), SIGNAL(released())); +// connect(ui->pushButton, SIGNAL(clicked()), SIGNAL(clicked())); + +// connect(ui->favoriteButton,SIGNAL(clicked(bool)),SIGNAL(checkButtonClicked(bool))); + } ConfigPanelButton::~ConfigPanelButton() @@ -88,3 +94,36 @@ void ConfigPanelButton::updateIcon() ui->pushButton->setIcon(icon); ui->pushButton->setIconSize(pixmap.size()); } + +bool ConfigPanelButton::isFavoriteChecked(){ + return ui->favoriteButton->isChecked(); +} + +void ConfigPanelButton::setFavoriteCheck(bool checked){ + ui->favoriteButton->setChecked(checked); +} + +void ConfigPanelButton::on_favoriteButton_clicked(bool checked) +{ + emit checkButtonClicked(btnid,checked); +} + + + +void ConfigPanelButton::on_pushButton_clicked() +{ + emit clicked(btnid); +} + + + +void ConfigPanelButton::on_pushButton_released() +{ + emit released(btnid); +} + + +void ConfigPanelButton::on_pushButton_pressed() +{ + emit pressed(btnid); +} diff --git a/app/gui/oven_control/configpanelbutton.h b/app/gui/oven_control/configpanelbutton.h index 0b5f3de..554654a 100644 --- a/app/gui/oven_control/configpanelbutton.h +++ b/app/gui/oven_control/configpanelbutton.h @@ -12,7 +12,7 @@ class ConfigPanelButton : public QWidget Q_OBJECT public: - explicit ConfigPanelButton(QWidget *parent = 0); + explicit ConfigPanelButton(QWidget *parent = 0,uint16_t id = 0); ~ConfigPanelButton(); const QString &text() { return text_; } @@ -23,6 +23,8 @@ public slots: void setValue(const QString &value); void showFavoriteButton(); void hideFavoriteButton(); + bool isFavoriteChecked(); + void setFavoriteCheck(bool checked); private: Ui::ConfigPanelButton *ui; @@ -35,14 +37,24 @@ private: bool showingFavoriteButton; bool isFavorited; + uint16_t btnid; private slots: void updateIcon(); + void on_favoriteButton_clicked(bool checked); + + void on_pushButton_clicked(); + + void on_pushButton_released(); + + void on_pushButton_pressed(); + signals: - void pressed(); - void released(); - void clicked(); + void pressed(uint16_t); + void released(uint16_t); + void clicked(uint16_t); + void checkButtonClicked(uint16_t, bool checked); }; #endif // CONFIGPANELBUTTON_H diff --git a/app/gui/oven_control/configpanelbutton.ui b/app/gui/oven_control/configpanelbutton.ui index b5a209d..3fa9217 100644 --- a/app/gui/oven_control/configpanelbutton.ui +++ b/app/gui/oven_control/configpanelbutton.ui @@ -88,11 +88,17 @@ QPushButton:focus { background-image: url(:/images/config/pannel_ov.png); } QPushButton { background-image: url(:/images/config/088_fava_02.png); } -QPushButton:pressed { background-image: url(:/images/config/088_fava_01.png); } +QPushButton:checked { background-image: url(:/images/config/088_fava_01.png); } + + true + + + false + diff --git a/app/gui/oven_control/configwindow.cpp b/app/gui/oven_control/configwindow.cpp index e98d499..f33d22c 100644 --- a/app/gui/oven_control/configwindow.cpp +++ b/app/gui/oven_control/configwindow.cpp @@ -4,6 +4,8 @@ #include "functiontestwindow.h" #include "engineermenuwindow.h" +#include "configpanelbutton.h" + ConfigWindow::ConfigWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::ConfigWindow) @@ -13,6 +15,18 @@ ConfigWindow::ConfigWindow(QWidget *parent) : ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); + ui->scrollAreaMenuLayout->setAlignment(Qt::AlignTop); + ConfigPanelButton *configbtn; + for(int i = 0;i <20;i++){ + configbtn = new ConfigPanelButton(this,i); + configbtn->showFavoriteButton(); + configbtn->setText("TEST"); + configbtn->setValue("test"); + ui->scrollAreaMenuLayout->addWidget(configbtn); + connect(configbtn,SIGNAL(clicked(uint16_t)),SLOT(onConfigBtnClicked(uint16_t))); + } + + } @@ -37,3 +51,17 @@ void ConfigWindow::on_pushButton_3_clicked() w->setWindowModality(Qt::WindowModal); w->showFullScreen(); } + +void ConfigWindow::on_pushButton_8_clicked() +{ + +} + +void ConfigWindow::onConfigBtnClicked(uint16_t id){ + qDebug() << "pressed id " << id; +} + + +void ConfigWindow::onConfigCheckBtnClicked(uint16_t id, bool checked){ + +} diff --git a/app/gui/oven_control/configwindow.h b/app/gui/oven_control/configwindow.h index a97226c..68d2a01 100644 --- a/app/gui/oven_control/configwindow.h +++ b/app/gui/oven_control/configwindow.h @@ -13,6 +13,10 @@ class ConfigWindow : public QMainWindow { Q_OBJECT +private: + const uint16_t m_arrMaxMenuCount[7] ={ + 9,7, + }; public: explicit ConfigWindow(QWidget *parent = 0); ~ConfigWindow(); @@ -24,6 +28,13 @@ private slots: void on_pushButton_3_clicked(); + void on_pushButton_8_clicked(); + + +public slots: + void onConfigBtnClicked(uint16_t id); + void onConfigCheckBtnClicked(uint16_t id, bool checked); + private: Ui::ConfigWindow *ui; }; diff --git a/app/gui/oven_control/configwindow.ui b/app/gui/oven_control/configwindow.ui index ab8ddf9..e3c873c 100644 --- a/app/gui/oven_control/configwindow.ui +++ b/app/gui/oven_control/configwindow.ui @@ -39,6 +39,9 @@ font-size: 30px; 426 + + 0 + #clockContainer { background-image: url(:/images/clock/background.png); } @@ -397,6 +400,58 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); } + + + + 0 + 850 + 900 + 600 + + + + + + + QFrame::NoFrame + + + Qt::ScrollBarAsNeeded + + + true + + + + + 0 + 0 + 900 + 600 + + + + + 0 + 0 + + + + + + + + 10 + + + QLayout::SetDefaultConstraint + + + 0 + + + + -- 2.1.4