diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 11 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication_p.h | 6 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication_qpa.cpp | 79 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 1 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_qpa.cpp | 14 | ||||
-rw-r--r-- | src/widgets/statemachine/qguistatemachine.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qdockarealayout.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qdockarealayout_p.h | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qmainwindowlayout.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qmdisubwindow.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qmenubar.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qtabbar.cpp | 4 |
13 files changed, 97 insertions, 31 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 095b58eeaf..90b64db579 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -131,8 +131,11 @@ QApplicationPrivate *QApplicationPrivate::self = 0; static void initSystemPalette() { if (!QApplicationPrivate::sys_pal) - if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette()) + if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette()) { QApplicationPrivate::setSystemPalette(*themePalette); + QApplicationPrivate::initializeWidgetPaletteHash(); + } + if (!QApplicationPrivate::sys_pal && QApplicationPrivate::app_style) QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette()); } @@ -428,11 +431,6 @@ PaletteHash *qt_app_palettes_hash() return app_palettes(); } -FontHash::FontHash() -{ - QHash<QByteArray, QFont>::operator=(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFonts()); -} - Q_GLOBAL_STATIC(FontHash, app_fonts) FontHash *qt_app_fonts_hash() { @@ -3124,7 +3122,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e) case QEvent::ChildRemoved: case QEvent::UpdateRequest: case QEvent::UpdateLater: - case QEvent::AccessibilityPrepare: case QEvent::LocaleChange: case QEvent::Style: case QEvent::IconDrag: diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index ae4f0c2044..2d639172e2 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -157,10 +157,7 @@ QMacTabletHash *qt_mac_tablet_hash(); # endif #endif -struct FontHash : public QHash<QByteArray, QFont> -{ - FontHash(); -}; +typedef QHash<QByteArray, QFont> FontHash; FontHash *qt_app_fonts_hash(); typedef QHash<QByteArray, QPalette> PaletteHash; @@ -292,6 +289,7 @@ public: static void setSystemPalette(const QPalette &pal); static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash); static void initializeWidgetPaletteHash(); + static void initializeWidgetFontHash(); static void setSystemFont(const QFont &font); #if defined(Q_WS_X11) diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp index 54c5c39396..97fc794252 100644 --- a/src/widgets/kernel/qapplication_qpa.cpp +++ b/src/widgets/kernel/qapplication_qpa.cpp @@ -289,8 +289,85 @@ void QApplicationPrivate::cleanupMultitouch_sys() { } +static void setPossiblePalette(const QPalette *palette, const char *className) +{ + if (palette == 0) + return; + QApplicationPrivate::setPalette_helper(*palette, className, false); +} + + void QApplicationPrivate::initializeWidgetPaletteHash() { + QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme(); + if (!platformTheme) + return; + setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::HeaderPalette), "QHeaderView"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::HeaderPalette), "Q3Header"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::ItemViewPalette), "QAbstractItemView"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::MessageBoxLabelPelette), "QMessageBoxLabel"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::TabBarPalette), "QTabBar"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::LabelPalette), "QLabel"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::GroupBoxPalette), "QGroupBox"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::MenuPalette), "QMenu"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::MenuBarPalette), "QMenuBar"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::TextEditPalette), "QTextEdit"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::TextEditPalette), "QTextControl"); + setPossiblePalette(platformTheme->palette(QPlatformTheme::TextLineEditPalette), "QLineEdit"); +} + +void QApplicationPrivate::initializeWidgetFontHash() +{ + const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); + if (!theme) + return; + FontHash *fontHash = qt_app_fonts_hash(); + if (const QFont *font = theme->font(QPlatformTheme::MenuFont)) + fontHash->insert(QByteArrayLiteral("QMenu"), *font); + if (const QFont *font = theme->font(QPlatformTheme::MenuBarFont)) + fontHash->insert(QByteArrayLiteral("QMenuBar"), *font); + if (const QFont *font = theme->font(QPlatformTheme::MenuItemFont)) + fontHash->insert(QByteArrayLiteral("QMenuItem"), *font); + if (const QFont *font = theme->font(QPlatformTheme::MessageBoxFont)) + fontHash->insert(QByteArrayLiteral("QMessageBox"), *font); + if (const QFont *font = theme->font(QPlatformTheme::LabelFont)) + fontHash->insert(QByteArrayLiteral("QLabel"), *font); + if (const QFont *font = theme->font(QPlatformTheme::TipLabelFont)) + fontHash->insert(QByteArrayLiteral("QTipLabel"), *font); + if (const QFont *font = theme->font(QPlatformTheme::TitleBarFont)) + fontHash->insert(QByteArrayLiteral("QTitleBar"), *font); + if (const QFont *font = theme->font(QPlatformTheme::StatusBarFont)) + fontHash->insert(QByteArrayLiteral("QStatusBar"), *font); + if (const QFont *font = theme->font(QPlatformTheme::MdiSubWindowTitleFont)) { + fontHash->insert(QByteArrayLiteral("QWorkspaceTitleBar"), *font); + fontHash->insert(QByteArrayLiteral("QMdiSubWindowTitleBar"), *font); + } + if (const QFont *font = theme->font(QPlatformTheme::DockWidgetTitleFont)) + fontHash->insert(QByteArrayLiteral("QDockWidgetTitle"), *font); + if (const QFont *font = theme->font(QPlatformTheme::PushButtonFont)) + fontHash->insert(QByteArrayLiteral("QPushButton"), *font); + if (const QFont *font = theme->font(QPlatformTheme::ToolButtonFont)) + fontHash->insert(QByteArrayLiteral("QToolButton"), *font); + if (const QFont *font = theme->font(QPlatformTheme::ItemViewFont)) + fontHash->insert(QByteArrayLiteral("QAbstractItemView"), *font); + if (const QFont *font = theme->font(QPlatformTheme::ListViewFont)) + fontHash->insert(QByteArrayLiteral("QListViewFont"), *font); + if (const QFont *font = theme->font(QPlatformTheme::HeaderViewFont)) { + fontHash->insert(QByteArrayLiteral("QHeaderViewFont"), *font); + fontHash->insert(QByteArrayLiteral("Q3Header"), *font); + } + if (const QFont *font = theme->font(QPlatformTheme::ListBoxFont)) + fontHash->insert(QByteArrayLiteral("QListBox"), *font); + if (const QFont *font = theme->font(QPlatformTheme::ComboMenuItemFont)) + fontHash->insert(QByteArrayLiteral("QComboMenuItemFont"), *font); + if (const QFont *font = theme->font(QPlatformTheme::ComboLineEditFont)) + fontHash->insert(QByteArrayLiteral("QComboLineEditFont"), *font); + if (const QFont *font = theme->font(QPlatformTheme::SmallFont)) + fontHash->insert(QByteArrayLiteral("QSmallFont"), *font); + if (const QFont *font = theme->font(QPlatformTheme::MiniFont)) + fontHash->insert(QByteArrayLiteral("QMiniFont"), *font); } #ifndef QT_NO_WHEELEVENT @@ -391,6 +468,7 @@ QPlatformNativeInterface *QApplication::platformNativeInterface() void qt_init(QApplicationPrivate *priv, int type) { + Q_UNUSED(priv); Q_UNUSED(type); qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); @@ -398,6 +476,7 @@ void qt_init(QApplicationPrivate *priv, int type) if (const QPalette *toolTipPalette = QGuiApplicationPrivate::platformTheme()->palette(QPlatformTheme::ToolTipPalette)) QToolTip::setPalette(*toolTipPalette); + QApplicationPrivate::initializeWidgetFontHash(); qApp->setObjectName(appName); } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 5eee5752cc..bf864503a4 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8390,7 +8390,6 @@ void QWidget::mouseReleaseEvent(QMouseEvent *event) void QWidget::mouseDoubleClickEvent(QMouseEvent *event) { - mousePressEvent(event); // try mouse press event } #ifndef QT_NO_WHEELEVENT diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index a37de8547a..3d23b04ddf 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -905,16 +905,12 @@ void QWidgetPrivate::setModal_sys() } #ifndef QT_NO_CURSOR -static void applyCursor(QWidget *w, const QCursor &c) +static inline void applyCursor(QWidget *w, QCursor c) { - QCursor cc = c; - QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances(); - int cursorCount = cursors.count(); - for (int i = 0; i < cursorCount; ++i) { - const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i)); - if (cursor) - cursor.data()->changeCursor(&cc, w->window()->windowHandle()); - } + if (QWindow *window = w->windowHandle()) + if (const QScreen *screen = window->screen()) + if (QPlatformCursor *cursor = screen->handle()->cursor()) + cursor->changeCursor(&c, window); } void qt_qpa_set_cursor(QWidget *w, bool force) diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp index 465da1e2ba..7c8de05466 100644 --- a/src/widgets/statemachine/qguistatemachine.cpp +++ b/src/widgets/statemachine/qguistatemachine.cpp @@ -181,8 +181,6 @@ static QEvent *cloneEvent(QEvent *e) #endif case QEvent::InputMethod: return new QInputMethodEvent(*static_cast<QInputMethodEvent*>(e)); - case QEvent::AccessibilityPrepare: - return new QEvent(*e); case QEvent::LocaleChange: return new QEvent(*e); case QEvent::LanguageChange: diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index a07ab73ad0..5adb2f1c95 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2631,8 +2631,6 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list, QSize bottom_max = docks[QInternal::BottomDock].maximumSize(); bottom_hint = bottom_hint.boundedTo(bottom_max).expandedTo(bottom_min); - fallbackToSizeHints = false; - if (_ver_struct_list != 0) { QVector<QLayoutStruct> &ver_struct_list = *_ver_struct_list; ver_struct_list.resize(3); diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h index 17078f3709..10eb0da651 100644 --- a/src/widgets/widgets/qdockarealayout_p.h +++ b/src/widgets/widgets/qdockarealayout_p.h @@ -232,7 +232,7 @@ public: QDockAreaLayout(QMainWindow *win); QDockAreaLayoutInfo docks[4]; int sep; // separator extent - bool fallbackToSizeHints; //determines if we should use the sizehint for the dock areas (true until the layout is restored or the central widget is set) + bool fallbackToSizeHints; //determines if we should use the sizehint for the dock areas (true until the layout is restored or the separator is moved by user) mutable QVector<QWidget*> separatorWidgets; bool isValid() const; diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index c67881e652..ff05503540 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -1351,6 +1351,8 @@ bool QMainWindowLayout::startSeparatorMove(const QPoint &pos) if (movingSeparator.isEmpty()) return false; + layoutState.dockAreaLayout.fallbackToSizeHints = false; + savedState = layoutState; movingSeparatorPos = movingSeparatorOrigin = pos; diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index b42fedf0be..af75d6b8aa 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -2260,7 +2260,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags) d->updateGeometryConstraints(); setAttribute(Qt::WA_Resized, false); d->titleBarPalette = d->desktopPalette(); - d->font = QApplication::font("QWorkspaceTitleBar"); + d->font = QApplication::font("QMdiSubWindowTitleBar"); // We don't want the menu icon by default on mac. #ifndef Q_WS_MAC if (windowIcon().isNull()) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 3fb2a6122c..fd030a5383 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1075,7 +1075,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e if (action_e == QAction::Hover) { #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { - int actionIndex = indexOf(action) + 1; + int actionIndex = indexOf(action); QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex)); QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex)); } diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 11f6592cc9..0efa6caebc 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -531,7 +531,6 @@ void QMenuBarPrivate::_q_actionHovered() #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { int actionIndex = actions.indexOf(action); - ++actionIndex; QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex)); QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex)); } diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index ca94854d11..ce25a22847 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1183,8 +1183,8 @@ void QTabBar::setCurrentIndex(int index) d->layoutTab(index); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, index + 1)); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, index + 1)); + QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, index)); + QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, index)); } #endif emit currentChanged(index); |