From 9d173c92183c30144e8bd4f115b2cd93c3da0d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 20 Feb 2012 14:11:29 +0100 Subject: Updated QApplication / QGuiApplication to match Qt 5 reality. Removed obsolete Q_WS_X11/WIN/MAC stuff as well. Change-Id: I8b65a0348a8cb170f3f060023fc6d9d982949b7e Reviewed-by: Casper van Donderen Reviewed-by: Laszlo Agocs --- src/widgets/widgets/qwidgetresizehandler.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp index aba0ca58c6..5380fb798c 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -326,8 +326,6 @@ void QWidgetResizeHandler::mouseMoveEvent(QMouseEvent *e) else widget->setGeometry(geom); } - - QApplication::syncX(); } void QWidgetResizeHandler::setMouseCursor(MousePosition m) -- cgit v1.2.3 From 1501f1ddd499320c264dc3ab16d4ce8b408991bb Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Wed, 22 Feb 2012 18:29:51 -0800 Subject: QMenuBar: Clean up Q_WS_WIN - Replace Q_WS_WIN with Q_OS_WIN - Remove useless #ifdef Q_OS_WINCE which located in another #ifdef Q_OS_WINCE Change-Id: I6279b6d74902ab3ca6bdb7292c2936a76e3e6952 Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmenubar.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index d797a4e315..16e486e77f 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -1075,7 +1075,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) d->activeMenu = 0; menu->hide(); } -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN if((d->closePopupMode = style()->styleHint(QStyle::SH_MenuBar_DismissOnSecondClick))) update(d->actionRect(action)); #endif @@ -1845,15 +1845,12 @@ void QMenuBar::setDefaultAction(QAction *act) Q_D(QMenuBar); if (d->defaultAction == act) return; -#ifdef Q_OS_WINCE if (qt_wince_is_mobile()) if (d->defaultAction) { disconnect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction())); disconnect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction())); } -#endif d->defaultAction = act; -#ifdef Q_OS_WINCE if (qt_wince_is_mobile()) if (d->defaultAction) { connect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction())); @@ -1862,7 +1859,6 @@ void QMenuBar::setDefaultAction(QAction *act) if (d->wce_menubar) { d->wce_menubar->rebuild(); } -#endif } /*! -- cgit v1.2.3 From d2f65aa470fe30849a01380e4a50e8a4ebbce07e Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Sun, 25 Dec 2011 00:47:41 +0800 Subject: Fix conflict between QMainWindow::restoreState() and QWidget::setStylesheet() If QMainWindow::restoreState() then QWidget::setStylesheet() were called before the QMainWindow is shown, the size of QDockWidget can not be restored. QWidget::setStylesheet() will generate QEvent::StyleChange event, which will cause the function QDockAreaLayout::fitLayout() to be called before the layout of MainWindow is activated. Although the state info has been stored in a QMainWindowLayoutState variable by QMainWindow::restoreState(), but QMainWindowLayout::setGeometry() still isn't called at present. So QDockAreaLayout::fitLayout() will force the size of dockwidgets and centralwidget to be calculated using the wrong geometry, which will break the state restored by QMainWindow::restoreState(). This is a side effect of 692e9103ebb85b90e79377206d5d03b704d43d42. Task-number: QTBUG-15080 Change-Id: I8cda6a529d178f7467a59b780db80df0a44d4769 Reviewed-by: Olivier Goffart --- src/widgets/widgets/qdockarealayout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index df083ccbfe..a07ab73ad0 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -3321,7 +3321,8 @@ void QDockAreaLayout::keepSize(QDockWidget *w) void QDockAreaLayout::styleChangedEvent() { sep = mainWindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainWindow); - fitLayout(); + if (isValid()) + fitLayout(); } QT_END_NAMESPACE -- cgit v1.2.3 From 92f37f00f91fbfc3164ab514d521f0975dc6c5d8 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 21 Feb 2012 11:21:06 +0100 Subject: Remove unused toolTip member variable (qt3 leftover) Change-Id: Ia68fb00afb81a0f521f9fbc3f0dbfc7e43075bbe Reviewed-by: laurent montel Reviewed-by: Stephen Kelly --- src/widgets/widgets/qworkspace.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qworkspace.cpp b/src/widgets/widgets/qworkspace.cpp index be3f7836d5..80f0a7e44a 100644 --- a/src/widgets/widgets/qworkspace.cpp +++ b/src/widgets/widgets/qworkspace.cpp @@ -290,9 +290,6 @@ public: QWorkspaceTitleBarPrivate() : lastControl(QStyle::SC_None), -#ifndef QT_NO_TOOLTIP - toolTip(0), -#endif act(0), window(0), movable(1), pressed(0), autoraise(0), moving(0) { } @@ -301,9 +298,6 @@ public: QStyle::SubControl buttonDown; QStyle::SubControl lastControl; QPoint moveOffset; -#ifndef QT_NO_TOOLTIP - QToolTip *toolTip; -#endif bool act :1; QPointer window; bool movable :1; -- cgit v1.2.3 From ed7f78acba45e1142157e39154466a13f9d3ce4e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Feb 2012 17:27:47 +0100 Subject: Fix tst_qlineedit. - Fix key handling in QWidgetLineControl according to the keyboard scheme returned by the QPlatformTheme, remove #ifdefs. - Do the same in the test. Task-number: QTBUG-21402 Change-Id: I36d836584e7122309061af72819a4147cadd0a74 Reviewed-by: Miikka Heikkinen Reviewed-by: Bradley T. Hughes --- src/widgets/widgets/qwidgetlinecontrol.cpp | 49 +++++++++++++++++++----------- src/widgets/widgets/qwidgetlinecontrol_p.h | 3 ++ 2 files changed, 34 insertions(+), 18 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 2f5793bcba..73c3d14f9b 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -45,6 +45,8 @@ #include "qabstractitemview.h" #include "qclipboard.h" +#include +#include #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" #endif @@ -374,6 +376,14 @@ void QWidgetLineControl::init(const QString &txt) m_text = txt; updateDisplayText(); m_cursor = m_text.length(); + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt(); + // Generalize for X11 + if (m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme + || m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme + || m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme) { + m_keyboardScheme = QPlatformTheme::X11KeyboardScheme; + } } /*! @@ -1630,10 +1640,11 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) else if (event == QKeySequence::Paste) { if (!isReadOnly()) { QClipboard::Mode mode = QClipboard::Clipboard; -#ifdef Q_WS_X11 - if (event->modifiers() == (Qt::CTRL | Qt::SHIFT) && event->key() == Qt::Key_Insert) + if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme + && event->modifiers() == (Qt::CTRL | Qt::SHIFT) + && event->key() == Qt::Key_Insert) { mode = QClipboard::Selection; -#endif + } paste(mode); } } @@ -1664,12 +1675,14 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) end(1); } else if (event == QKeySequence::MoveToNextChar) { -#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) - if (hasSelectedText()) { +#if defined(QT_NO_COMPLETER) + const bool inlineCompletion = false; #else - if (hasSelectedText() && m_completer - && m_completer->completionMode() == QCompleter::InlineCompletion) { + const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion; #endif + if (hasSelectedText() + && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme + || inlineCompletion)) { moveCursor(selectionEnd(), false); } else { cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); @@ -1679,12 +1692,14 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); } else if (event == QKeySequence::MoveToPreviousChar) { -#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) - if (hasSelectedText()) { +#if defined(QT_NO_COMPLETER) + const bool inlineCompletion = false; #else - if (hasSelectedText() && m_completer - && m_completer->completionMode() == QCompleter::InlineCompletion) { + const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion; #endif + if (hasSelectedText() + && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme + || inlineCompletion)) { moveCursor(selectionStart(), false); } else { cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); @@ -1737,8 +1752,8 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) #endif // QT_NO_SHORTCUT else { bool handled = false; -#ifdef Q_WS_MAC - if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) { + if (m_keyboardScheme == QPlatformTheme::MacKeyboardScheme + && (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down)) { Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier); if (myModifiers & Qt::ShiftModifier) { if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier) @@ -1756,7 +1771,6 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) } handled = true; } -#endif if (event->modifiers() & Qt::ControlModifier) { switch (event->key()) { case Qt::Key_Backspace: @@ -1771,13 +1785,13 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) complete(event->key()); break; #endif -#if defined(Q_WS_X11) case Qt::Key_E: - end(0); + if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme) + end(0); break; case Qt::Key_U: - if (!isReadOnly()) { + if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme && !isReadOnly()) { setSelection(0, text().size()); #ifndef QT_NO_CLIPBOARD copy(); @@ -1785,7 +1799,6 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) del(); } break; -#endif default: if (!handled) unknown = true; diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index a0191188a7..72f25e9068 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -100,6 +100,7 @@ public: , m_threadChecks(false) , m_textLayoutThread(0) #endif + , m_keyboardScheme(0) { init(txt); } @@ -527,6 +528,8 @@ private Q_SLOTS: void _q_clipboardChanged(); void _q_deleteSelected(); +private: + int m_keyboardScheme; }; QT_END_NAMESPACE -- cgit v1.2.3 From 5cc1a87250a45068e3ed4cf3e83611ea79b9e37a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 26 Feb 2012 11:00:44 +0100 Subject: Remove usage of deprecated QRect::unite Change-Id: I1920da995fde6ff2a8b2e3facddeee6e3c17b44c Reviewed-by: Frederik Gladhorn --- src/widgets/widgets/qworkspace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qworkspace.cpp b/src/widgets/widgets/qworkspace.cpp index 80f0a7e44a..0031a71ccd 100644 --- a/src/widgets/widgets/qworkspace.cpp +++ b/src/widgets/widgets/qworkspace.cpp @@ -3204,7 +3204,7 @@ QRect QWorkspacePrivate::updateWorkspace() QWorkspaceChild *child = *it; ++it; if (!child->isHidden()) - r = r.unite(child->geometry()); + r = r.united(child->geometry()); } vbar->blockSignals(true); hbar->blockSignals(true); -- cgit v1.2.3 From 446d63be1b85284d6175b4781859d14668755ae3 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Fri, 24 Feb 2012 13:46:33 -0800 Subject: Fix tst_qmenu. Clear away Q_WS_WIN/Q_WS_X11 from QMenu. Using the hint returned by the QPlatformTheme. Task-number: QTBUG-24325 Change-Id: Iaa4da26c74273d7cfc1fbec6519c52d09e10f7bb Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmenu.cpp | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index e619cdf4fc..dad12fe6ab 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -70,10 +70,8 @@ #include #include #include - -#ifdef Q_WS_X11 -# include -#endif +#include +#include QT_BEGIN_NAMESPACE @@ -177,31 +175,23 @@ int QMenuPrivate::scrollerHeight() const //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(const QWidget *widget) const { -#ifdef Q_WS_WIN - return QApplication::desktop()->screenGeometry(widget); -#elif defined Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) + if (QGuiApplicationPrivate::platformTheme() && + QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) { return QApplication::desktop()->screenGeometry(widget); - else - return QApplication::desktop()->availableGeometry(widget); -#else + } else { return QApplication::desktop()->availableGeometry(widget); -#endif + } } //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(int screen) const { -#ifdef Q_WS_WIN - return QApplication::desktop()->screenGeometry(screen); -#elif defined Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) + if (QGuiApplicationPrivate::platformTheme() && + QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) { return QApplication::desktop()->screenGeometry(screen); - else - return QApplication::desktop()->availableGeometry(screen); -#else + } else { return QApplication::desktop()->availableGeometry(screen); -#endif + } } QList > QMenuPrivate::calcCausedStack() const @@ -2261,7 +2251,7 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e) if (action && action == d->currentAction) { if (!action->menu()){ -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) //On Windows only context menus can be activated with the right button if (e->button() == Qt::LeftButton || d->topCausedWidget() == 0) #endif @@ -3000,7 +2990,7 @@ void QMenu::internalDelayedPopup() */ void QMenu::setNoReplayFor(QWidget *noReplayFor) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN d_func()->noReplayFor = noReplayFor; #else Q_UNUSED(noReplayFor); -- cgit v1.2.3 From 64e0560ff451676fc96dfadd21bef436ac25bb52 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 27 Feb 2012 13:54:21 +0200 Subject: Fix submenu positioning Submenus are now positioned to the correct side of the parent menu based on layout direction, if there is enough space on screen to fit the menu. If there is insufficient space, then the menu is positioned to the other side of the parent menu. In case that also causes submenu to be partially ofscreen (very wide menu relative to the screen), then the submenu will be aligned with the screen edge and will overlap the parent menu. This seems like a lesser evil compared to having submenu partially offscreen, which could obscure important details such as checkmarks. Task-number: QTBUG-23568 Change-Id: I6a9ab2c232713a2ee5a6dde3227c40419d46bd3d Reviewed-by: Bradley T. Hughes Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmenu.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index dad12fe6ab..2c97f3355c 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1898,13 +1898,21 @@ void QMenu::popup(const QPoint &p, QAction *atAction) if ((pos.x() + menuSize.width() > parentActionRect.left() - subMenuOffset) && (pos.x() < parentActionRect.right())) { + pos.rx() = parentActionRect.left() - menuSize.width(); + if (pos.x() < screen.x()) pos.rx() = parentActionRect.right(); + if (pos.x() + menuSize.width() > screen.x() + screen.width()) + pos.rx() = screen.x(); } } else { if ((pos.x() < parentActionRect.right() + subMenuOffset) && (pos.x() + menuSize.width() > parentActionRect.left())) { + pos.rx() = parentActionRect.right(); + if (pos.x() + menuSize.width() > screen.x() + screen.width()) pos.rx() = parentActionRect.left() - menuSize.width(); + if (pos.x() < screen.x()) + pos.rx() = screen.x() + screen.width() - menuSize.width(); } } } -- cgit v1.2.3 From bc6ad75d18a029da363afc4f6007aefc7962a8ad Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 26 Feb 2012 10:56:49 +0100 Subject: Remove use of deprecated conversion from QKeySequence Note: UNICODE_ACCEL is Qt3 compatibility and is equal to 0 Change-Id: I808a66772abceb3822d515d69386728264eb1b40 Reviewed-by: Lars Knoll --- src/widgets/widgets/qlineedit.cpp | 3 ++- src/widgets/widgets/qmenu.cpp | 4 ++-- src/widgets/widgets/qwidgettextcontrol.cpp | 4 +++- src/widgets/widgets/qworkspace.cpp | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 77d6f5422a..7118881ef2 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -75,7 +75,8 @@ #include "private/qapplication_p.h" #include "private/qshortcutmap_p.h" #include "qkeysequence.h" -#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString()) +#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \ + QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString()) #else #define ACCEL_KEY(k) QString() #endif diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 2c97f3355c..7ebfdbecae 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -295,7 +295,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const } else { QKeySequence seq = action->shortcut(); if (!seq.isEmpty()) - tabWidth = qMax(int(tabWidth), qfm.width(seq)); + tabWidth = qMax(int(tabWidth), qfm.width(seq.toString(QKeySequence::NativeText))); #endif } sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width()); @@ -1187,7 +1187,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) if (textAndAccel.indexOf(QLatin1Char('\t')) == -1) { QKeySequence seq = action->shortcut(); if (!seq.isEmpty()) - textAndAccel += QLatin1Char('\t') + QString(seq); + textAndAccel += QLatin1Char('\t') + seq.toString(QKeySequence::NativeText); } #endif option->text = textAndAccel; diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index a2c7915a5e..9eeffc1231 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -84,7 +84,9 @@ #include "private/qapplication_p.h" #include "private/qshortcutmap_p.h" #include -#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString()) +#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \ + QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString()) + #else #define ACCEL_KEY(k) QString() #endif diff --git a/src/widgets/widgets/qworkspace.cpp b/src/widgets/widgets/qworkspace.cpp index 0031a71ccd..5cc8e363f1 100644 --- a/src/widgets/widgets/qworkspace.cpp +++ b/src/widgets/widgets/qworkspace.cpp @@ -1079,7 +1079,8 @@ QWorkspacePrivate::init() actions[QWorkspacePrivate::CloseAct] = new QAction(QIcon(q->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, q)), QWorkspace::tr("&Close") #ifndef QT_NO_SHORTCUT - +QLatin1Char('\t')+(QString)QKeySequence(Qt::CTRL+Qt::Key_F4) + + QLatin1Char('\t') + + QKeySequence(Qt::CTRL+Qt::Key_F4).toString(QKeySequence::NativeText) #endif ,q); QObject::connect(actions[QWorkspacePrivate::CloseAct], SIGNAL(triggered()), q, SLOT(closeActiveWindow())); -- cgit v1.2.3 From 838f828a1d76c1f9fc1fba669d336e91f622fb94 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 27 Feb 2012 17:09:43 +0100 Subject: QComboBox: Use platform theme hint to determine popup geometry. Change-Id: I1f81be1394455715c5dfcd2d426758c4c7cd91fc Reviewed-by: Bradley T. Hughes --- src/widgets/widgets/qcombobox.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index d6af8d6044..c5f5d6e6e1 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -43,6 +43,7 @@ #ifndef QT_NO_COMBOBOX #include +#include #include #include #include @@ -57,15 +58,13 @@ #include #include #include +#include #include #include #include #include #include #include -#ifdef Q_WS_X11 -#include -#endif #if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC) #include #include @@ -219,16 +218,12 @@ void QComboBoxPrivate::_q_modelDestroyed() //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QComboBoxPrivate::popupGeometry(int screen) const { -#ifdef Q_WS_WIN - return QApplication::desktop()->screenGeometry(screen); -#elif defined Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) - return QApplication::desktop()->screenGeometry(screen); - else - return QApplication::desktop()->availableGeometry(screen); -#else - return QApplication::desktop()->availableGeometry(screen); -#endif + bool useFullScreenForPopupMenu = false; + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool(); + return useFullScreenForPopupMenu ? + QApplication::desktop()->screenGeometry(screen) : + QApplication::desktop()->availableGeometry(screen); } bool QComboBoxPrivate::updateHoverControl(const QPoint &pos) -- cgit v1.2.3