summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/Qt5WidgetsConfigExtras.cmake.in31
-rw-r--r--src/widgets/accessible/itemviews.cpp6
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp2
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp28
-rw-r--r--src/widgets/dialogs/qinputdialog.h18
-rw-r--r--src/widgets/dialogs/qwizard.cpp4
-rw-r--r--src/widgets/dialogs/qwizard.h2
-rw-r--r--src/widgets/doc/snippets/graphicsview.cpp6
-rw-r--r--src/widgets/doc/src/graphicsview.qdoc6
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp8
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp16
-rw-r--r--src/widgets/itemviews/qtableview.cpp22
-rw-r--r--src/widgets/itemviews/qtreeview.cpp3
-rw-r--r--src/widgets/kernel/qapplication.cpp2
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp6
-rw-r--r--src/widgets/kernel/qtooltip.cpp8
-rw-r--r--src/widgets/kernel/qwidget.cpp5
-rw-r--r--src/widgets/kernel/qwidget_p.h1
-rw-r--r--src/widgets/kernel/qwidgetrepaintmanager.cpp25
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp22
-rw-r--r--src/widgets/styles/qfusionstyle.cpp6
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp4
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp32
-rw-r--r--src/widgets/widgets/qcombobox.h4
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h14
-rw-r--r--src/widgets/widgets/qlineedit.cpp20
-rw-r--r--src/widgets/widgets/qmainwindow.cpp10
-rw-r--r--src/widgets/widgets/qmenu.cpp6
-rw-r--r--src/widgets/widgets/qmenu.h2
-rw-r--r--src/widgets/widgets/qmenu_p.h2
-rw-r--r--src/widgets/widgets/qtabbar.cpp4
-rw-r--r--src/widgets/widgets/qtoolbar.cpp12
-rw-r--r--src/widgets/widgets/qtoolbar_p.h4
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp4
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp1
38 files changed, 194 insertions, 158 deletions
diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
new file mode 100644
index 0000000000..83d8004a08
--- /dev/null
+++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
@@ -0,0 +1,31 @@
+
+if (NOT TARGET Qt5::uic)
+ add_executable(Qt5::uic IMPORTED)
+
+!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+ set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+!!ELSE
+ set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+!!ENDIF
+ _qt5_Widgets_check_file_exists(${imported_location})
+
+ set_target_properties(Qt5::uic PROPERTIES
+ IMPORTED_LOCATION ${imported_location}
+ )
+endif()
+
+if (QT5_STRICT_PLUGIN_GLOB OR Qt5$${CMAKE_MODULE_NAME}_STRICT_PLUGIN_GLOB)
+ include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5Widgets_AccessibleFactory.cmake\" OPTIONAL)
+endif()
+set(Qt5Widgets_UIC_EXECUTABLE Qt5::uic)
+
+# Create versionless tool targets.
+foreach(__qt_tool uic)
+ if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::${__qt_tool}
+ AND TARGET Qt5::${__qt_tool})
+ add_executable(Qt::${__qt_tool} IMPORTED)
+ get_target_property(__qt_imported_location Qt5::${__qt_tool} IMPORTED_LOCATION)
+ set_target_properties(Qt::${__qt_tool}
+ PROPERTIES IMPORTED_LOCATION \"${__qt_imported_location}\")
+ endif()
+endforeach()
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp
index 5a7fdf9a03..677e56806a 100644
--- a/src/widgets/accessible/itemviews.cpp
+++ b/src/widgets/accessible/itemviews.cpp
@@ -1035,10 +1035,14 @@ QAccessible::State QAccessibleTableCell::state() const
st.selected = true;
if (view->selectionModel()->currentIndex() == m_index)
st.focused = true;
- if (m_index.model()->data(m_index, Qt::CheckStateRole).toInt() == Qt::Checked)
+
+ QVariant checkState = m_index.model()->data(m_index, Qt::CheckStateRole);
+ if (checkState.toInt() == Qt::Checked)
st.checked = true;
Qt::ItemFlags flags = m_index.flags();
+ if ((flags & Qt::ItemIsUserCheckable) && checkState.isValid())
+ st.checkable = true;
if (flags & Qt::ItemIsSelectable) {
st.selectable = true;
st.focusable = true;
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 658d7b562b..a319361ad8 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -1049,7 +1049,7 @@ static inline bool isCaseSensitiveFileSystem(const QString &path)
// Return case insensitive unconditionally, even if someone has a case sensitive
// file system mounted, wrongly capitalized drive letters will cause mismatches.
return false;
-#elif defined(Q_OS_OSX)
+#elif defined(Q_OS_MACOS)
return pathconf(QFile::encodeName(path).constData(), _PC_CASE_SENSITIVE);
#else
return true;
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index 479e45ff56..836d3bc1de 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -1349,32 +1349,7 @@ int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &l
\sa getText(), getDouble(), getItem(), getMultiLineText()
*/
-#if QT_DEPRECATED_SINCE(5, 15)
-/*!
- Static convenience function to get a floating point number from the user.
-
- \a title is the text which is displayed in the title bar of the dialog.
- \a label is the text which is shown to the user (it should say what should
- be entered).
- \a value is the default floating point number that the line edit will be
- set to.
- \a min and \a max are the minimum and maximum values the user may choose.
- \a decimals is the maximum number of decimal places the number may have.
-
- If \a ok is nonnull, *\a ok will be set to true if the user pressed \uicontrol OK
- and to false if the user pressed \uicontrol Cancel. The dialog's parent is
- \a parent. The dialog will be modal and uses the widget \a flags.
-
- This function returns the floating point number which has been entered by
- the user.
-
- Use this static function like this:
-
- \snippet dialogs/standarddialogs/dialog.cpp 1
-
- \sa getText(), getInt(), getItem(), getMultiLineText()
-*/
-
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC)
double QInputDialog::getDouble(QWidget *parent, const QString &title, const QString &label,
double value, double min, double max, int decimals, bool *ok,
Qt::WindowFlags flags)
@@ -1383,7 +1358,6 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
}
#endif
/*!
- \overload
Static convenience function to get a floating point number from the user.
\a title is the text which is displayed in the title bar of the dialog.
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 6e2d6eebf3..a8696cb562 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -177,21 +177,19 @@ public:
int minValue = -2147483647, int maxValue = 2147483647,
int step = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_X("This overload is deprecated. Use the overload that takes step as a final argument")
- static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0,
- double minValue = -2147483647, double maxValue = 2147483647,
- int decimals = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
-#endif
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) || defined(Q_QDOC)
static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0,
double minValue = -2147483647, double maxValue = 2147483647,
int decimals = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags(),
double step = 1);
#else
- static double getDouble(QWidget *parent, const QString &title, const QString &label, double value,
- double minValue, double maxValue, int decimals, bool *ok, Qt::WindowFlags flags,
- double step);
+ static double getDouble(QWidget *parent, const QString &title, const QString &label,
+ double value = 0, double minValue = -2147483647,
+ double maxValue = 2147483647, int decimals = 1, bool *ok = nullptr,
+ Qt::WindowFlags flags = Qt::WindowFlags());
+ static double getDouble(QWidget *parent, const QString &title, const QString &label,
+ double value, double minValue, double maxValue, int decimals, bool *ok,
+ Qt::WindowFlags flags, double step);
#endif
#if QT_DEPRECATED_SINCE(5, 0)
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index b0f4312f40..17ea634efb 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -2377,11 +2377,11 @@ bool QWizard::hasVisitedPage(int theid) const
}
/*!
+ \since 5.15
+
Returns the list of IDs of visited pages, in the order in which the pages
were visited.
- Pressing \uicontrol Back marks the current page as "unvisited" again.
-
\sa hasVisitedPage()
*/
QList<int> QWizard::visitedIds() const
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index dc29c80f51..13b584035c 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -129,7 +129,7 @@ public:
QWizardPage *page(int id) const;
bool hasVisitedPage(int id) const;
#if QT_DEPRECATED_SINCE(5, 15)
- Q_DECL_DEPRECATED_X("Use visitedIds() instead") QList<int> visitedPages() const;
+ QT_DEPRECATED_VERSION_X_5_15("Use visitedIds() instead") QList<int> visitedPages() const;
#endif
QList<int> visitedIds() const;
QList<int> pageIds() const;
diff --git a/src/widgets/doc/snippets/graphicsview.cpp b/src/widgets/doc/snippets/graphicsview.cpp
index 371cff24a4..9578f91eec 100644
--- a/src/widgets/doc/snippets/graphicsview.cpp
+++ b/src/widgets/doc/snippets/graphicsview.cpp
@@ -123,5 +123,9 @@ void CustomItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
//! [6]
QGraphicsView view(&scene);
-view.setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
+QOpenGLWidget *gl = new QOpenGLWidget();
+QSurfaceFormat format;
+format.setSamples(4);
+gl->setFormat(format);
+view.setViewport(gl);
//! [6]
diff --git a/src/widgets/doc/src/graphicsview.qdoc b/src/widgets/doc/src/graphicsview.qdoc
index f1f848d6df..0489203e40 100644
--- a/src/widgets/doc/src/graphicsview.qdoc
+++ b/src/widgets/doc/src/graphicsview.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -438,8 +438,8 @@
To enable OpenGL rendering, you simply set a new QOpenGLWidget as the
viewport of QGraphicsView by calling QGraphicsView::setViewport(). If
- you want OpenGL with antialiasing, you need OpenGL sample buffer
- support (see QSurfaceFormat::samples()).
+ you want OpenGL with antialiasing, you need to set a QSurfaceFormat
+ with the needed sample count (see QSurfaceFormat::setSamples()).
Example:
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index fe3475e6bb..45720802d3 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -581,7 +581,7 @@ QGraphicsProxyWidget::~QGraphicsProxyWidget()
Note that widgets with the Qt::WA_PaintOnScreen widget attribute
set and widgets that wrap an external application or controller
- cannot be embedded. Examples are QGLWidget and QAxWidget.
+ cannot be embedded. Examples are QOpenGLWidget and QAxWidget.
\sa widget()
*/
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index b669b0fe61..38c68b8fa5 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -2904,7 +2904,7 @@ QGraphicsSimpleTextItem *QGraphicsScene::addSimpleText(const QString &text, cons
Note that widgets with the Qt::WA_PaintOnScreen widget attribute
set and widgets that wrap an external application or controller
- are not supported. Examples are QGLWidget and QAxWidget.
+ are not supported. Examples are QOpenGLWidget and QAxWidget.
\sa addEllipse(), addLine(), addPixmap(), addPixmap(), addRect(),
addText(), addSimpleText(), addItem()
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 1117f5e473..5e345e010a 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -89,8 +89,8 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
By default, QGraphicsView provides a regular QWidget for the viewport
widget. You can access this widget by calling viewport(), or you can
replace it by calling setViewport(). To render using OpenGL, simply call
- setViewport(new QGLWidget). QGraphicsView takes ownership of the viewport
- widget.
+ setViewport(new QOpenGLWidget). QGraphicsView takes ownership of the
+ viewport widget.
QGraphicsView supports affine transformations, using QTransform. You can
either pass a matrix to setTransform(), or you can call one of the
@@ -159,8 +159,8 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
fastest when QGraphicsView spends more time figuring out what to draw than
it would spend drawing (e.g., when very many small items are repeatedly
updated). This is the preferred update mode for viewports that do not
- support partial updates, such as QGLWidget, and for viewports that need to
- disable scroll optimization.
+ support partial updates, such as QOpenGLWidget, and for viewports that
+ need to disable scroll optimization.
\value MinimalViewportUpdate QGraphicsView will determine the minimal
viewport region that requires a redraw, minimizing the time spent drawing
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index b8c30321ff..300795d3bf 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1844,10 +1844,16 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
|| edit(index, NoEditTriggers, event))
return;
- if (d->selectionMode != SingleSelection)
- topLeft = d->pressedPosition - d->offset();
- else
+ if (d->selectionMode != SingleSelection) {
+ // Use the current selection start index if it is valid as this will be based on the
+ // start of the selection and not the last item being pressed which can be different
+ // when in extended selection
+ topLeft = d->currentSelectionStartIndex.isValid()
+ ? visualRect(d->currentSelectionStartIndex).center()
+ : d->pressedPosition - d->offset();
+ } else {
topLeft = bottomRight;
+ }
d->checkMouseMove(index);
@@ -2455,7 +2461,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
}
#endif
break;
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
case Qt::Key_Enter:
case Qt::Key_Return:
// Propagate the enter if you couldn't edit the item and there are no
@@ -2487,7 +2493,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
break;
}
#endif
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) {
emit activated(currentIndex());
break;
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index f420857b08..6289974345 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -2985,14 +2985,17 @@ void QTableView::timerEvent(QTimerEvent *event)
Q_D(QTableView);
if (event->timerId() == d->columnResizeTimerID) {
- updateGeometries();
- killTimer(d->columnResizeTimerID);
- d->columnResizeTimerID = 0;
+ const int oldScrollMax = horizontalScrollBar()->maximum();
+ if (horizontalHeader()->d_func()->state != QHeaderViewPrivate::ResizeSection) {
+ updateGeometries();
+ killTimer(d->columnResizeTimerID);
+ d->columnResizeTimerID = 0;
+ }
QRect rect;
int viewportHeight = d->viewport->height();
int viewportWidth = d->viewport->width();
- if (d->hasSpans()) {
+ if (d->hasSpans() || horizontalScrollBar()->value() == oldScrollMax) {
rect = QRect(0, 0, viewportWidth, viewportHeight);
} else {
for (int i = d->columnsToUpdate.size()-1; i >= 0; --i) {
@@ -3010,14 +3013,17 @@ void QTableView::timerEvent(QTimerEvent *event)
}
if (event->timerId() == d->rowResizeTimerID) {
- updateGeometries();
- killTimer(d->rowResizeTimerID);
- d->rowResizeTimerID = 0;
+ const int oldScrollMax = verticalScrollBar()->maximum();
+ if (verticalHeader()->d_func()->state != QHeaderViewPrivate::ResizeSection) {
+ updateGeometries();
+ killTimer(d->rowResizeTimerID);
+ d->rowResizeTimerID = 0;
+ }
int viewportHeight = d->viewport->height();
int viewportWidth = d->viewport->width();
int top;
- if (d->hasSpans()) {
+ if (d->hasSpans() || verticalScrollBar()->value() == oldScrollMax) {
top = 0;
} else {
top = viewportHeight;
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index a3bebb8f3c..da0e1188f2 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -3773,7 +3773,8 @@ int QTreeViewPrivate::itemDecorationAt(const QPoint &pos) const
bool spanned = false;
if (!spanningIndexes.isEmpty()) {
const QModelIndex index = q->indexAt(pos);
- spanned = q->isFirstColumnSpanned(index.row(), index.parent());
+ if (index.isValid())
+ spanned = q->isFirstColumnSpanned(index.row(), index.parent());
}
const int column = spanned ? 0 : header->logicalIndexAt(pos.x());
if (!isTreePosition(column))
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index de12347b89..6e5fe0d1cf 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -4294,7 +4294,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
QWidget *targetWidget = static_cast<QWidget *>(target.data());
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
// Single-touch events are normally not sent unless WA_TouchPadAcceptSingleTouchEvents is set.
// In Qt 4 this check was in OS X-only code. That behavior is preserved here by the #ifdef.
if (touchPoints.count() == 1
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index 541519245e..134cebca09 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -51,7 +51,7 @@
#include "qgesture.h"
#include "qevent.h"
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
#include "qmacgesturerecognizer_p.h"
#endif
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcGestureManager, "qt.widgets.gestures")
-#if !defined(Q_OS_OSX)
+#if !defined(Q_OS_MACOS)
static inline int panTouchPoints()
{
// Override by environment variable for testing.
@@ -89,7 +89,7 @@ QGestureManager::QGestureManager(QObject *parent)
{
qRegisterMetaType<Qt::GestureState>();
-#if defined(Q_OS_OSX)
+#if defined(Q_OS_MACOS)
registerGestureRecognizer(new QMacSwipeGestureRecognizer);
registerGestureRecognizer(new QMacPinchGestureRecognizer);
registerGestureRecognizer(new QMacPanGestureRecognizer);
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 33dd3e59b6..661568dcad 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -402,10 +402,10 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w)
#endif //QT_NO_STYLE_STYLESHEET
QPoint p = pos;
- int screenNumber = getTipScreen(pos, w);
- QScreen *screen = QGuiApplication::screens().at(screenNumber);
- if (screen) {
- const QPlatformScreen *platformScreen = screen->handle();
+ const QScreen *screen = QGuiApplication::screens().value(getTipScreen(pos, w),
+ QGuiApplication::primaryScreen());
+ // a QScreen's handle *should* never be null, so this is a bit paranoid
+ if (const QPlatformScreen *platformScreen = screen ? screen->handle() : nullptr) {
const QSize cursorSize = QHighDpi::fromNativePixels(platformScreen->cursor()->size(),
platformScreen);
QPoint offset(2, cursorSize.height());
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 79c8aba8cf..7be83c1837 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1608,7 +1608,6 @@ void QWidgetPrivate::createTLExtra()
x->opacity = 255;
x->posIncludesFrame = 0;
x->sizeAdjusted = false;
- x->inTopLevelResize = false;
x->embedded = 0;
x->window = nullptr;
x->initialScreenIndex = -1;
@@ -10803,7 +10802,7 @@ void QWidgetPrivate::repaint(T r)
return;
QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
- if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)
+ if (tlwExtra && tlwExtra->backingStore)
tlwExtra->repaintManager->markDirty(r, q, QWidgetRepaintManager::UpdateNow);
}
@@ -10878,7 +10877,7 @@ void QWidgetPrivate::update(T r)
}
QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
- if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)
+ if (tlwExtra && tlwExtra->backingStore)
tlwExtra->repaintManager->markDirty(clipped, q);
}
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index a3eac8d9ec..b71b72fe13 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -155,7 +155,6 @@ struct QTLWExtra {
uint opacity : 8;
uint posIncludesFrame : 1;
uint sizeAdjusted : 1;
- uint inTopLevelResize : 1;
uint embedded : 1;
};
diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp
index 135a1527ac..e7e85c39e7 100644
--- a/src/widgets/kernel/qwidgetrepaintmanager.cpp
+++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp
@@ -166,7 +166,7 @@ void QWidgetPrivate::invalidateBackingStore(const T &r)
return;
QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
- if (!tlwExtra || tlwExtra->inTopLevelResize || !tlwExtra->backingStore)
+ if (!tlwExtra || !tlwExtra->backingStore)
return;
T clipped(r);
@@ -213,7 +213,6 @@ void QWidgetRepaintManager::markDirty(const T &r, QWidget *widget, UpdateTime up
Q_ASSERT(tlw->d_func()->extra);
Q_ASSERT(tlw->d_func()->extra->topextra);
- Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize);
Q_ASSERT(widget->isVisible() && widget->updatesEnabled());
Q_ASSERT(widget->window() == tlw);
Q_ASSERT(!r.isEmpty());
@@ -446,8 +445,6 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy)
QWidget *tlw = q->window();
QTLWExtra* x = tlw->d_func()->topData();
- if (x->inTopLevelResize)
- return;
static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_MOVE") == 0;
@@ -543,8 +540,6 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy)
Q_Q(QWidget);
QWidget *tlw = q->window();
QTLWExtra* x = tlw->d_func()->topData();
- if (x->inTopLevelResize)
- return;
QWidgetRepaintManager *repaintManager = x->repaintManager.get();
if (!repaintManager)
@@ -722,8 +717,7 @@ void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedR
{
qCInfo(lcWidgetPainting) << "Syncing" << exposedRegion << "of" << exposedWidget;
- QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
- if (!tlw->isVisible() || !tlwExtra || tlwExtra->inTopLevelResize)
+ if (!tlw->isVisible())
return;
if (!exposedWidget || !hasPlatformWindow(exposedWidget)
@@ -815,13 +809,11 @@ void QWidgetRepaintManager::paintAndFlush()
const bool updatesDisabled = !tlw->updatesEnabled();
bool repaintAllWidgets = false;
- const bool inTopLevelResize = tlw->d_func()->maybeTopData()->inTopLevelResize;
const QRect tlwRect = tlw->data->crect;
- const QRect surfaceGeometry(tlwRect.topLeft(), store->size());
- if ((inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {
+ if (!updatesDisabled && store->size() != tlwRect.size()) {
if (hasStaticContents() && !store->size().isEmpty() ) {
// Repaint existing dirty area and newly visible area.
- const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
+ const QRect clipRect(QPoint(0, 0), store->size());
const QRegion staticRegion(staticContents(nullptr, clipRect));
QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
newVisible -= staticRegion;
@@ -837,7 +829,7 @@ void QWidgetRepaintManager::paintAndFlush()
}
}
- if (inTopLevelResize || surfaceGeometry.size() != tlwRect.size())
+ if (store->size() != tlwRect.size())
store->resize(tlwRect.size());
if (updatesDisabled)
@@ -1248,11 +1240,10 @@ bool QWidgetRepaintManager::hasStaticContents() const
QRegion QWidgetRepaintManager::staticContents(QWidget *parent, const QRect &withinClipRect) const
{
if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) {
- const QSize surfaceGeometry(store->size());
- QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
+ QRect backingstoreRect(QPoint(0, 0), store->size());
if (!withinClipRect.isEmpty())
- surfaceRect &= withinClipRect;
- return QRegion(surfaceRect);
+ backingstoreRect &= withinClipRect;
+ return QRegion(backingstoreRect);
}
QRegion region;
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index e82ddbcd20..0fa3fb4c67 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -397,7 +397,7 @@ QPointer<QWidget> qt_last_mouse_receiver = nullptr;
void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
{
-#if !defined(Q_OS_OSX) && !defined(Q_OS_IOS) // Cocoa tracks popups
+#if !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) // Cocoa tracks popups
// Ignore all enter/leave events from QPA if we are not on the first-level context menu.
// This prevents duplicated events on most platforms. Fake events will be delivered in
// QWidgetWindow::handleMouseEvent(QMouseEvent *). Make an exception whether the widget
@@ -505,7 +505,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ?
QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
if (QApplicationPrivate::inPopupMode()) {
- QWidget *activePopupWidget = QApplication::activePopupWidget();
+ QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget();
QPoint mapped = event->pos();
if (activePopupWidget != m_widget)
mapped = activePopupWidget->mapFromGlobal(event->globalPos());
@@ -544,7 +544,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
if (receiver != activePopupWidget)
widgetPos = receiver->mapFromGlobal(event->globalPos());
-#if !defined(Q_OS_OSX) && !defined(Q_OS_IOS) // Cocoa tracks popups
+#if !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) // Cocoa tracks popups
const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped);
const bool underMouse = activePopupWidget->underMouse();
if (underMouse != reallyUnderMouse) {
@@ -565,9 +565,11 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
#endif
if ((event->type() != QEvent::MouseButtonPress)
|| !(event->flags().testFlag(Qt::MouseEventCreatedDoubleClick))) {
-
+ // if the widget that was pressed is gone, then deliver move events without buttons
+ const auto buttons = event->type() == QEvent::MouseMove && qt_button_down == nullptr
+ ? Qt::NoButton : event->buttons();
QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(),
- event->button(), event->buttons(), event->modifiers(), event->source());
+ event->button(), buttons, event->modifiers(), event->source());
e.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &e, receiver, receiver->window(), &qt_button_down, qt_last_mouse_receiver);
qt_last_mouse_receiver = receiver;
@@ -764,7 +766,7 @@ void QWidgetWindow::repaintWindow()
return;
QTLWExtra *tlwExtra = m_widget->window()->d_func()->maybeTopData();
- if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)
+ if (tlwExtra && tlwExtra->backingStore)
tlwExtra->repaintManager->markDirty(m_widget->rect(), m_widget,
QWidgetRepaintManager::UpdateNow, QWidgetRepaintManager::BufferInvalid);
}
@@ -813,16 +815,16 @@ void QWidgetWindow::handleMoveEvent(QMoveEvent *event)
void QWidgetWindow::handleResizeEvent(QResizeEvent *event)
{
- QSize oldSize = m_widget->data->crect.size();
+ auto oldRect = m_widget->rect();
if (updateSize()) {
QGuiApplication::forwardEvent(m_widget, event);
if (m_widget->d_func()->shouldPaintOnScreen()) {
- QRegion updateRegion(geometry());
+ QRegion dirtyRegion = m_widget->rect();
if (m_widget->testAttribute(Qt::WA_StaticContents))
- updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
- m_widget->d_func()->syncBackingStore(updateRegion);
+ dirtyRegion -= oldRect;
+ m_widget->d_func()->syncBackingStore(dirtyRegion);
} else {
m_widget->d_func()->syncBackingStore();
}
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 2a0d6d1b40..b9abedd626 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -479,7 +479,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
{
QPixmap pixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_groupbox.png"));
int topMargin = 0;
- auto control = dynamic_cast<const QGroupBox *>(widget);
+ auto control = qobject_cast<const QGroupBox *>(widget);
if (control && !control->isCheckable() && control->title().isEmpty()) {
// Shrinking the topMargin if Not checkable AND title is empty
topMargin = groupBoxTopMargin;
@@ -1532,7 +1532,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
//draw text
QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, mbi, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
alignment |= Qt::TextHideMnemonic;
proxy()->drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole);
} else {
@@ -1702,7 +1702,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
p->save();
int t = s.indexOf(QLatin1Char('\t'));
int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
text_flags |= Qt::TextHideMnemonic;
text_flags |= Qt::AlignLeft;
if (t >= 0) {
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 77ffda10b0..6e42005e86 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -245,7 +245,7 @@ void QAbstractButtonPrivate::notifyChecked()
void QAbstractButtonPrivate::moveFocus(int key)
{
- QList<QAbstractButton *> buttonList = queryButtonList();;
+ QList<QAbstractButton *> buttonList = queryButtonList();
#if QT_CONFIG(buttongroup)
bool exclusive = group ? group->d_func()->exclusive : autoExclusive;
#else
@@ -265,7 +265,7 @@ void QAbstractButtonPrivate::moveFocus(int key)
for (int i = 0; i < buttonList.count(); ++i) {
QAbstractButton *button = buttonList.at(i);
if (button != f && button->window() == f->window() && button->isEnabled() && !button->isHidden() &&
- (autoExclusive || (button->focusPolicy() & focus_flag) == focus_flag)) {
+ (exclusive || (button->focusPolicy() & focus_flag) == focus_flag)) {
QRect buttonRect = button->rect().translated(button->mapToGlobal(QPoint(0,0)));
QPoint p = buttonRect.center();
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 257cffda62..6bc88f129d 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -308,7 +308,7 @@ void QAbstractScrollAreaPrivate::init()
q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layoutChildren();
-#ifndef Q_OS_OSX
+#ifndef Q_OS_MACOS
# ifndef QT_NO_GESTURES
viewport->grabGesture(Qt::PanGesture);
# endif
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 47993b8f3b..8f195381e4 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@@ -904,7 +904,8 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
This signal is sent when the user chooses an item in the combobox.
The item's \a index is passed. Note that this signal is sent even
when the choice is not changed. If you need to know when the
- choice actually changes, use signal currentIndexChanged().
+ choice actually changes, use signal currentIndexChanged() or
+ currentTextChanged().
*/
/*!
@@ -914,7 +915,8 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
This signal is sent when the user chooses an item in the combobox.
The item's \a text is passed. Note that this signal is sent even
when the choice is not changed. If you need to know when the
- choice actually changes, use signal currentIndexChanged().
+ choice actually changes, use signal currentIndexChanged() or
+ currentTextChanged().
*/
/*!
@@ -933,13 +935,13 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
*/
/*!
- \fn void QComboBox::currentIndexChanged(int index, const QString &text)
- \since 5.15
+ \fn void QComboBox::currentIndexChanged(int index)
+ \since 4.1
This signal is sent whenever the currentIndex in the combobox
changes either through user interaction or programmatically. The
- item's \a index is passed or -1 if the combobox becomes empty or
- the currentIndex was reset. The item's \a text is also passed.
+ item's \a index is passed or -1 if the combobox becomes empty or the
+ currentIndex was reset.
*/
/*!
@@ -971,7 +973,6 @@ QComboBox::QComboBox(QComboBoxPrivate &dd, QWidget *parent)
d->init();
}
-
/*!
\class QComboBox
\brief The QComboBox widget is a combined button and popup list.
@@ -994,9 +995,10 @@ QComboBox::QComboBox(QComboBoxPrivate &dd, QWidget *parent)
to clear the displayed string without changing the combobox's
contents.
- There are two signals emitted if the current item of a combobox
- changes, currentIndexChanged() and activated().
- currentIndexChanged() is always emitted regardless if the change
+ There are three signals emitted if the current item of a combobox
+ changes, currentIndexChanged(), currentTextChanged() and activated().
+ currentIndexChanged() and currentTextChanged() are always emitted
+ regardless if the change
was done programmatically or by user interaction, while
activated() is only emitted when the change is caused by user
interaction. The highlighted() signal is emitted when the user
@@ -1048,7 +1050,7 @@ QComboBox::QComboBox(QComboBoxPrivate &dd, QWidget *parent)
void QComboBoxPrivate::init()
{
Q_Q(QComboBox);
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
// On OS X, only line edits and list views always get tab focus. It's only
// when we enable full keyboard access that other controls can get tab focus.
// When it's not editable, a combobox looks like a button, and it behaves as
@@ -1205,7 +1207,7 @@ void QComboBoxPrivate::updateViewContainerPaletteAndOpacity()
void QComboBoxPrivate::updateFocusPolicy()
{
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
Q_Q(QComboBox);
// See comment in QComboBoxPrivate::init()
@@ -1412,7 +1414,7 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
{
Q_Q(QComboBox);
const QString text = itemText(index);
- emit q->currentIndexChanged(index.row(), text);
+ emit q->currentIndexChanged(index.row());
// signal lineEdit.textChanged already connected to signal currentTextChanged, so don't emit double here
if (!lineEdit)
emit q->currentTextChanged(text);
@@ -2646,7 +2648,7 @@ bool QComboBoxPrivate::showNativePopup()
const QRect targetRect = QRect(tlw->mapFromGlobal(q->mapToGlobal(offset)), QSize());
m_platformMenu->showPopup(tlw, QHighDpi::toNativePixels(targetRect, tlw), currentItem);
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
// The Cocoa popup will swallow any mouse release event.
// We need to fake one here to un-press the button.
QMouseEvent mouseReleased(QEvent::MouseButtonRelease, q->pos(), Qt::LeftButton,
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 99816954fa..1411d64143 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@@ -233,7 +233,7 @@ Q_SIGNALS:
void textActivated(const QString &);
void highlighted(int index);
void textHighlighted(const QString &);
- void currentIndexChanged(int index, const QString &text);
+ void currentIndexChanged(int index);
void currentTextChanged(const QString &);
protected:
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 0a4433846f..ac9bd4401a 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -94,8 +94,18 @@ public:
// Override QDateTimeParser:
QString displayText() const override { return edit->text(); }
- QDateTime getMinimum() const override { return minimum.toDateTime(); }
- QDateTime getMaximum() const override { return maximum.toDateTime(); }
+ QDateTime getMinimum() const override
+ {
+ if (keyboardTracking)
+ return minimum.toDateTime();
+ return QDateTimeParser::getMinimum();
+ }
+ QDateTime getMaximum() const override
+ {
+ if (keyboardTracking)
+ return maximum.toDateTime();
+ return QDateTimeParser::getMaximum();
+ }
QLocale locale() const override { return q_func()->locale(); }
int cursorPosition() const override { return edit ? edit->cursorPosition() : -1; }
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index d6db6dd5bc..055412528f 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -601,9 +601,17 @@ const QValidator * QLineEdit::validator() const
}
/*!
- Sets this line edit to only accept input that the validator, \a v,
- will accept. This allows you to place any arbitrary constraints on
- the text which may be entered.
+ Sets the validator for values of line edit to \a v.
+
+ The line edit's returnPressed() and editingFinished() signals will only
+ be emitted if \a v validates the line edit's content as \l{QValidator::}{Acceptable}.
+ The user may change the content to any \l{QValidator::}{Intermediate}
+ value during editing, but will be prevented from editing the text to a
+ value that \a v validates as \l{QValidator::}{Invalid}.
+
+ This allows you to constrain the text that shall finally be entered when editing is
+ done, while leaving users with enough freedom to edit the text from one valid state
+ to another.
If \a v == 0, setValidator() removes the current input validator.
The initial setting is to have no input validator (i.e. any input
@@ -703,7 +711,7 @@ QSize QLineEdit::sizeHint() const
/*!
Returns a minimum size for the line edit.
- The width returned is enough for at least one character.
+ The width returned is usually enough for at least one character.
*/
QSize QLineEdit::minimumSizeHint() const
@@ -715,7 +723,7 @@ QSize QLineEdit::minimumSizeHint() const
int h = fm.height() + qMax(2 * QLineEditPrivate::verticalMargin, fm.leading())
+ tm.top() + tm.bottom()
+ d->topmargin + d->bottommargin;
- int w = fm.maxWidth()
+ int w = fm.maxWidth() + 2 * QLineEditPrivate::horizontalMargin
+ tm.left() + tm.right()
+ d->leftmargin + d->rightmargin;
QStyleOptionFrame opt;
@@ -1441,7 +1449,7 @@ void QLineEdit::copy() const
Inserts the clipboard's text at the cursor position, deleting any
selected text, providing the line edit is not \l{QLineEdit::readOnly}{read-only}.
- If the end result would not be acceptable to the current
+ If the end result would be invalid to the current
\l{setValidator()}{validator}, nothing happens.
\sa copy(), cut()
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 4bd3e23479..e3016371ba 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -67,7 +67,7 @@
#include "qtoolbar_p.h"
#endif
#include "qwidgetanimator_p.h"
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
#include <qpa/qplatformnativeinterface.h>
#endif
@@ -79,7 +79,7 @@ class QMainWindowPrivate : public QWidgetPrivate
public:
inline QMainWindowPrivate()
: layout(nullptr), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly)
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
, useUnifiedToolBar(false)
#endif
{ }
@@ -87,7 +87,7 @@ public:
QSize iconSize;
bool explicitIconSize;
Qt::ToolButtonStyle toolButtonStyle;
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
bool useUnifiedToolBar;
#endif
void init();
@@ -1357,7 +1357,7 @@ bool QMainWindow::event(QEvent *event)
*/
void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
{
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
Q_D(QMainWindow);
if (isWindow()) {
d->useUnifiedToolBar = set;
@@ -1382,7 +1382,7 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
bool QMainWindow::unifiedTitleAndToolBarOnMac() const
{
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
return d_func()->useUnifiedToolBar;
#endif
return false;
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index e26f797501..31a7ad8695 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -49,7 +49,7 @@
#include "qlayout.h"
#include "qpainter.h"
#include <qpa/qplatformtheme.h>
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
#include "qmacnativewidget_mac.h"
#endif
#include "qapplication.h"
@@ -1496,7 +1496,7 @@ void QMenuPrivate::_q_platformMenuAboutToShow()
emit q->aboutToShow();
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
if (platformMenu) {
const auto actions = q->actions();
for (QAction *action : actions) {
@@ -3556,7 +3556,7 @@ void QMenu::actionEvent(QActionEvent *e)
d->currentAction = nullptr;
if (QWidgetAction *wa = qobject_cast<QWidgetAction *>(e->action())) {
if (QWidget *widget = d->widgetItems.value(wa)) {
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
QWidget *p = widget->parentWidget();
if (p != this && qobject_cast<QMacNativeWidget *>(p)) {
// This widget was reparented into a native Mac view
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 6ae73cf9fe..7a60907532 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -288,7 +288,7 @@ private:
friend void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action);
};
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
// ### Qt 4 compatibility; remove in Qt 6
inline QT_DEPRECATED void qt_mac_set_dock_menu(QMenu *menu) { menu->setAsDockMenu(); }
#endif
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 02fe9f31a1..3871d6763c 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -335,7 +335,7 @@ public:
void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem *item);
QPlatformMenuItem *insertActionInPlatformMenu(const QAction *action, QPlatformMenuItem *beforeItem);
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
void moveWidgetToPlatformItem(QWidget *w, QPlatformMenuItem* item);
#endif
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index df480629da..53be917945 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -60,7 +60,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
#include <qpa/qplatformnativeinterface.h>
#endif
@@ -115,7 +115,7 @@ inline static bool verticalTabs(QTabBar::Shape shape)
void QTabBarPrivate::updateMacBorderMetrics()
{
-#if defined(Q_OS_OSX)
+#if defined(Q_OS_MACOS)
Q_Q(QTabBar);
// Extend the unified title and toolbar area to cover the tab bar iff
// 1) the tab bar is in document mode
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index bb376e9613..9c63f98a73 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -61,7 +61,7 @@
#include <private/qwidgetaction_p.h>
#include <private/qmainwindowlayout_p.h>
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
#include <qpa/qplatformnativeinterface.h>
#endif
@@ -248,7 +248,7 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
QStyleOptionToolBar opt;
q->initStyleOption(&opt);
if (q->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, q).contains(event->pos()) == false) {
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
// When using the unified toolbar on OS X, the user can click and
// drag between toolbar contents to move the window. Make this work by
// implementing the standard mouse-dragging code and then call
@@ -282,7 +282,7 @@ bool QToolBarPrivate::mouseReleaseEvent(QMouseEvent*)
endDrag();
return true;
} else {
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
if (!macWindowDragging)
return false;
macWindowDragging = false;
@@ -298,7 +298,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
Q_Q(QToolBar);
if (!state) {
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
if (!macWindowDragging)
return false;
QWidget *w = q->window();
@@ -1084,7 +1084,7 @@ static bool waitForPopup(QToolBar *tb, QWidget *popup)
return false;
}
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
static void enableMacToolBar(QToolBar *toolbar, bool enable)
{
QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface();
@@ -1123,7 +1123,7 @@ bool QToolBar::event(QEvent *event)
Q_FALLTHROUGH();
case QEvent::Show:
d->toggleViewAction->setChecked(event->type() == QEvent::Show);
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
enableMacToolBar(this, event->type() == QEvent::Show);
#endif
emit visibilityChanged(event->type() == QEvent::Show);
diff --git a/src/widgets/widgets/qtoolbar_p.h b/src/widgets/widgets/qtoolbar_p.h
index e1b786cab7..07f1af3fe0 100644
--- a/src/widgets/widgets/qtoolbar_p.h
+++ b/src/widgets/widgets/qtoolbar_p.h
@@ -74,7 +74,7 @@ public:
allowedAreas(Qt::AllToolBarAreas), orientation(Qt::Horizontal),
toolButtonStyle(Qt::ToolButtonIconOnly),
layout(nullptr), state(nullptr)
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
, macWindowDragging(false)
#endif
{ }
@@ -106,7 +106,7 @@ public:
};
DragState *state;
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
bool macWindowDragging;
QPoint macWindowDragPressPosition;
#endif
diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp
index 8ddf27c878..e1c0df31d1 100644
--- a/src/widgets/widgets/qtoolbarlayout.cpp
+++ b/src/widgets/widgets/qtoolbarlayout.cpp
@@ -48,7 +48,7 @@
#include <qmenu.h>
#include <qdebug.h>
#include <qmath.h>
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
#include <qpa/qplatformnativeinterface.h>
#endif
@@ -348,7 +348,7 @@ static bool defaultWidgetAction(QToolBarItem *item)
void QToolBarLayout::updateMacBorderMetrics()
{
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
QToolBar *tb = qobject_cast<QToolBar*>(parentWidget());
if (!tb)
return;
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 3b9ec618bb..e22028aa49 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -2236,6 +2236,7 @@ void QWidgetTextControlPrivate::focusEvent(QFocusEvent *e)
#endif
} else {
setCursorVisible(false);
+ cursorOn = false;
if (cursorIsFocusIndicator
&& e->reason() != Qt::ActiveWindowFocusReason