summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-08-28 09:29:45 +0200
committerJędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>2015-09-01 06:06:30 +0000
commit3363398802fd224ff0557a3d9595baa45969e36c (patch)
tree175b920d059d1b3861ef3d3cc9bea3b1d09ca0f6 /examples/widgets
parentfe1ea010b946518803ca1cec1332945c26be83af (diff)
Polish the systray example.
- Port it to new connection syntax. - Replace module include by class includes. Change-Id: I1b8d682bb7bb2e05b6b2b77a9c0d01730ea09cf2 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/desktop/systray/window.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/examples/widgets/desktop/systray/window.cpp b/examples/widgets/desktop/systray/window.cpp
index b212dc440d..931e443de7 100644
--- a/examples/widgets/desktop/systray/window.cpp
+++ b/examples/widgets/desktop/systray/window.cpp
@@ -42,11 +42,11 @@
#ifndef QT_NO_SYSTEMTRAYICON
-#include <QtGui>
-
#include <QAction>
#include <QCheckBox>
#include <QComboBox>
+#include <QCoreApplication>
+#include <QCloseEvent>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
@@ -68,12 +68,13 @@ Window::Window()
createActions();
createTrayIcon();
- connect(showMessageButton, SIGNAL(clicked()), this, SLOT(showMessage()));
- connect(showIconCheckBox, SIGNAL(toggled(bool)), trayIcon, SLOT(setVisible(bool)));
- connect(iconComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setIcon(int)));
- connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
- connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
- this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
+ connect(showMessageButton, &QAbstractButton::clicked, this, &Window::showMessage);
+ connect(showIconCheckBox, &QAbstractButton::toggled, trayIcon, &QSystemTrayIcon::setVisible);
+ typedef void (QComboBox::*QComboIntSignal)(int);
+ connect(iconComboBox, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged),
+ this, &Window::setIcon);
+ connect(trayIcon, &QSystemTrayIcon::messageClicked, this, &Window::messageClicked);
+ connect(trayIcon, &QSystemTrayIcon::activated, this, &Window::iconActivated);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(iconGroupBox);
@@ -245,16 +246,16 @@ void Window::createMessageGroupBox()
void Window::createActions()
{
minimizeAction = new QAction(tr("Mi&nimize"), this);
- connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));
+ connect(minimizeAction, &QAction::triggered, this, &QWidget::hide);
maximizeAction = new QAction(tr("Ma&ximize"), this);
- connect(maximizeAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
+ connect(maximizeAction, &QAction::triggered, this, &QWidget::showMaximized);
restoreAction = new QAction(tr("&Restore"), this);
- connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal()));
+ connect(restoreAction, &QAction::triggered, this, &QWidget::showNormal);
quitAction = new QAction(tr("&Quit"), this);
- connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+ connect(quitAction, &QAction::triggered, qApp, &QCoreApplication::quit);
}
void Window::createTrayIcon()