From 0e69230d02813f0b7a050645fb7e443bd504ab6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Martsum?= Date: Mon, 13 Jan 2014 14:29:16 +0100 Subject: Revert "QAIV - Fix scollbars with ScrollPerPixel to scroll 1 pixel." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 934f06220391eb0e0ebf66a2eb037f48adb4c43c. The patch needs to be modified a bit. Many users considers not having the old feature as a big regression. The feature needs to be improved with a variable that is only set when the user uses setSingleStep. Task-number: QTBUG-33906 Change-Id: I35e5d3e9d3d7a3ebd01807b03a0e7a424185d483 Reviewed-by: Thorbjørn Lindeijer Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qlistview.cpp | 8 ++++---- src/widgets/itemviews/qtableview.cpp | 4 ++-- src/widgets/itemviews/qtreeview.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 0cca52daa2..7f7c60b10e 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -1837,18 +1837,18 @@ void QCommonListViewBase::paintDragDrop(QPainter *painter) } #endif -void QCommonListViewBase::updateHorizontalScrollBar(const QSize & /*step*/) +void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) { + horizontalScrollBar()->setSingleStep(step.width() + spacing()); horizontalScrollBar()->setPageStep(viewport()->width()); horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width()); - // we do not want to overwrite (a possible user set) single step } -void QCommonListViewBase::updateVerticalScrollBar(const QSize & /*step*/) +void QCommonListViewBase::updateVerticalScrollBar(const QSize &step) { + verticalScrollBar()->setSingleStep(step.height() + spacing()); verticalScrollBar()->setPageStep(viewport()->height()); verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height()); - // we do not want to overwrite (a possible user set) single step } void QCommonListViewBase::scrollContentsBy(int dx, int dy, bool /*scrollElasticBand*/) diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 08600b3ef7..a252428a81 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -2170,7 +2170,7 @@ void QTableView::updateGeometries() } else { // ScrollPerPixel horizontalScrollBar()->setPageStep(vsize.width()); horizontalScrollBar()->setRange(0, horizontalLength - vsize.width()); - // here we do not want to overwrite (a possible user set) single step + horizontalScrollBar()->setSingleStep(qMax(vsize.width() / (columnsInViewport + 1), 2)); } // vertical scroll bar @@ -2198,7 +2198,7 @@ void QTableView::updateGeometries() } else { // ScrollPerPixel verticalScrollBar()->setPageStep(vsize.height()); verticalScrollBar()->setRange(0, verticalLength - vsize.height()); - // here we do not want to overwrite (a possible user set) single step + verticalScrollBar()->setSingleStep(qMax(vsize.height() / (rowsInViewport + 1), 2)); } d->geometryRecursionBlock = false; diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 4d0eb5c3ad..5d0e835b0e 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -3685,7 +3685,7 @@ void QTreeViewPrivate::updateScrollBars() } vbar->setRange(0, contentsHeight - viewportSize.height()); vbar->setPageStep(viewportSize.height()); - // here we do not want to overwrite (a possible user set) single step + vbar->setSingleStep(qMax(viewportSize.height() / (itemsInViewport + 1), 2)); } const int columnCount = header->count(); @@ -3711,7 +3711,7 @@ void QTreeViewPrivate::updateScrollBars() viewportSize = maxSize; hbar->setPageStep(viewportSize.width()); hbar->setRange(0, qMax(horizontalLength - viewportSize.width(), 0)); - // here we do not want to overwrite (a possible user set) single step + hbar->setSingleStep(qMax(viewportSize.width() / (columnsInViewport + 1), 2)); } } -- cgit v1.2.3 From 6eeab0b0e19818815dffb1ff603bc84aac3ffcb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 16 Dec 2013 23:15:38 +0100 Subject: Remove Mac unified toolbar workarounds. QMainWindow::unifiedTitleAndToolBarOnMac() will again return true, but the new implementation is much more similar to the cross platform one so these workarounds are not needed. Task-number: QTBUG-34411 Change-Id: I8f63067f929c94aab252fc2e88f98fb94c870c44 Reviewed-by: Gabriel de Dietrich --- src/widgets/widgets/qtoolbararealayout.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp index 04ef6a80be..5ec76569aa 100644 --- a/src/widgets/widgets/qtoolbararealayout.cpp +++ b/src/widgets/widgets/qtoolbararealayout.cpp @@ -655,9 +655,7 @@ QRect QToolBarAreaLayout::fitLayout() docks[QInternal::BottomDock].rect = QRect(rect.left(), center.bottom() + 1, rect.width(), bottom_hint.height()); - if (!mainWindow->unifiedTitleAndToolBarOnMac()) { - docks[QInternal::TopDock].fitLayout(); - } + docks[QInternal::TopDock].fitLayout(); docks[QInternal::LeftDock].fitLayout(); docks[QInternal::RightDock].fitLayout(); docks[QInternal::BottomDock].fitLayout(); @@ -1307,8 +1305,6 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList toolBars = _toolBars; int lines; stream >> lines; - if (!testing) - testing = mainWindow->unifiedTitleAndToolBarOnMac(); for (int j = 0; j < lines; ++j) { int pos; @@ -1319,7 +1315,7 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList> cnt; QToolBarAreaLayoutInfo &dock = docks[pos]; - const bool applyingLayout = !testing && !(pos == QInternal::TopDock && mainWindow->unifiedTitleAndToolBarOnMac()); + const bool applyingLayout = !testing; QToolBarAreaLayoutLine line(dock.o); for (int k = 0; k < cnt; ++k) { -- cgit v1.2.3 From 7edb5f22bf78cf2691145ab4160998c7b7f9416a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 16 Dec 2013 23:21:43 +0100 Subject: Implement QMainWindow::setUnifiedTitleAndToolBarOnMac Fix a feature regression from Qt 4. Unlike the Qt 4 implementation this does not move the tool bars out of the QMainWindow while pretending they are still there. Instead, use setContentBorderThickness from the Cocoa platform plugin to draw a background gradient that unifies the title and toolbar area. QToolBar can then draw itself with a transparent background and let the gradient shine throughout. This is a style-only change, toolbar behavior is kept as-is. [ChangeLog][Platform Specific Changes][OS X] Implemented QMainWindow::setUnifiedTitleAndToolBarOnMac. Task-number: QTBUG-34411 Change-Id: Idcaab6399f249b11edb1147856d9aece9923ab36 Reviewed-by: Gabriel de Dietrich --- src/widgets/widgets/qmainwindow.cpp | 43 ++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 0638981a9c..07db78c06c 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -60,6 +60,9 @@ #include #include "qtoolbar_p.h" #include "qwidgetanimator_p.h" +#ifdef Q_OS_OSX +#include +#endif #ifdef Q_WS_MAC #include #include @@ -76,6 +79,9 @@ class QMainWindowPrivate : public QWidgetPrivate public: inline QMainWindowPrivate() : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) +#ifdef Q_OS_OSX + , useUnifiedToolBar(false) +#endif #ifdef Q_WS_MAC , useHIToolBar(false) , activateUnifiedToolbarAfterFullScreen(false) @@ -88,6 +94,9 @@ public: QSize iconSize; bool explicitIconSize; Qt::ToolButtonStyle toolButtonStyle; +#ifdef Q_OS_OSX + bool useUnifiedToolBar; +#endif #ifdef Q_WS_MAC bool useHIToolBar; bool activateUnifiedToolbarAfterFullScreen; @@ -1492,16 +1501,29 @@ bool QMainWindow::event(QEvent *event) /*! \property QMainWindow::unifiedTitleAndToolBarOnMac \brief whether the window uses the unified title and toolbar look on Mac OS X - \since 4.3 - \obsolete - - This property is not implemented in Qt 5. Setting it has no effect. - - A replacement API (QtMacUnifiedToolBar) is available in QtMacExtras at - http://qt.gitorious.org/qtplayground/qtmacextras + \since 5.2 */ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) { +#ifdef Q_OS_OSX + Q_D(QMainWindow); + if (isWindow()) { + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + QPlatformNativeInterface::NativeResourceForIntegrationFunction function = + nativeInterface->nativeResourceFunctionForIntegration("setContentBorderThickness"); + if (!function) + return; // Not Cocoa platform plugin. + + createWinId(); + + d->useUnifiedToolBar = set; + + const int toolBarHeight = 50; + typedef void (*SetContentBorderThicknessFunction)(QWindow *window, int topThickness, int bottomThickness); + (reinterpret_cast(function))(window()->windowHandle(), toolBarHeight, 0); + } +#endif + #ifdef Q_WS_MAC Q_D(QMainWindow); if (!isWindow() || d->useHIToolBar == set || QSysInfo::MacintoshVersion < QSysInfo::MV_10_3) @@ -1534,6 +1556,9 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) bool QMainWindow::unifiedTitleAndToolBarOnMac() const { +#ifdef Q_OS_OSX + return d_func()->useUnifiedToolBar; +#endif #ifdef Q_WS_MAC return d_func()->useHIToolBar && !testAttribute(Qt::WA_MacBrushedMetal) && !(windowFlags() & Qt::FramelessWindowHint); #endif @@ -1655,9 +1680,7 @@ QMenu *QMainWindow::createPopupMenu() for (int i = 0; i < toolbars.size(); ++i) { QToolBar *toolBar = toolbars.at(i); if (toolBar->parentWidget() == this - && (!d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty() - || (unifiedTitleAndToolBarOnMac() - && toolBarArea(toolBar) == Qt::TopToolBarArea))) { + && (!d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty())) { menu->addAction(toolbars.at(i)->toggleViewAction()); } } -- cgit v1.2.3 From e4b94dd19cccd769f8326df20556a8900e7cfb3f Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 7 Jan 2014 18:05:02 +0100 Subject: Fix a possible crash in StyleSheetStyle Task-number: QTBUG-35901 Change-Id: I72e82a166d30cf5e4dac2917c633c7cbd355c817 Reviewed-by: J-P Nurmi Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qstylesheetstyle.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 2f36e0e53c..6bd0ba37c8 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4710,7 +4710,9 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const break; case PM_TabBarBaseOverlap: { - const QWidget *tabWidget = qobject_cast(w) ? w : w->parentWidget(); + const QWidget *tabWidget = qobject_cast(w); + if (!tabWidget && w) + tabWidget = w->parentWidget(); if (hasStyleRule(tabWidget, PseudoElement_TabWidgetPane)) { return 0; } -- cgit v1.2.3 From cf2b0b017b5a8d2c27ae0700e8e7fd5818e5d469 Mon Sep 17 00:00:00 2001 From: Martin Klapetek Date: Fri, 13 Dec 2013 16:24:01 +0100 Subject: Don't skip content drawing for QtQuickControls SpinBox If XPThemeData::noContent is set to true, the SpinBox from QtQuickControls renders with transparent background, which is being workarounded by simply adding white rectangle inside the QQC SpinBox, which in turn breaks other themes. This works in normal widget's QStyle because the spinbox there is drawn with a frameless QLineEdit, which fills the background. Setting XPThemeData::noContent to false for QtQuick items only makes the QQC SpinBox render correctly with Windows Vista style. Change-Id: I3229a2582dd1cad95c77e0961aaef502a8c6159a Reviewed-by: J-P Nurmi --- src/widgets/styles/qwindowsvistastyle.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 2f36944b5e..af379b756e 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1879,7 +1879,11 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle XPThemeData ftheme(widget, painter, QWindowsXPStylePrivate::EditTheme, partId, stateId, r); - ftheme.noContent = true; + // The spinbox in Windows QStyle is drawn with frameless QLineEdit inside it + // That however breaks with QtQuickControls where this results in transparent + // spinbox background, so if there's no "widget" passed (QtQuickControls case), + // let ftheme.noContent be false, which fixes the spinbox rendering in QQC + ftheme.noContent = (widget != NULL); d->drawBackground(ftheme); } if (sub & SC_SpinBoxUp) { -- cgit v1.2.3 From 3fadd88f30d7308500b7d6012c45346e9c6f47d0 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 21 Jan 2014 12:59:10 +0100 Subject: Mac Style: Fix non-native menubar item spacing Unfortunate consequence from inheriting from Common style instead of Windows style. Also, a font entry missing in QCocoaTheme. Task-number: QTBUG-36224 Change-Id: I560494b1727734671478f70ee1ba800d21c916ca Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qmacstyle_mac.mm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index d13339b555..fa49bcb884 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2077,6 +2077,10 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = 0; break; + case PM_MenuBarPanelWidth: + ret = 0; + break; + case QStyle::PM_MenuDesktopFrameWidth: ret = 5; break; @@ -6259,6 +6263,10 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QSize(w, h); } break; + case CT_MenuBarItem: + if (!sz.isEmpty()) + sz += QSize(12, 4); // Constants from QWindowsStyle + break; case CT_ToolButton: sz.rwidth() += 10; sz.rheight() += 10; -- cgit v1.2.3 From 97fd5399bca4f10393884cfd3bb20c29fb5361b4 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 12 Dec 2013 13:47:44 +0100 Subject: QPlainTextEdit: set Qt::ImhMultiLine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Like QTextEdit, QPlainTextEdit should also set the input method hint Qt::ImhMultiLine. An important reason for this, is that the iOS plugin will inspect the input method hints of the focus object to decide which type of keyboard (and return key) to use. Failing to set this hint will result in the iOS plugin setting the return key to 'done' instead of 'return' for this widget. Change-Id: Idd5aaf21505add608f2621f94655984f42e92a18 Reviewed-by: Tor Arne Vestbø --- src/widgets/widgets/qplaintextedit.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 90f2e47cd3..5f055d436a 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -801,6 +801,7 @@ void QPlainTextEditPrivate::init(const QString &txt) q->setFocusPolicy(Qt::WheelFocus); q->setAttribute(Qt::WA_KeyCompression); q->setAttribute(Qt::WA_InputMethodEnabled); + q->setInputMethodHints(Qt::ImhMultiLine); #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); -- cgit v1.2.3 From fed63d43943d8324a6f7faa6cab006ee8545e116 Mon Sep 17 00:00:00 2001 From: Bastiaan Veelo Date: Fri, 31 Jan 2014 00:36:22 +0100 Subject: Documentation: a singular subject takes a singular verb. Change-Id: I75762cd0f2c25eeeeb1283800c21393637bdff56 Reviewed-by: Giuseppe D'Angelo --- src/widgets/itemviews/qtreeview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 5d0e835b0e..43c1ea9cae 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1586,7 +1586,7 @@ int QTreeViewPrivate::widthHintForIndex(const QModelIndex &index, int hint, cons /*! Draws the row in the tree view that contains the model item \a index, - using the \a painter given. The \a option control how the item is + using the \a painter given. The \a option controls how the item is displayed. \sa setAlternatingRowColors() -- cgit v1.2.3 From 8cf666e10cec48146632c93b55b3dc1e6313a410 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 22 Jan 2014 23:33:32 +0100 Subject: Build on Windows Embedded when -qtlibinfix is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The resource file that needs to be included is hardcoded whereas qmake generates one that is based on the target name (which includes the libinfix). So to ensure the right one is available, a copy of the generated rc file is done to the name it expects. [ChangeLog][Platform Specific Changes][Windows Embedded] Fixed building issue when configuring Qt with -qtlibinfix Change-Id: I46ddbc5d22424bf63c54423618385e4268790eeb Reviewed-by: Björn Breitmeyer --- src/widgets/widgets.pro | 1 + src/widgets/widgets/widgets.pri | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index e3222b49e8..0b289c75ae 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -1,4 +1,5 @@ TARGET = QtWidgets +wince*:ORIG_TARGET = $$TARGET QT = core-private gui-private MODULE_CONFIG = uic diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 1bae87ebcc..a924ba9acc 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -160,4 +160,13 @@ wince*: { HEADERS += widgets/qmenu_wince_resource_p.h RC_FILE = widgets/qmenu_wince.rc !static: QMAKE_WRITE_DEFAULT_RC = 1 + !isEmpty(QT_LIBINFIX) { + ORIG_RCFILE = $${TARGET}_resource.rc + copyrcc.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} + copyrcc.input = ORIG_RCFILE + CONFIG(debug, debug|release):copyrcc.output = $${ORIG_TARGET}d_resource.rc + else:copyrcc.output = $${ORIG_TARGET}_resource.rc + copyrcc.CONFIG = target_predeps no_link + QMAKE_EXTRA_COMPILERS += copyrcc + } } -- cgit v1.2.3 From 0b26ad05bbadeef493317c994cc7ccb53b0a612c Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 23 Jan 2014 16:10:26 +0100 Subject: Doc: corrected link/example errors Update pro files after move gestures folder Update snippet statements Corrected path in imagegestures.pro Task-number: QTBUG-34749 Change-Id: Icc19908914e36507e412ab63bf0cc2809aa48e17 Reviewed-by: Jerome Pasion --- src/widgets/doc/qtwidgets.qdocconf | 2 +- src/widgets/doc/src/gestures.qdoc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf index b742856892..508a257fa5 100644 --- a/src/widgets/doc/qtwidgets.qdocconf +++ b/src/widgets/doc/qtwidgets.qdocconf @@ -27,7 +27,7 @@ qhp.QtWidgets.subprojects.classes.sortPages = true tagfile = ../../../doc/qtwidgets/qtwidgets.tags -depends += qtcore qtgui qtdoc qtsql qtdesigner +depends += qtcore qtgui qtdoc qtsql qtdesigner qtquick headerdirs += .. diff --git a/src/widgets/doc/src/gestures.qdoc b/src/widgets/doc/src/gestures.qdoc index ed7e78ec5a..9126152c42 100644 --- a/src/widgets/doc/src/gestures.qdoc +++ b/src/widgets/doc/src/gestures.qdoc @@ -67,7 +67,7 @@ required gesture type. The standard types are defined by the Qt::GestureType enum and include many commonly used gestures. - \snippet ../../../examples/gestures/imagegestures/imagewidget.cpp enable gestures + \snippet gestures/imagegestures/imagewidget.cpp enable gestures In the above code, the gestures are set up in the constructor of the target object itself. @@ -124,18 +124,18 @@ \l{QWidget::}{event()} handler function and delegates gesture events to a specialized gestureEvent() function: - \snippet ../../../examples/gestures/imagegestures/imagewidget.cpp event handler + \snippet gestures/imagegestures/imagewidget.cpp event handler The gesture events delivered to the target object can be examined individually and dealt with appropriately: - \snippet ../../../examples/gestures/imagegestures/imagewidget.cpp gesture event handler + \snippet gestures/imagegestures/imagewidget.cpp gesture event handler Responding to a gesture is simply a matter of obtaining the QGesture object delivered in the QGestureEvent sent to the target object and examining the information it contains. - \snippet ../../../examples/gestures/imagegestures/imagewidget.cpp swipe function + \snippet gestures/imagegestures/imagewidget.cpp swipe function Here, we examine the direction in which the user swiped the widget and modify its contents accordingly. -- cgit v1.2.3 From cfa8fcdda0e4b453b8a808946735714cfca2bfef Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 29 Jan 2014 18:52:19 +0100 Subject: Ensure the text is not cut off when shown under a toolbutton icon Change-Id: I82cfa549b9db9439ab03123ddf73e5f2d001738e Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qcommonstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 2d7107598f..9c2163ac8f 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1598,7 +1598,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { pr.setHeight(pmSize.height() + 6); - tr.adjust(0, pr.height() - 1, 0, -2); + tr.adjust(0, pr.height() - 1, 0, -1); pr.translate(shiftX, shiftY); if (!hasArrow) { proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm); -- cgit v1.2.3 From 72259baa76a0f1faa1983c720621676e9c15e15f Mon Sep 17 00:00:00 2001 From: Alex Montgomery Date: Tue, 14 Jan 2014 13:53:10 -0800 Subject: Fixed duplicate QMoveEvent generated for each QWidget::move call Removed QMoveEvent generating code from QWidgetPrivate::setGeometry_sys for widgets with native window handles. A move event is already generated for them by QGuiApplicationPrivate::processGeometryChangeEvent. Task-number: QTBUG-32590 Change-Id: I73313a012851516047ac017f1e15a21774d8ffe2 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidget_qpa.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 0fd794cc02..ea6f27caf9 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -768,7 +768,10 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) } } - if (isMove) { + // generate a move event for QWidgets without window handles. QWidgets with native + // window handles already receive a move event from + // QGuiApplicationPrivate::processGeometryChangeEvent. + if (isMove && (!q->windowHandle() || q->testAttribute(Qt::WA_DontShowOnScreen))) { QMoveEvent e(q->pos(), oldPos); QApplication::sendEvent(q, &e); } -- cgit v1.2.3 From 8bb5dba0cba4d953794124d7f1b33887d1b5bd8d Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sat, 1 Feb 2014 23:30:08 +0800 Subject: Doc: Fix broken links Change-Id: Ic275dfbf0b332fc34ea0fac1c31c4935ad961527 Reviewed-by: Frederik Gladhorn --- src/widgets/kernel/qaction.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 2 +- src/widgets/widgets/qmenubar.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 3e76699aca..c0e3e98ae1 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -270,7 +270,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) \value AboutQtRole This action matches handles the "About Qt" menu item. \value AboutRole This action should be placed where the "About" menu item is in the application menu. The text of the menu item will be set to "About ". The application name is fetched from the - \c{Info.plist} file in the application's bundle (See \l{Deploying an Application on Mac OS X}). + \c{Info.plist} file in the application's bundle (See \l{Qt for Mac OS X - Deployment}). \value PreferencesRole This action should be placed where the "Preferences..." menu item is in the application menu. \value QuitRole This action should be placed where the Quit menu item is in the application menu. diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index df523e7e21..ee7f779a3a 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7004,7 +7004,7 @@ void QWidget::setUpdatesEnabled(bool enable) depending on the platform's default behavior for the window flags. \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(), - showNormal(), isVisible(), windowFlags(), flags() + showNormal(), isVisible(), windowFlags() */ void QWidget::show() { diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 9c1e2f0516..01db2bda7a 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -666,8 +666,8 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti \b{Note:} The text used for the application name in the menu bar is obtained from the value set in the \c{Info.plist} file in - the application's bundle. See \l{Deploying an Application on - Mac OS X} for more information. + the application's bundle. See \l{Qt for Mac OS X - Deployment} + for more information. \section1 QMenuBar on Windows CE -- cgit v1.2.3 From 760ad40700ee5c6db969c376e053f9c4806e90a6 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 4 Feb 2014 15:47:48 +0100 Subject: Make QWindowContainer accessible Change-Id: I93451b8842648db0815c96d64d319daecb45f0de Reviewed-by: Gunnar Sletta --- src/widgets/kernel/qwindowcontainer.cpp | 6 +++++- src/widgets/kernel/qwindowcontainer_p.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 399f089e0f..a4b3caf78d 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -200,7 +200,11 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt: connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow *)), this, SLOT(focusWindowChanged(QWindow *))); } - +QWindow *QWindowContainer::containedWindow() const +{ + Q_D(const QWindowContainer); + return d->window; +} /*! \internal diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h index a21f9bd35a..014b163f97 100644 --- a/src/widgets/kernel/qwindowcontainer_p.h +++ b/src/widgets/kernel/qwindowcontainer_p.h @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE class QWindowContainerPrivate; -class QWindowContainer : public QWidget +class Q_WIDGETS_EXPORT QWindowContainer : public QWidget { Q_OBJECT Q_DECLARE_PRIVATE(QWindowContainer) @@ -56,6 +56,7 @@ class QWindowContainer : public QWidget public: explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = 0, Qt::WindowFlags f = 0); ~QWindowContainer(); + QWindow *containedWindow() const; static void toplevelAboutToBeDestroyed(QWidget *parent); static void parentWasChanged(QWidget *parent); -- cgit v1.2.3 From f0d135a6bea08bcfa1e56303d0ee9694c5bc1633 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sat, 1 Feb 2014 12:21:37 +0100 Subject: Doc: fix documentation for QWidget::windowHandle. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not "preliminary" anymore, and it doesn't return a QPlatformWindow, but a QWindow. Change-Id: Iaa1938728e689d97011dce8cf0d88ff8cb4a83b9 Reviewed-by: Friedemann Kleint Reviewed-by: Topi Reiniö --- src/widgets/kernel/qwidget_qpa.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index ea6f27caf9..0a4bc990e6 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -879,9 +879,15 @@ int QWidget::metric(PaintDeviceMetric m) const } /*! - \preliminary + If this is a native widget, return the associated QWindow. + Otherwise return null. - Returns the QPlatformWindow this widget will be drawn into. + Native widgets include toplevel widgets, QGLWidget, and child widgets + on which winId() was called. + + \since 5.0 + + \sa winId() */ QWindow *QWidget::windowHandle() const { -- cgit v1.2.3 From 65bd80ebfc1be81a196a861ade40ff874a3554f0 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 4 Feb 2014 14:47:39 +0100 Subject: QTabWidget: fix moving of the current tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-36455 Change-Id: I38687283d60fe38a4b586b064d5ddd4ed3be06b6 Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: Ivan Komissarov --- src/widgets/widgets/qtabbar.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index dfd1f1022c..b47d65f561 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1681,6 +1681,7 @@ void QTabBar::moveTab(int from, int to) d->tabList[i].lastTab = d->calculateNewPosition(from, to, d->tabList[i].lastTab); // update external variables + int previousIndex = d->currentIndex; d->currentIndex = d->calculateNewPosition(from, to, d->currentIndex); // If we are in the middle of a drag update the dragStartPosition @@ -1699,6 +1700,8 @@ void QTabBar::moveTab(int from, int to) d->layoutWidgets(start); update(); emit tabMoved(from, to); + if (previousIndex != d->currentIndex) + emit currentChanged(d->currentIndex); emit tabLayoutChange(); } -- cgit v1.2.3