diff options
author | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-11-20 01:14:22 +0200 |
---|---|---|
committer | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-11-20 01:14:22 +0200 |
commit | 17bde4246c7e3f25c566f15e1ed218cf646a0f93 (patch) | |
tree | e9a879bf36c55b51079be7413dcd78c04e9e837b /client | |
parent | 3b45f27f389976718efaccdf71878e5455303da2 (diff) |
FIX click event handling on bottom buttons
Diffstat (limited to 'client')
-rw-r--r-- | client/Dialog.cpp | 18 | ||||
-rw-r--r-- | client/Dialog.h | 2 | ||||
-rw-r--r-- | client/UpdatedConfig.h | 2 | ||||
-rw-r--r-- | client/style.qss | 17 |
4 files changed, 28 insertions, 11 deletions
diff --git a/client/Dialog.cpp b/client/Dialog.cpp index 40f1a1c..f90d5b1 100644 --- a/client/Dialog.cpp +++ b/client/Dialog.cpp @@ -6,6 +6,7 @@ #include "UpdatedConfig.h" #include "Dialog.h" #include "Proxy.h" +#include "RichTextPushButton.h" using namespace std; @@ -43,6 +44,7 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) topPanelLayout->addWidget(stateBox, 1, 0); topPanelLayout->addWidget(cityBox, 2, 0); genericProxyGroup = new QButtonGroup; + staticProxyGroup = new QButtonGroup; /* static proxy panel */ bottomLabel = new QLabel(QString::fromLocal8Bit(cfg->BottomPanelText.c_str())); @@ -69,16 +71,18 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) ss << " "; } ss << staticProxyLine[j].name; - + QString btnStr = QString::fromLocal8Bit(ss.str().c_str()); QLabel *btnLabel = new QLabel(btnStr); + btnLabel->setAttribute(Qt::WA_TransparentForMouseEvents); QHBoxLayout *btnLayout = new QHBoxLayout; btnLayout->addWidget(btnLabel); btnLayout->setSizeConstraint(QLayout::SetMinimumSize); QPushButton *btn = new QPushButton(); btn->setObjectName("bottomBtn"); - btn->setLayout(btnLayout); btn->setCheckable(true); + btn->setLayout(btnLayout); + staticProxyGroup->addButton(btn); bottomPanelLayout->addWidget(btn, i, j); } } @@ -92,6 +96,16 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) setLayout(mainLayout); } +void ProxyDialog::StaticToggle(bool val) +{ + Logger::Debug("toggle: %s\n", val ? "true" : "false"); +} + +void ProxyDialog::StaticClick() +{ + Logger::Debug("click\n"); +} + void ProxyDialog::CountryActivated(int index) { Logger::Trace("Country activated. Activated index=%d\n", index); diff --git a/client/Dialog.h b/client/Dialog.h index e777cf9..b2d21d3 100644 --- a/client/Dialog.h +++ b/client/Dialog.h @@ -30,6 +30,8 @@ private slots: void StateActivated(int index); void CityActivated(int index); + void StaticToggle(bool toggle); + void StaticClick(); private: QButtonGroup *genericProxyGroup; QButtonGroup *staticProxyGroup; diff --git a/client/UpdatedConfig.h b/client/UpdatedConfig.h index bc58ca5..5470d4d 100644 --- a/client/UpdatedConfig.h +++ b/client/UpdatedConfig.h @@ -49,7 +49,7 @@ private: SslClient *client; /** - * @brief timer that is responsible on config updates + * @brief timer that is responsible on config updates and reconnection retries */ QTimer *configUpdateTimer; diff --git a/client/style.qss b/client/style.qss index 89cfb89..8ab52ce 100644 --- a/client/style.qss +++ b/client/style.qss @@ -22,6 +22,7 @@ QFrame { border-width: 3; } + /* customize label style */ QLabel { border: none; @@ -31,21 +32,21 @@ QLabel { } QLabel#topLabel { - font-family: monospace; - font-weight: bold; - font-style: italic; - font-size: 16px; - color: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 lightblue, stop: 0.5 blue, stop: 1 navy); +font-family: monospace; + font-weight: bold; + font-style: italic; + font-size: 16px; + color: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 lightblue, stop: 0.5 blue, stop: 1 navy); } QLabel#bottomLabel { - font-weight: bold; - color: qlineargradient( x1: 0, y1: 0, x2: 1, y2: 1, stop: 0 yellow, stop: 0.5 green, stop: 1 purple); + font-weight: bold; + color: qlineargradient( x1: 0, y1: 0, x2: 1, y2: 1, stop: 0 yellow, stop: 0.5 green, stop: 1 purple); } /* Customize bottom buttons labels */ QPushButton#bottomBtn QLabel { - font-family: monospace; + font-family: monospace; } |