diff options
Diffstat (limited to 'src/widgets/util/qsystemtrayicon.cpp')
-rw-r--r-- | src/widgets/util/qsystemtrayicon.cpp | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 74feb05d9b..2a418167f1 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -141,7 +141,7 @@ QSystemTrayIcon::QSystemTrayIcon(QObject *parent) \sa visible */ QSystemTrayIcon::QSystemTrayIcon(const QIcon &icon, QObject *parent) -: QObject(*new QSystemTrayIconPrivate(), parent) + : QSystemTrayIcon(parent) { setIcon(icon); } @@ -446,19 +446,11 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title titleLabel->setText(title); QFont f = titleLabel->font(); f.setBold(true); -#ifdef Q_OS_WINCE - f.setPointSize(f.pointSize() - 2); -#endif titleLabel->setFont(f); titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows -#ifdef Q_OS_WINCE - const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); - const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2; -#else const int iconSize = 18; const int closeButtonSize = 15; -#endif QPushButton *closeButton = new QPushButton; closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); @@ -468,21 +460,13 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QLabel *msgLabel = new QLabel; -#ifdef Q_OS_WINCE - f.setBold(false); - msgLabel->setFont(f); -#endif msgLabel->installEventFilter(this); msgLabel->setText(message); msgLabel->setTextFormat(Qt::PlainText); msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); // smart size for the message label -#ifdef Q_OS_WINCE - int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2; -#else int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3; -#endif if (msgLabel->sizeHint().width() > limit) { msgLabel->setWordWrap(true); if (msgLabel->sizeHint().width() > limit) { @@ -493,15 +477,9 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title control->document()->setDefaultTextOption(opt); } } -#ifdef Q_OS_WINCE - // Make sure that the text isn't wrapped "somewhere" in the balloon widget - // in the case that we have a long title label. - setMaximumWidth(limit); -#else // Here we allow the text being much smaller than the balloon widget // to emulate the weird standard windows behavior. msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit)); -#endif } QIcon si; @@ -753,9 +731,8 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const // The recursion depth is the same as menu depth, so should not // be higher than 3 levels. - QListIterator<QAction *> it(menu->actions()); - while (it.hasNext()) { - QAction *action = it.next(); + const auto actions = menu->actions(); + for (QAction *action : actions) { if (action->menu()) addPlatformMenu(action->menu()); } |