diff options
author | Liang Qi <liang.qi@qt.io> | 2019-04-11 07:47:21 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-04-11 07:47:21 +0200 |
commit | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (patch) | |
tree | 7ca5d4ba83888bb5ad4d9b0141e5c62f8a5138f2 /src/widgets | |
parent | 235ac95520a0fc2c822dedce7358e3c64a764255 (diff) | |
parent | 63e88f60a769f2535945db0e1cabb9815ff45a77 (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
src/widgets/styles/qstyle_p.h
Change-Id: I0e6e856bd6628da1135b3ba674dddffabbeb5c09
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/itemviews/qtableview.cpp | 25 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 8 | ||||
-rw-r--r-- | src/widgets/styles/qstyle_p.h | 3 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 12 | ||||
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 30 | ||||
-rw-r--r-- | src/widgets/widgets/qmenu_p.h | 1 |
6 files changed, 31 insertions, 48 deletions
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index dd43c6d3e4..d4a6433c4d 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1581,29 +1581,6 @@ void QTableView::paintEvent(QPaintEvent *event) colp += columnWidth(col) - gridSize; painter.drawLine(colp, dirtyArea.top(), colp, dirtyArea.bottom()); } - - //draw the top & left grid lines if the headers are not visible. - //We do update this line when subsequent scroll happen (see scrollContentsBy) - if (horizontalHeader->isHidden() && top == 0) { - const int row = verticalHeader->logicalIndex(top); - if (!verticalHeader->isSectionHidden(row)) { - const int rowY = rowViewportPosition(row) + offset.y(); - if (rowY == dirtyArea.top()) - painter.drawLine(dirtyArea.left(), rowY, dirtyArea.right(), rowY); - } - } - if (verticalHeader->isHidden() && left == 0) { - const int col = horizontalHeader->logicalIndex(left); - if (!horizontalHeader->isSectionHidden(col)) { - int colX = columnViewportPosition(col) + offset.x(); - if (!isLeftToRight()) - colX += columnWidth(left) - 1; - if (isLeftToRight() && colX == dirtyArea.left()) - painter.drawLine(colX, dirtyArea.top(), colX, dirtyArea.bottom()); - if (!isLeftToRight() && colX == dirtyArea.right()) - painter.drawLine(colX, dirtyArea.top(), colX, dirtyArea.bottom()); - } - } painter.setPen(old); } } @@ -1878,7 +1855,7 @@ QModelIndex QTableView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifi visualColumn = d->nextActiveVisualColumn(visualRow, right, -1, QTableViewPrivate::SearchDirection::Decreasing); if (modifiers & Qt::ControlModifier) - visualRow = d->nextActiveVisualRow(bottom, current.column(), -1, + visualRow = d->nextActiveVisualRow(bottom, visualColumn, -1, QTableViewPrivate::SearchDirection::Decreasing); break; case MovePageUp: { diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 97ec1d3f19..ec5b6df6b3 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -46,6 +46,7 @@ #include "qstyleoption.h" #include "private/qstyle_p.h" #include "private/qguiapplication_p.h" +#include <qpa/qplatformtheme.h> #ifndef QT_NO_DEBUG #include "qdebug.h" #endif @@ -2447,6 +2448,13 @@ void QStyle::setProxy(QStyle *style) d->proxyStyle = style; } +//Windows and KDE allow menus to cover the taskbar, while GNOME and macOS don't +bool QStylePrivate::useFullScreenForPopup() +{ + auto theme = QGuiApplicationPrivate::platformTheme(); + return theme && theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool(); +} + QT_END_NAMESPACE #include "moc_qstyle.cpp" diff --git a/src/widgets/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h index d68bbfd03b..7942cafaf7 100644 --- a/src/widgets/styles/qstyle_p.h +++ b/src/widgets/styles/qstyle_p.h @@ -67,6 +67,9 @@ class QStylePrivate: public QObjectPrivate public: inline QStylePrivate() : layoutSpacingIndex(-1), proxyStyle(nullptr) {} + + static bool useFullScreenForPopup(); + mutable int layoutSpacingIndex; QStyle *proxyStyle; }; diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 932affde07..17090efb56 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -80,6 +80,7 @@ #if QT_CONFIG(effects) # include <private/qeffects_p.h> #endif +#include <private/qstyle_p.h> #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" #endif @@ -261,16 +262,11 @@ void QComboBoxPrivate::_q_modelDestroyed() model = QAbstractItemModelPrivate::staticEmptyModel(); } - -//Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QComboBoxPrivate::popupGeometry(int screen) const { - bool useFullScreenForPopupMenu = false; - if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) - useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool(); - return useFullScreenForPopupMenu ? - QDesktopWidgetPrivate::screenGeometry(screen) : - QDesktopWidgetPrivate::availableGeometry(screen); + return QStylePrivate::useFullScreenForPopup() + ? QDesktopWidgetPrivate::screenGeometry(screen) + : QDesktopWidgetPrivate::availableGeometry(screen); } bool QComboBoxPrivate::updateHoverControl(const QPoint &pos) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 7dc67c8efe..14964a696d 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -78,6 +78,7 @@ #include <private/qguiapplication_p.h> #include <qpa/qplatformtheme.h> #include <private/qdesktopwidget_p.h> +#include <private/qstyle_p.h> QT_BEGIN_NAMESPACE @@ -307,29 +308,26 @@ int QMenuPrivate::scrollerHeight() const return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q)); } -//Windows and KDE allow menus to cover the taskbar, while GNOME and Mac don't +// Windows and KDE allow menus to cover the taskbar, while GNOME and macOS +// don't. Torn-off menus are again different +inline bool QMenuPrivate::useFullScreenForPopup() const +{ + return !tornoff && QStylePrivate::useFullScreenForPopup(); +} + QRect QMenuPrivate::popupGeometry() const { Q_Q(const QMenu); - if (!tornoff && // Torn-off menus are different - QGuiApplicationPrivate::platformTheme() && - QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) { - return QDesktopWidgetPrivate::screenGeometry(q); - } else { - return QDesktopWidgetPrivate::availableGeometry(q); - } + return useFullScreenForPopup() + ? QDesktopWidgetPrivate::screenGeometry(q) + : QDesktopWidgetPrivate::availableGeometry(q); } -//Windows and KDE allow menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(int screen) const { - if (!tornoff && // Torn-off menus are different - QGuiApplicationPrivate::platformTheme() && - QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) { - return QDesktopWidgetPrivate::screenGeometry(screen); - } else { - return QDesktopWidgetPrivate::availableGeometry(screen); - } + return useFullScreenForPopup() + ? QDesktopWidgetPrivate::screenGeometry(screen) + : QDesktopWidgetPrivate::availableGeometry(screen); } QVector<QPointer<QWidget> > QMenuPrivate::calcCausedStack() const diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 0fd0f9219c..ef152cd71b 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -349,6 +349,7 @@ public: void updateActionRects(const QRect &screen) const; QRect popupGeometry() const; QRect popupGeometry(int screen) const; + bool useFullScreenForPopup() const; int getLastVisibleAction() const; //selection |