diff options
Diffstat (limited to 'src/widgets')
46 files changed, 180 insertions, 117 deletions
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index a7b536ae54..e485744dc8 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -425,6 +425,15 @@ QAccessibleInterface *QAccessibleTable::childAt(int x, int y) const return nullptr; } +QAccessibleInterface *QAccessibleTable::focusChild() const +{ + QModelIndex index = view()->currentIndex(); + if (!index.isValid()) + return nullptr; + + return child(logicalIndex(index)); +} + int QAccessibleTable::childCount() const { if (!view()->model()) @@ -692,6 +701,20 @@ QAccessibleInterface *QAccessibleTree::childAt(int x, int y) const return child(i); } +QAccessibleInterface *QAccessibleTree::focusChild() const +{ + QModelIndex index = view()->currentIndex(); + if (!index.isValid()) + return nullptr; + + const QTreeView *treeView = qobject_cast<const QTreeView*>(view()); + int row = treeView->d_func()->viewIndex(index) + (horizontalHeader() ? 1 : 0); + int column = index.column(); + + int i = row * view()->model()->columnCount() + column; + return child(i); +} + int QAccessibleTree::childCount() const { const QTreeView *treeView = qobject_cast<const QTreeView*>(view()); diff --git a/src/widgets/accessible/itemviews_p.h b/src/widgets/accessible/itemviews_p.h index 683ae9c948..1fc6a3e521 100644 --- a/src/widgets/accessible/itemviews_p.h +++ b/src/widgets/accessible/itemviews_p.h @@ -79,6 +79,7 @@ public: QRect rect() const override; QAccessibleInterface *childAt(int x, int y) const override; + QAccessibleInterface *focusChild() const override; int childCount() const override; int indexOfChild(const QAccessibleInterface *) const override; @@ -154,6 +155,7 @@ public: QAccessibleInterface *childAt(int x, int y) const override; + QAccessibleInterface *focusChild() const override; int childCount() const override; QAccessibleInterface *child(int index) const override; diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 3152a8dd3e..711effefe2 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -161,9 +161,10 @@ Q_GLOBAL_STATIC(QUrl, lastVisitedDir) By default, a platform-native file dialog will be used if the platform has one. In that case, the widgets which would otherwise be used to construct the dialog will not be instantiated, so related accessors such as layout() and - itemDelegate() will return null. You can set the \l DontUseNativeDialog option to - ensure that the widget-based implementation will be used instead of the - native dialog. + itemDelegate() will return null. Also, not all platforms show file dialogs + with a title bar, so be aware that the caption text might not be visible to + the user. You can set the \l DontUseNativeDialog option to ensure that the + widget-based implementation will be used instead of the native dialog. \sa QDir, QFileInfo, QFile, QColorDialog, QFontDialog, {Standard Dialogs Example}, {Application Example} @@ -1256,8 +1257,9 @@ QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList &files QFileInfo info(name); // if the filename has no suffix, add the default suffix const QString defaultSuffix = options->defaultSuffix(); - if (!defaultSuffix.isEmpty() && !info.isDir() && name.lastIndexOf(QLatin1Char('.')) == -1) + if (!defaultSuffix.isEmpty() && !info.isDir() && !info.fileName().contains(u'.')) name += QLatin1Char('.') + defaultSuffix; + if (info.isAbsolute()) { files.append(name); } else { @@ -1283,8 +1285,12 @@ QList<QUrl> QFileDialogPrivate::addDefaultSuffixToUrls(const QList<QUrl> &urlsTo QUrl url = urlsToFix.at(i); // if the filename has no suffix, add the default suffix const QString defaultSuffix = options->defaultSuffix(); - if (!defaultSuffix.isEmpty() && !url.path().endsWith(QLatin1Char('/')) && url.path().lastIndexOf(QLatin1Char('.')) == -1) - url.setPath(url.path() + QLatin1Char('.') + defaultSuffix); + if (!defaultSuffix.isEmpty()) { + const QString urlPath = url.path(); + const auto idx = urlPath.lastIndexOf(u'/'); + if (idx != (urlPath.size() - 1) && !QStringView{urlPath}.mid(idx + 1).contains(u'.')) + url.setPath(urlPath + u'.' + defaultSuffix); + } urls.append(url); } return urls; @@ -2183,7 +2189,8 @@ QString QFileDialog::labelText(DialogLabel label) const then a default caption will be used. On Windows, and \macos, this static function will use the - native file dialog and not a QFileDialog. + native file dialog and not a QFileDialog. Note that the \macos native file + dialog does not show a title bar. On Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not \nullptr then it will position @@ -2294,7 +2301,8 @@ QUrl QFileDialog::getOpenFileUrl(QWidget *parent, then a default caption will be used. On Windows, and \macos, this static function will use the - native file dialog and not a QFileDialog. + native file dialog and not a QFileDialog. Note that the \macos native file + dialog does not show a title bar. On Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not \nullptr then it will position @@ -2461,7 +2469,7 @@ void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::funct auto dialogClosed = [=](int code) { Q_UNUSED(code); - delete dialog; + dialog->deleteLater(); }; connect(dialog, &QFileDialog::fileSelected, fileSelected); @@ -2506,7 +2514,7 @@ void QFileDialog::saveFileContent(const QByteArray &fileContent, const QString & auto dialogClosed = [=](int code) { Q_UNUSED(code); - delete dialog; + dialog->deleteLater(); }; connect(dialog, &QFileDialog::fileSelected, fileSelected); @@ -2659,6 +2667,8 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent, to pass \l{QFileDialog::}{DontUseNativeDialog} to display files using a QFileDialog. + Note that the \macos native file dialog does not show a title bar. + On Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp}, the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}. If diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc index a82462a432..d0673f207b 100644 --- a/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc @@ -35,7 +35,7 @@ The widgets examples show how some of the widgets available in Qt might appear when configured to use the a particular style. Each style is only - available on the respective platfom, and provides native look and feel by + available on the respective platform, and provides native look and feel by integrating to the platform theme. Thus, the final appearance varies depending on the active theme. diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index 8dc68117aa..c4b77f42c4 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -1033,7 +1033,7 @@ The slider can be styled using the \l{#handle-sub}{::handle} subcontrol. Setting the \l{#min-width-prop}{min-width} or \l{#min-height-prop}{min-height} - provides size contraints for the slider depending on the orientation. + provides size constraints for the slider depending on the orientation. The \l{add-line-sub}{::add-line} subcontrol can be used to style the button to add a line. By default, the add-line subcontrol is placed in @@ -1950,7 +1950,7 @@ The only widget currently supporting this property is QPushButton. - \note It's the application's responsibilty to assign an icon to a + \note It's the application's responsibility to assign an icon to a button (using the QAbstractButton API), and not the style's. So be careful setting it unless your stylesheet is targeting a specific application. diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp index 2eb74ce2a8..235991b1df 100644 --- a/src/widgets/effects/qgraphicseffect.cpp +++ b/src/widgets/effects/qgraphicseffect.cpp @@ -86,7 +86,7 @@ any other existing effects) and reimplement the virtual function draw(). This function is called whenever the effect needs to redraw. The draw() function takes the painter with which to draw as an argument. For more - information, refer to the documenation for draw(). In the draw() function + information, refer to the documentation for draw(). In the draw() function you can call sourcePixmap() to get a pixmap of the graphics effect source which you can then process. @@ -750,7 +750,7 @@ void QGraphicsColorizeEffect::draw(QPainter *painter) at the potential cost of lower performance. \value AnimationHint Indicates that the blur radius is going to be animated, hinting - that the implementation can keep a cache of blurred verisons of the source. + that the implementation can keep a cache of blurred versions of the source. Do not use this hint if the source is going to be dynamically changing. \sa blurHints(), setBlurHints() diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp index af0ee3d38c..7cc23339c2 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2078,7 +2078,7 @@ QList<AnchorData *> getVariables(const QList<QSimplexConstraint *> &constraints) In a nutshell it should do: 1) Refresh anchor nominal sizes, that is, the size that each anchor would - have if no other restrictions applied. This is done by quering the + have if no other restrictions applied. This is done by querying the layout style and the sizeHints of the items belonging to the layout. 2) Simplify the graph by grouping together parallel and sequential anchors diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 944bd95c82..b26b9c2f8e 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -244,7 +244,7 @@ \li keyPressEvent() and keyReleaseEvent() handle key press and release events \li mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(), and mouseDoubleClickEvent() handles mouse press, move, release, click and - doubleclick events + double-click events \endlist You can filter events for any other item by installing event filters. This @@ -2738,7 +2738,7 @@ void QGraphicsItemPrivate::setEnabledHelper(bool newEnabled, bool explicitly, bo If you disable a parent item, all its children will also be disabled. If you enable a parent item, all children will be enabled, unless they have been explicitly disabled (i.e., if you call setEnabled(false) on a child, - it will not be reenabled if its parent is disabled, and then enabled + it will not be re-enabled if its parent is disabled, and then enabled again). Items are enabled by default. @@ -3031,7 +3031,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const Returns the effective bounding rect of the item. If the item has no effect, this is the same as the item's bounding rect. If the item has an effect, the effective rect can be larger than the item's - bouding rect, depending on the effect. + bounding rect, depending on the effect. \sa boundingRect() */ @@ -4357,7 +4357,8 @@ QMatrix QGraphicsItem::sceneMatrix() const \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 4 Unlike transform(), which returns only an item's local transformation, this - function includes the item's (and any parents') position, and all the transfomation properties. + function includes the item's (and any parents') position, and all the + transformation properties. \sa transform(), setTransform(), scenePos(), {The Graphics View Coordinate System}, {Transformations} */ @@ -4610,7 +4611,7 @@ QT_WARNING_POP To simplify interaction with items using a transformed view, QGraphicsItem provides mapTo... and mapFrom... functions that can translate between items' and the scene's coordinates. For example, you can call mapToScene() - to map an item coordiate to a scene coordinate, or mapFromScene() to map + to map an item coordinate to a scene coordinate, or mapFromScene() to map from scene coordinates to item coordinates. The transformation matrix is combined with the item's rotation(), scale() @@ -5167,7 +5168,7 @@ bool QGraphicsItem::contains(const QPointF &point) const The default implementation is based on shape intersection, and it calls shape() on both items. Because the complexity of arbitrary shape-shape intersection grows with an order of magnitude when the shapes are complex, - this operation can be noticably time consuming. You have the option of + this operation can be noticeably time-consuming. You have the option of reimplementing this function in a subclass of QGraphicsItem to provide a custom algorithm. This allows you to make use of natural constraints in the shapes of your own items, in order to improve the performance of the @@ -7231,7 +7232,7 @@ void QGraphicsItem::keyReleaseEvent(QKeyEvent *event) If you do reimplement this function, \a event will by default be accepted (see QEvent::accept()), and this item is then the mouse grabber. This allows the item to receive future move, release and - doubleclick events. If you call QEvent::ignore() on \a event, this + double-click events. If you call QEvent::ignore() on \a event, this item will lose the mouse grab, and \a event will propagate to any topmost item beneath. No further mouse events will be delivered to this item unless a new mouse press event is received. @@ -7452,11 +7453,11 @@ void QGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) /*! This event handler, for event \a event, can be reimplemented to - receive mouse doubleclick events for this item. + receive mouse double-click events for this item. When doubleclicking an item, the item will first receive a mouse press event, followed by a release event (i.e., a click), then a - doubleclick event, and finally a release event. + double-click event, and finally a release event. Calling QEvent::ignore() or QEvent::accept() on \a event has no effect. @@ -8127,7 +8128,7 @@ void QGraphicsItemPrivate::resetHeight() /*! \fn QGraphicsObject::rotationChanged() - This signal gets emitted whenever the roation of the item changes. + This signal gets emitted whenever the rotation of the item changes. */ /*! @@ -8166,7 +8167,7 @@ void QGraphicsItemPrivate::resetHeight() /*! \fn void QGraphicsObject::enabledChanged() - This signal gets emitted whenever the item get's enabled or disabled. + This signal gets emitted whenever the item gets enabled or disabled. \sa isEnabled() */ @@ -8194,7 +8195,7 @@ void QGraphicsItemPrivate::resetHeight() \property QGraphicsObject::transformOriginPoint \brief the transformation origin - This property sets a specific point in the items coordiante system as the + This property sets a specific point in the item's coordinate system as the origin for scale and rotation. \sa scale, rotation, QGraphicsItem::transformOriginPoint() @@ -10601,16 +10602,17 @@ QWidgetTextControl *QGraphicsTextItemPrivate::textControl() const control = new QWidgetTextControl(that); control->setTextInteractionFlags(Qt::NoTextInteraction); - QObject::connect(control, SIGNAL(updateRequest(QRectF)), - qq, SLOT(_q_update(QRectF))); - QObject::connect(control, SIGNAL(documentSizeChanged(QSizeF)), - qq, SLOT(_q_updateBoundingRect(QSizeF))); - QObject::connect(control, SIGNAL(visibilityRequest(QRectF)), - qq, SLOT(_q_ensureVisible(QRectF))); - QObject::connect(control, SIGNAL(linkActivated(QString)), - qq, SIGNAL(linkActivated(QString))); - QObject::connect(control, SIGNAL(linkHovered(QString)), - qq, SIGNAL(linkHovered(QString))); + auto dd = that->dd; + QObject::connect(control, &QWidgetTextControl::updateRequest, qq, + [dd](const QRectF &rect) { dd->_q_update(rect); }); + QObject::connect(control, &QWidgetTextControl::documentSizeChanged, qq, + [dd](QSizeF size) { dd->_q_updateBoundingRect(size); }); + QObject::connect(control, &QWidgetTextControl::visibilityRequest, qq, + [dd](const QRectF &rect) { dd->_q_ensureVisible(rect); }); + QObject::connect(control, &QWidgetTextControl::linkActivated, qq, + &QGraphicsTextItem::linkActivated); + QObject::connect(control, &QWidgetTextControl::linkHovered, qq, + &QGraphicsTextItem::linkHovered); const QSizeF pgSize = control->document()->pageSize(); if (pgSize.height() != -1) { diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h index d66a4917e5..428b269748 100644 --- a/src/widgets/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -964,9 +964,6 @@ protected: private: Q_DISABLE_COPY(QGraphicsTextItem) - Q_PRIVATE_SLOT(dd, void _q_updateBoundingRect(const QSizeF &)) - Q_PRIVATE_SLOT(dd, void _q_update(QRectF)) - Q_PRIVATE_SLOT(dd, void _q_ensureVisible(QRectF)) QGraphicsTextItemPrivate *dd; friend class QGraphicsTextItemPrivate; }; diff --git a/src/widgets/graphicsview/qgraphicslayout.cpp b/src/widgets/graphicsview/qgraphicslayout.cpp index 8b52b57580..f7987cdd23 100644 --- a/src/widgets/graphicsview/qgraphicslayout.cpp +++ b/src/widgets/graphicsview/qgraphicslayout.cpp @@ -146,7 +146,7 @@ QT_BEGIN_NAMESPACE */ /*! - Contructs a QGraphicsLayout object. + Constructs a QGraphicsLayout object. \a parent is passed to QGraphicsLayoutItem's constructor and the QGraphicsLayoutItem's isLayout argument is set to \e true. diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index a428329a45..0db338550f 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -1852,7 +1852,7 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect item discovery functions like items() and itemAt(). Indexing is most efficient for static scenes (i.e., where items don't move around). For dynamic scenes, or scenes with many animated items, the index bookkeeping - can outweight the fast lookup speeds. + can outweigh the fast lookup speeds. For the common case, the default index method BspTreeIndex works fine. If your scene uses many animations and you are experiencing slowness, you can @@ -2480,7 +2480,7 @@ void QGraphicsScene::destroyItemGroup(QGraphicsItemGroup *group) } /*! - Adds or moves the \a item and all its childen to this scene. + Adds or moves the \a item and all its children to this scene. This scene takes ownership of the \a item. If the item is visible (i.e., QGraphicsItem::isVisible() returns @@ -4142,15 +4142,15 @@ void QGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) /*! This event handler, for event \a mouseEvent, can be reimplemented - in a subclass to receive mouse doubleclick events for the scene. + in a subclass to receive mouse double-click events for the scene. If someone doubleclicks on the scene, the scene will first receive a mouse press event, followed by a release event (i.e., a click), - then a doubleclick event, and finally a release event. If the - doubleclick event is delivered to a different item than the one + then a double-click event, and finally a release event. If the + double-click event is delivered to a different item than the one that received the first press and release, it will be delivered as a press event. However, tripleclick events are not delivered as - doubleclick events in this case. + double-click events in this case. The default implementation is similar to mousePressEvent(). diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 90bddf6e84..e1ff2c932e 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -107,7 +107,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < the events and reacts to them. For example, if you click on a selectable item, the item will typically let the scene know that it has been selected, and it will also redraw itself to display a selection - rectangle. Similiary, if you click and drag the mouse to move a movable + rectangle. Similarly, if you click and drag the mouse to move a movable item, it's the item that handles the mouse moves and moves itself. Item interaction is enabled by default, and you can toggle it by calling setInteractive(). @@ -3773,7 +3773,12 @@ void QGraphicsView::drawBackground(QPainter *painter, const QRectF &rect) return; } + const bool wasAa = painter->testRenderHint(QPainter::Antialiasing); + if (wasAa) + painter->setRenderHints(QPainter::Antialiasing, false); painter->fillRect(rect, d->backgroundBrush); + if (wasAa) + painter->setRenderHints(QPainter::Antialiasing, true); } /*! @@ -3877,7 +3882,7 @@ bool QGraphicsView::isTransformed() const otherwise, \a matrix \e replaces the current matrix. \a combine is false by default. - The transformation matrix tranforms the scene into view coordinates. Using + The transformation matrix transforms the scene into view coordinates. Using the default transformation, provided by the identity matrix, one pixel in the view represents one unit in the scene (e.g., a 10x10 rectangular item is drawn using 10x10 pixels in the view). If a 2x2 scaling matrix is @@ -3891,7 +3896,7 @@ bool QGraphicsView::isTransformed() const To simplify interation with items using a transformed view, QGraphicsView provides mapTo... and mapFrom... functions that can translate between scene and view coordinates. For example, you can call mapToScene() to map - a view coordiate to a floating point scene coordinate, or mapFromScene() + a view coordinate to a floating point scene coordinate, or mapFromScene() to map from floating point scene coordinates to view coordinates. \sa transform(), rotate(), scale(), shear(), translate() diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index b45a7bf704..deb49ca23d 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -4348,7 +4348,7 @@ void QAbstractItemViewPrivate::updateEditorData(const QModelIndex &tl, const QMo In DND if something has been moved then this is called. Typically this means you should "remove" the selected item or row, - but the behavior is view dependant (table just clears the selected indexes for example). + but the behavior is view-dependent (table just clears the selected indexes for example). Either remove the selected rows or clear them */ diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 2b34476642..5a88f1b1ef 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -1541,12 +1541,14 @@ void QListView::doItemsLayout() setState(ExpandingState); if (d->model->columnCount(d->root) > 0) { // no columns means no contents d->resetBatchStartRow(); - if (layoutMode() == SinglePass) + if (layoutMode() == SinglePass) { d->doItemsLayout(d->model->rowCount(d->root)); // layout everything - else if (!d->batchLayoutTimer.isActive()) { + } else if (!d->batchLayoutTimer.isActive()) { if (!d->doItemsLayout(d->batchSize)) // layout is done d->batchLayoutTimer.start(0, this); // do a new batch as fast as possible } + } else { // clear the QBspTree generated by the last layout + d->clear(); } QAbstractItemView::doItemsLayout(); setState(oldState); // restoring the oldState diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 934ac581b2..d120c41dc9 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1101,6 +1101,8 @@ int QTableViewPrivate::heightHintForIndex(const QModelIndex &index, int hint, QS table can be found by using rowHeight(); similarly, the width of columns can be found using columnWidth(). Since both of these are plain widgets, you can hide either of them using their hide() functions. + Each header is configured with its \l{QHeaderView::}{highlightSections} + and \l{QHeaderView::}{sectionsClickable} properties set to \c true. Rows and columns can be hidden and shown with hideRow(), hideColumn(), showRow(), and showColumn(). They can be selected with selectRow() diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 94756049e4..713cb8e0d2 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2695,7 +2695,7 @@ QTreeWidget::~QTreeWidget() } /* - Retuns the number of header columns in the view. + Returns the number of header columns in the view. \sa sortColumn(), currentColumn(), topLevelItemCount() */ diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 619f2e7364..1a0ac0cc3c 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2653,7 +2653,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, This function should only be called when the widget changes visibility, i.e. when the \a widget is shown, hidden or deleted. This function does nothing if the widget is a top-level or native, i.e. not an alien widget. In that - case enter/leave events are genereated by the underlying windowing system. + case enter/leave events are generated by the underlying windowing system. */ extern QPointer<QWidget> qt_last_mouse_receiver; extern Q_WIDGETS_EXPORT QWidget *qt_button_down; @@ -3845,7 +3845,7 @@ bool QApplication::keypadNavigationEnabled() \since 4.3 Causes an alert to be shown for \a widget if the window is not the active - window. The alert is shown for \a msec miliseconds. If \a msec is zero (the + window. The alert is shown for \a msec milliseconds. If \a msec is zero (the default), then the alert is shown indefinitely until the window becomes active again. diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp index c1052c5b9d..711510a623 100644 --- a/src/widgets/kernel/qboxlayout.cpp +++ b/src/widgets/kernel/qboxlayout.cpp @@ -1242,7 +1242,7 @@ QBoxLayout::Direction QBoxLayout::direction() const layout. \c window will be the parent of the widgets that are added to the layout. - If you don't pass parent \c window in the constrcutor, you can + If you don't pass a parent \c window to the constructor, you can at a later point use QWidget::setLayout() to install the QHBoxLayout object onto \c window. At that point, the widgets in the layout are reparented to have \c window as their parent. @@ -1315,7 +1315,7 @@ QHBoxLayout::~QHBoxLayout() layout. \c window will be the parent of the widgets that are added to the layout. - If you don't pass parent \c window in the constrcutor, you can + If you don't pass a parent \c window to the constructor, you can at a later point use QWidget::setLayout() to install the QVBoxLayout object onto \c window. At that point, the widgets in the layout are reparented to have \c window as their parent. diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp index 84dbed7043..bde5484771 100644 --- a/src/widgets/kernel/qgesture.cpp +++ b/src/widgets/kernel/qgesture.cpp @@ -1033,7 +1033,7 @@ void QGestureEvent::accept(Qt::GestureType gestureType) of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}. Clearing the accept flag indicates that the event receiver does not - want the gesture. Unwanted gestures may be propgated to the parent widget. + want the gesture. Unwanted gestures may be propagated to the parent widget. \sa QGestureEvent::accept() */ diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 9eba1e001e..e94520021e 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2305,7 +2305,7 @@ void QWidgetPrivate::deactivateWidgetCleanup() /*! - Returns a pointer to the widget with window identifer/handle \a + Returns a pointer to the widget with window identifier/handle \a id. The window identifier type depends on the underlying window @@ -5296,7 +5296,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *> (source->d_func()); if (!sourced->context) { - const QRegion effectRgn(rgn.boundingRect()); + const QRegion effectRgn((flags & UseEffectRegionBounds) ? rgn.boundingRect() : rgn); QWidgetPaintContext context(pdev, effectRgn, offset, flags, sharedPainter, repaintManager); sourced->context = &context; if (!sharedPainter) { @@ -5328,6 +5328,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } } #endif // QT_CONFIG(graphicseffect) + flags = flags & ~UseEffectRegionBounds; const bool alsoOnScreen = flags & DrawPaintOnScreen; const bool recursive = flags & DrawRecursive; @@ -12877,4 +12878,4 @@ QDebug operator<<(QDebug debug, const QWidget *widget) QT_END_NAMESPACE #include "moc_qwidget.cpp" - +#include "moc_qwidget_p.cpp" diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index eef6b8fa2c..c432f4b5d5 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -229,7 +229,8 @@ public: DontSubtractOpaqueChildren = 0x10, DontDrawOpaqueChildren = 0x20, DontDrawNativeChildren = 0x40, - DontSetCompositionMode = 0x80 + DontSetCompositionMode = 0x80, + UseEffectRegionBounds = 0x100 }; Q_DECLARE_FLAGS(DrawWidgetFlags, DrawWidgetFlag) Q_FLAG(DrawWidgetFlags) diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index 02880b34da..6e72aae5b7 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -1018,7 +1018,8 @@ void QWidgetRepaintManager::paintAndFlush() // Paint the rest with composition. if (repaintAllWidgets || !dirtyCopy.isEmpty()) { - QWidgetPrivate::DrawWidgetFlags flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive; + QWidgetPrivate::DrawWidgetFlags flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive + | QWidgetPrivate::UseEffectRegionBounds; tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, QPoint(), flags, nullptr, this); } @@ -1409,3 +1410,4 @@ void QWidgetPrivate::invalidateBackingStore_resizeHelper(const QPoint &oldPos, c QT_END_NAMESPACE #include "qwidgetrepaintmanager.moc" +#include "moc_qwidgetrepaintmanager_p.cpp" diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index 7cc32b2039..3ee68242de 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -1230,3 +1230,5 @@ QSize QPixmapStylePrivate::computeSize(const QPixmapStyleDescriptor &desc, int w } QT_END_NAMESPACE + +#include "moc_qpixmapstyle_p.cpp" diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 0d71762c8b..669f158b7b 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -91,7 +91,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C look of the different platforms supported by Qt (QWindowsStyle, QMacStyle, etc.). These styles are built into the Qt GUI module, other styles can be made available using Qt's - plugin mechansim. + plugin mechanism. Most functions for drawing style elements take four arguments: @@ -697,7 +697,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value PE_IndicatorToolBarSeparator The separator in a toolbar. \value PE_PanelToolBar The panel for a toolbar. \value PE_PanelTipLabel The panel for a tip label. - \value PE_FrameTabBarBase The frame that is drawn for a tab bar, ususally drawn for a tab bar that isn't part of a tab widget. + \value PE_FrameTabBarBase The frame that is drawn for a tab bar, usually drawn for a tab bar that isn't part of a tab widget. \value PE_IndicatorTabTear Deprecated. Use \l{PE_IndicatorTabTearLeft} instead. \value PE_IndicatorTabTearLeft An indicator that a tab is partially scrolled out on the left side of the visible tab bar when there are many tabs. \value PE_IndicatorTabTearRight An indicator that a tab is partially scrolled out on the right side of the visible tab bar when there are many tabs. @@ -1796,7 +1796,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, cause a list view expansion to be selected. \value SH_TabBar_PreferNoArrows Whether a tab bar should suggest a size - to prevent scoll arrows. + to prevent scroll arrows. \value SH_ComboBox_Popup Allows popups as a combobox drop-down menu. diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 95232dd97b..7459a8d4e7 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -3481,7 +3481,7 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version) /*! Construct a QStyleOptionTabBarBase, initializing the members - vaiables to their default values. + variables to their default values. */ QStyleOptionTabBarBase::QStyleOptionTabBarBase() : QStyleOption(Version, SO_TabBarBase), shape(QTabBar::RoundedNorth), diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 9fcb8ba522..55d95c7fb2 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2441,11 +2441,12 @@ static QWidget *embeddedWidget(QWidget *w) } /** \internal - in case w is an embedded widget, return the container widget - (i.e, the widget for which the rules actualy apply) - (exemple, if w is a lineedit embedded in a combobox, return the combobox) + Returns the widget whose style rules apply to \a w. + + When \a w is an embedded widget, this is the container widget. + For example, if w is a line edit embedded in a combobox, this returns the combobox. + When \a w is not embedded, this function return \a w itself. - if w is not embedded, return w itself */ static QWidget *containerWidget(const QWidget *w) { @@ -2649,6 +2650,9 @@ void QStyleSheetStyle::setProperties(QWidget *w) default: v = decl.d->values.at(0).variant; break; } + if (propertyL1 == "styleSheet" && value == v) + continue; + w->setProperty(propertyL1, v); } } diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp index be763f182e..4c87448a7d 100644 --- a/src/widgets/util/qscrollerproperties.cpp +++ b/src/widgets/util/qscrollerproperties.cpp @@ -347,13 +347,13 @@ void QScrollerProperties::setScrollMetric(ScrollMetric metric, const QVariant &v \value AcceleratingFlickSpeedupFactor The current speed is multiplied by this number if an accelerating flick is detected. Should be \c{>= 1}. - \value SnapPositionRatio This is the distance that the user must drag the area beween two snap + \value SnapPositionRatio This is the distance that the user must drag the area between two snap points in order to snap it to the next position. \c{0.33} means that the scroll must only reach one third of the distance between two snap points to snap to the next one. The ratio must be between \c 0 and \c 1. \value SnapTime This is the time factor for the scrolling curve. A lower value means that the - scrolling will take longer. The scrolling distance is independet of this value. + scrolling will take longer. The scrolling distance is independent of this value. \value OvershootDragResistanceFactor This value is the factor between the mouse dragging and the actual scroll area movement (during overshoot). The factor must be between \c 0 and \c 1. diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index ee52139913..dccea98a39 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -190,7 +190,7 @@ QSystemTrayIcon::~QSystemTrayIcon() The menu will pop up when the user requests the context menu for the system tray icon by clicking the mouse button. - On \macos, this is currenly converted to a NSMenu, so the + On \macos, this is currently converted to a NSMenu, so the aboutToHide() signal is not emitted. \note The system tray icon does not take ownership of the menu. You must diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index 04cd3fd136..ee43165ea0 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -202,7 +202,7 @@ void QAbstractScrollAreaScrollBarContainer::addWidget(QWidget *widget, LogicalPo } /*! \internal - Retuns a list of scroll bar widgets for the given position. The scroll bar + Returns a list of scroll-bar widgets for the given position. The scroll bar itself is not returned. */ QWidgetList QAbstractScrollAreaScrollBarContainer::widgets(LogicalPosition position) diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index a0611565b8..5ba50b6792 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE \row \li \l sliderReleased() \li the user releases the slider. \row \li \l actionTriggered() - \li a slider action was triggerd. + \li a slider action was triggered. \row \li \l rangeChanged() \li a the range has changed. \endtable diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index bb64edd85d..caa3cbfd4d 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -2952,7 +2952,7 @@ void QCalendarWidget::setDateEditEnabled(bool enable) \since 4.3 If the calendar widget's \l{dateEditEnabled}{date edit is enabled}, this - property specifies the amount of time (in millseconds) that the date edit + property specifies the amount of time (in milliseconds) that the date edit remains open after the most recent user input. Once this time has elapsed, the date specified in the date edit is accepted and the popup is closed. diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp index 25d57970bf..8f774a3cc7 100644 --- a/src/widgets/widgets/qdial.cpp +++ b/src/widgets/widgets/qdial.cpp @@ -222,7 +222,7 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const If you are using the mouse wheel to adjust the dial, the increment value is determined by the lesser value of - \l{QApplication::wheelScrollLines()} {wheelScrollLines} multipled + \l{QApplication::wheelScrollLines()} {wheelScrollLines} multiplied by \l {QAbstractSlider::singleStep} {singleStep}, and \l {QAbstractSlider::pageStep} {pageStep}. diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 28c4f59d0d..9631d3cbf6 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -903,7 +903,7 @@ void QDialogButtonBoxPrivate::_q_handleButtonDestroyed() \property QDialogButtonBox::centerButtons \brief whether the buttons in the button box are centered - By default, this property is \c false. This behavior is appopriate + By default, this property is \c false. This behavior is appropriate for most types of dialogs. A notable exception is message boxes on most platforms (e.g. Windows), where the button box is centered horizontally. diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 30ff80cbb0..cf2605c17c 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -421,9 +421,6 @@ void QLabel::setPixmap(const QPixmap &pixmap) d->pixmap = new QPixmap(pixmap); } - if (d->pixmap->depth() == 1 && !d->pixmap->mask()) - d->pixmap->setMask(*((QBitmap *)d->pixmap)); - d->updateLabel(); } diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 11367879e2..3df42c4819 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1987,21 +1987,28 @@ void QLineEdit::paintEvent(QPaintEvent *) p.setClipRect(r); QFontMetrics fm = fontMetrics(); + int fmHeight = 0; + if (d->shouldShowPlaceholderText()) + fmHeight = fm.boundingRect(d->placeholderText).height(); + else + fmHeight = fm.boundingRect(d->control->text() + d->control->preeditAreaText()).height(); + fmHeight = qMax(fmHeight, fm.height()); + Qt::Alignment va = QStyle::visualAlignment(d->control->layoutDirection(), QFlag(d->alignment)); switch (va & Qt::AlignVertical_Mask) { case Qt::AlignBottom: - d->vscroll = r.y() + r.height() - fm.height() - QLineEditPrivate::verticalMargin; + d->vscroll = r.y() + r.height() - fmHeight - QLineEditPrivate::verticalMargin; break; case Qt::AlignTop: d->vscroll = r.y() + QLineEditPrivate::verticalMargin; break; default: //center - d->vscroll = r.y() + (r.height() - fm.height() + 1) / 2; + d->vscroll = r.y() + (r.height() - fmHeight + 1) / 2; break; } QRect lineRect(r.x() + QLineEditPrivate::horizontalMargin, d->vscroll, - r.width() - 2 * QLineEditPrivate::horizontalMargin, fm.height()); + r.width() - 2 * QLineEditPrivate::horizontalMargin, fmHeight); if (d->shouldShowPlaceholderText()) { if (!d->placeholderText.isEmpty()) { diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 6b50f5e8ab..6310efc9da 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -954,10 +954,10 @@ void QMainWindow::setDockNestingEnabled(bool enabled) \since 4.2 If this property is set to false, dock areas containing tabbed dock widgets - display horizontal tabs, simmilar to Visual Studio. + display horizontal tabs, similar to Visual Studio. If this property is set to true, then the right and left dock areas display vertical - tabs, simmilar to KDevelop. + tabs, similar to KDevelop. This property should be set before any dock widgets are added to the main window. */ @@ -1223,7 +1223,7 @@ Qt::DockWidgetArea QMainWindow::dockWidgetArea(QDockWidget *dockwidget) const resized such that the yellowWidget is twice as big as the blueWidget If some widgets are grouped in tabs, only one widget per group should be - specified. Widgets not in the list might be changed to repect the constraints. + specified. Widgets not in the list might be changed to respect the constraints. */ void QMainWindow::resizeDocks(const QList<QDockWidget *> &docks, const QList<int> &sizes, Qt::Orientation orientation) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index a23d8b790d..284c83b8ec 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1651,7 +1651,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) and all other items are considered action items. When inserting action items you usually specify a receiver and a - slot. The receiver will be notifed whenever the item is + slot. The receiver will be notified whenever the item is \l{QAction::triggered()}{triggered()}. In addition, QMenu provides two signals, triggered() and hovered(), which signal the QAction that was triggered from the menu. @@ -2221,7 +2221,7 @@ void QMenu::setActiveAction(QAction *act) { Q_D(QMenu); d->setCurrentAction(act, 0); - if (d->scroll) + if (d->scroll && act) d->scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollCenter); } diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 8724fa1a19..12b38ac148 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -583,7 +583,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti \inmodule QtWidgets A menu bar consists of a list of pull-down menu items. You add - menu items with addMenu(). For example, asuming that \c menubar + menu items with addMenu(). For example, assuming that \c menubar is a pointer to a QMenuBar and \c fileMenu is a pointer to a QMenu, the following statement inserts the menu into the menu bar: \snippet code/src_gui_widgets_qmenubar.cpp 0 diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 568cf3b2e0..dd7f1ab964 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -175,7 +175,7 @@ QT_BEGIN_NAMESPACE \li Up/Down move a vertical scroll bar by one single step. \li PageUp moves up one page. \li PageDown moves down one page. - \li Home moves to the start (mininum). + \li Home moves to the start (minimum). \li End moves to the end (maximum). \endlist diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp index 161e4ba27a..7458d0732e 100644 --- a/src/widgets/widgets/qslider.cpp +++ b/src/widgets/widgets/qslider.cpp @@ -250,7 +250,7 @@ QStyle::SubControl QSliderPrivate::newHoverControl(const QPoint &pos) \li Up/Down move a vertical slider by one single step. \li PageUp moves up one page. \li PageDown moves down one page. - \li Home moves to the start (mininum). + \li Home moves to the start (minimum). \li End moves to the end (maximum). \endlist diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index ee7445f5bf..9a382e96dd 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2404,7 +2404,7 @@ void QTabBar::timerEvent(QTimerEvent *event) This property controls how items are elided when there is not enough space to show them for a given tab bar size. - By default the value is style dependent. + By default the value is style-dependent. \sa QTabWidget::elideMode, usesScrollButtons, QStyle::SH_TabBar_ElideMode */ @@ -2433,7 +2433,7 @@ void QTabBar::setElideMode(Qt::TextElideMode mode) When there are too many tabs in a tab bar for its size, the tab bar can either choose to expand its size or to add buttons that allow you to scroll through the tabs. - By default the value is style dependant. + By default the value is style-dependent. \sa elideMode, QTabWidget::usesScrollButtons, QStyle::SH_TabBar_PreferNoArrows */ diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index a19dacda52..5553c9a1a2 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -1348,7 +1348,7 @@ void QTabWidget::setIconSize(const QSize &size) This property controls how items are elided when there is not enough space to show them for a given tab bar size. - By default the value is style dependant. + By default the value is style dependent. \sa QTabBar::elideMode, usesScrollButtons, QStyle::SH_TabBar_ElideMode */ @@ -1371,7 +1371,7 @@ void QTabWidget::setElideMode(Qt::TextElideMode mode) When there are too many tabs in a tab bar for its size, the tab bar can either choose to expand its size or to add buttons that allow you to scroll through the tabs. - By default the value is style dependant. + By default the value is style dependent. \sa elideMode, QTabBar::usesScrollButtons, QStyle::SH_TabBar_PreferNoArrows */ diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index 78fde94fad..122a8529e8 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -916,7 +916,7 @@ void QTextBrowser::doSetSource(const QUrl &url, QTextDocument::ResourceType type being the new source. Source changes happen both programmatically when calling - setSource(), forward(), backword() or home() or when the user + setSource(), forward(), backward() or home() or when the user clicks on links or presses the equivalent key sequences. */ diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 087657ab85..66db5ccac7 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1662,6 +1662,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) break; #endif if (!m_completer->currentCompletion().isEmpty() && hasSelectedText() + && !m_completer->completionPrefix().isEmpty() && textAfterSelection().isEmpty()) { setText(m_completer->currentCompletion()); inlineCompletionAccepted = true; diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 6a5a77ddc6..ba9b6e0587 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -455,15 +455,20 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString // #### doc->documentLayout()->setPaintDevice(viewport); - QObject::connect(doc, SIGNAL(contentsChanged()), q, SLOT(_q_updateCurrentCharFormatAndSelection())); - QObject::connect(doc, SIGNAL(cursorPositionChanged(QTextCursor)), q, SLOT(_q_emitCursorPosChanged(QTextCursor))); - QObject::connect(doc, SIGNAL(documentLayoutChanged()), q, SLOT(_q_documentLayoutChanged())); + QObjectPrivate::connect(doc, &QTextDocument::contentsChanged, this, + &QWidgetTextControlPrivate::_q_updateCurrentCharFormatAndSelection); + QObjectPrivate::connect(doc, &QTextDocument::cursorPositionChanged, this, + &QWidgetTextControlPrivate::_q_emitCursorPosChanged); + QObjectPrivate::connect(doc, &QTextDocument::documentLayoutChanged, this, + &QWidgetTextControlPrivate::_q_documentLayoutChanged); // convenience signal forwards - QObject::connect(doc, SIGNAL(undoAvailable(bool)), q, SIGNAL(undoAvailable(bool))); - QObject::connect(doc, SIGNAL(redoAvailable(bool)), q, SIGNAL(redoAvailable(bool))); - QObject::connect(doc, SIGNAL(modificationChanged(bool)), q, SIGNAL(modificationChanged(bool))); - QObject::connect(doc, SIGNAL(blockCountChanged(int)), q, SIGNAL(blockCountChanged(int))); + QObject::connect(doc, &QTextDocument::undoAvailable, q, &QWidgetTextControl::undoAvailable); + QObject::connect(doc, &QTextDocument::redoAvailable, q, &QWidgetTextControl::redoAvailable); + QObject::connect(doc, &QTextDocument::modificationChanged, q, + &QWidgetTextControl::modificationChanged); + QObject::connect(doc, &QTextDocument::blockCountChanged, q, + &QWidgetTextControl::blockCountChanged); } bool previousUndoRedoState = doc->isUndoRedoEnabled(); @@ -525,7 +530,8 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString q->ensureCursorVisible(); emit q->cursorPositionChanged(); - QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), q, SLOT(_q_contentsChanged(int,int,int)), Qt::UniqueConnection); + QObjectPrivate::connect(doc, &QTextDocument::contentsChange, this, + &QWidgetTextControlPrivate::_q_contentsChanged, Qt::UniqueConnection); } void QWidgetTextControlPrivate::startDrag() @@ -705,10 +711,12 @@ void QWidgetTextControlPrivate::_q_documentLayoutChanged() { Q_Q(QWidgetTextControl); QAbstractTextDocumentLayout *layout = doc->documentLayout(); - QObject::connect(layout, SIGNAL(update(QRectF)), q, SIGNAL(updateRequest(QRectF))); - QObject::connect(layout, SIGNAL(updateBlock(QTextBlock)), q, SLOT(_q_updateBlock(QTextBlock))); - QObject::connect(layout, SIGNAL(documentSizeChanged(QSizeF)), q, SIGNAL(documentSizeChanged(QSizeF))); - + QObject::connect(layout, &QAbstractTextDocumentLayout::update, q, + &QWidgetTextControl::updateRequest); + QObjectPrivate::connect(layout, &QAbstractTextDocumentLayout::updateBlock, this, + &QWidgetTextControlPrivate::_q_updateBlock); + QObject::connect(layout, &QAbstractTextDocumentLayout::documentSizeChanged, q, + &QWidgetTextControl::documentSizeChanged); } void QWidgetTextControlPrivate::setCursorVisible(bool visible) @@ -939,6 +947,8 @@ void QWidgetTextControl::setTextCursor(const QTextCursor &cursor, bool selection #ifndef QT_NO_CLIPBOARD if (selectionClipboard) d->setClipboardSelection(); +#else + Q_UNUSED(selectionClipboard); #endif } diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h index 71dc988b56..3f756e7db5 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p.h @@ -277,13 +277,8 @@ protected: private: Q_DISABLE_COPY_MOVE(QWidgetTextControl) - Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentCharFormatAndSelection()) - Q_PRIVATE_SLOT(d_func(), void _q_emitCursorPosChanged(const QTextCursor &)) Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected()) Q_PRIVATE_SLOT(d_func(), void _q_copyLink()) - Q_PRIVATE_SLOT(d_func(), void _q_updateBlock(const QTextBlock &)) - Q_PRIVATE_SLOT(d_func(), void _q_documentLayoutChanged()) - Q_PRIVATE_SLOT(d_func(), void _q_contentsChanged(int, int, int)) }; |