diff options
author | Zhang Sheng <zhangsheng@uniontech.com> | 2020-11-16 11:19:17 +0800 |
---|---|---|
committer | Zhang Sheng <zhangsheng@uniontech.com> | 2020-11-16 12:53:37 +0000 |
commit | e13173c112b729da8f53dd2e81e8116a1ed857cf (patch) | |
tree | 49c2bce0c3349eebd0f2b62c80a1b7168ae45dc2 /src/widgets | |
parent | 802e5a45baf3ac7da2cb3be06d10bdd69696fcae (diff) |
Adjust code format, add space after 'if'
Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/widgets')
42 files changed, 187 insertions, 187 deletions
diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp index b9c3dbe912..962a56170a 100644 --- a/src/widgets/accessible/qaccessiblemenu.cpp +++ b/src/widgets/accessible/qaccessiblemenu.cpp @@ -86,7 +86,7 @@ int QAccessibleMenu::childCount() const QAccessibleInterface *QAccessibleMenu::childAt(int x, int y) const { QAction *act = menu()->actionAt(menu()->mapFromGlobal(QPoint(x,y))); - if(act && act->isSeparator()) + if (act && act->isSeparator()) act = nullptr; return act ? getOrCreateMenu(menu(), act) : nullptr; } diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 30c81f8c0e..9db8d5687c 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -460,19 +460,19 @@ void QWellArray::keyPressEvent(QKeyEvent* e) { switch(e->key()) { // Look at the key code case Qt::Key_Left: // If 'left arrow'-key, - if(curCol > 0) // and cr't not in leftmost col + if (curCol > 0) // and cr't not in leftmost col setCurrent(curRow, curCol - 1); // set cr't to next left column break; case Qt::Key_Right: // Correspondingly... - if(curCol < numCols()-1) + if (curCol < numCols()-1) setCurrent(curRow, curCol + 1); break; case Qt::Key_Up: - if(curRow > 0) + if (curRow > 0) setCurrent(curRow - 1, curCol); break; case Qt::Key_Down: - if(curRow < numRows()-1) + if (curRow < numRows()-1) setCurrent(curRow + 1, curCol); break; #if 0 @@ -1762,7 +1762,7 @@ void QColorDialogPrivate::initWidgets() QSize screenSize = QGuiApplication::screenAt(QCursor::pos())->availableGeometry().size(); pWidth = pHeight = qMin(screenSize.width(), screenSize.height()); pHeight -= 20; - if(screenSize.height() > screenSize.width()) + if (screenSize.height() > screenSize.width()) pWidth -= 20; #else pWidth = 150; diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 05ad24a287..34308573f3 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -1007,7 +1007,7 @@ void QFontDialog::done(int result) if (result == Accepted) { // We check if this is the same font we had before, if so we emit currentFontChanged QFont selectedFont = currentFont(); - if(selectedFont != d->selectedFont) + if (selectedFont != d->selectedFont) emit(currentFontChanged(selectedFont)); d->selectedFont = selectedFont; emit fontSelected(d->selectedFont); diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 5d267491fb..6c57a9a4af 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -2712,7 +2712,7 @@ QString QWizard::buttonText(WizardButton which) const return d->buttonCustomTexts.value(which); const QString defText = buttonDefaultText(d->wizStyle, which, d); - if(!defText.isNull()) + if (!defText.isNull()) return defText; return d->btns[which]->text(); diff --git a/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp b/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp index f269ad3f20..00830feb8a 100644 --- a/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp +++ b/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp @@ -61,7 +61,7 @@ int loadFileDialog() QFileDialog dialog; dialog.setSidebarUrls(urls); dialog.setFileMode(QFileDialog::AnyFile); - if(dialog.exec()) { + if (dialog.exec()) { // ... } //![0] diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index 2c8900327e..c23cfd7e44 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -353,17 +353,17 @@ static void convolute( int kernely = -kernelHeight/2; int starty = 0; int endy = kernelHeight; - if(yk+kernely+endy >= srcImage.height()) + if (yk+kernely+endy >= srcImage.height()) endy = kernelHeight-((yk+kernely+endy)-srcImage.height())-1; - if(yk+kernely < 0) + if (yk+kernely < 0) starty = -(yk+kernely); int kernelx = -kernelWidth/2; int startx = 0; int endx = kernelWidth; - if(xk+kernelx+endx >= srcImage.width()) + if (xk+kernelx+endx >= srcImage.width()) endx = kernelWidth-((xk+kernelx+endx)-srcImage.width())-1; - if(xk+kernelx < 0) + if (xk+kernelx < 0) startx = -(xk+kernelx); for (int ys = starty; ys < endy; ys ++) { @@ -385,7 +385,7 @@ static void convolute( b = qBound((int)0, b >> 16, (int)255); a = qBound((int)0, a >> 16, (int)255); // composition mode checking could be moved outside of loop - if(mode == QPainter::CompositionMode_Source) { + if (mode == QPainter::CompositionMode_Source) { uint color = (a<<24)+(r<<16)+(g<<8)+b; *output++ = color; } else { @@ -416,7 +416,7 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q if (!painter->isActive()) return; - if(d->kernelWidth<=0 || d->kernelHeight <= 0) + if (d->kernelWidth<=0 || d->kernelHeight <= 0) return; if (src.isNull()) diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h index fa47eecf79..d6edfec751 100644 --- a/src/widgets/graphicsview/qgraphicslayout_p.h +++ b/src/widgets/graphicsview/qgraphicslayout_p.h @@ -70,7 +70,7 @@ class QGraphicsWidget; inline bool qt_graphicsLayoutDebug() { static int checked_env = -1; - if(checked_env == -1) + if (checked_env == -1) checked_env = !!qEnvironmentVariableIntValue("QT_GRAPHICSLAYOUT_DEBUG"); return checked_env; } diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 74a7755ccf..7c7c094962 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -1754,7 +1754,7 @@ void QGraphicsView::setScene(QGraphicsScene *scene) QEvent windowDeactivate(QEvent::WindowDeactivate); QCoreApplication::sendEvent(d->scene, &windowDeactivate); } - if(hasFocus()) + if (hasFocus()) d->scene->clearFocus(); } diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index fbc616cc97..38fd4f1fcc 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2727,7 +2727,7 @@ void QAbstractItemView::updateEditorData() void QAbstractItemView::updateEditorGeometries() { Q_D(QAbstractItemView); - if(d->editorIndexHash.isEmpty()) + if (d->editorIndexHash.isEmpty()) return; if (d->delayedPendingLayout) { // doItemsLayout() will end up calling this function again diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index c02e5bd626..91afd3c7ed 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -79,7 +79,7 @@ void QSpanCollection::addSpan(QSpanCollection::Span *span) const SubIndex previousList = it_y.value(); for (Span *s : previousList) { //If a subspans intersect the row, we need to split it into subspans - if(s->bottom() >= span->top()) + if (s->bottom() >= span->top()) sub_index.insert(-s->left(), s); } } @@ -90,7 +90,7 @@ void QSpanCollection::addSpan(QSpanCollection::Span *span) //insert the span as supspan in all the lists that intesects the span while(-it_y.key() <= span->bottom()) { (*it_y).insert(-span->left(), span); - if(it_y == index.begin()) + if (it_y == index.begin()) break; --it_y; } @@ -112,7 +112,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list while (-it_y.key() <= span->bottom()) { (*it_y).insert(-span->left(), span); - if(it_y == index.begin()) + if (it_y == index.begin()) break; --it_y; } @@ -129,7 +129,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) it_y = index.erase(it_y); } } - if(it_y == index.begin()) + if (it_y == index.begin()) break; --it_y; } @@ -177,7 +177,7 @@ QSet<QSpanCollection::Span *> QSpanCollection::spansInRect(int x, int y, int w, { QSet<Span *> list; Index::const_iterator it_y = index.lowerBound(-y); - if(it_y == index.end()) + if (it_y == index.end()) --it_y; while(-it_y.key() <= y + h) { SubIndex::const_iterator it_x = (*it_y).lowerBound(-x); @@ -191,7 +191,7 @@ QSet<QSpanCollection::Span *> QSpanCollection::spansInRect(int x, int y, int w, break; --it_x; } - if(it_y == index.begin()) + if (it_y == index.begin()) break; --it_y; } diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 502d64eaf6..c0b0ee4f2d 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -616,7 +616,7 @@ void QTreeView::setRowHidden(int row, const QModelIndex &parent, bool hide) if (hide) { d->hiddenIndexes.insert(index); - } else if(d->isPersistent(index)) { //if the index is not persistent, it cannot be in the set + } else if (d->isPersistent(index)) { //if the index is not persistent, it cannot be in the set d->hiddenIndexes.remove(index); } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index d4f6672eba..97753b6af4 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -421,7 +421,7 @@ void QApplicationPrivate::process_cmdline() } } - if(j < argc) { + if (j < argc) { argv[j] = nullptr; argc = j; } @@ -1512,7 +1512,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) QWidget *prev = focus_widget; focus_widget = focus; - if(focus_widget) + if (focus_widget) focus_widget->d_func()->setFocus_sys(); if (reason != Qt::NoFocusReason) { @@ -1531,7 +1531,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) if (that) QCoreApplication::sendEvent(that->style(), &out); } - if(focus && QApplicationPrivate::focus_widget == focus) { + if (focus && QApplicationPrivate::focus_widget == focus) { QFocusEvent in(QEvent::FocusIn, reason); QPointer<QWidget> that = focus; QCoreApplication::sendEvent(focus, &in); diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index 5137b7ef07..b725485948 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -481,7 +481,7 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original) void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture) { QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture); - if(!recognizer) //The Gesture is removed while in the even loop, so the recognizers for this gestures was removed + if (!recognizer) //The Gesture is removed while in the even loop, so the recognizers for this gestures was removed return; m_deletedRecognizers.remove(gesture); if (m_deletedRecognizers.keys(recognizer).isEmpty()) { diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 6dce2da969..db7aa1aaeb 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -744,7 +744,7 @@ bool QLayout::adoptLayout(QLayout *layout) static bool layoutDebug() { static int checked_env = -1; - if(checked_env == -1) + if (checked_env == -1) checked_env = !!qEnvironmentVariableIntValue("QT_LAYOUT_DEBUG"); return checked_env; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 4cc24499fc..e0afbb938a 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1559,7 +1559,7 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier mapper->insert(data.winid, q); } - if(oldWinId != id) { + if (oldWinId != id) { QEvent e(QEvent::WinIdChange); QCoreApplication::sendEvent(q, &e); } @@ -1906,8 +1906,8 @@ QRegion QWidgetPrivate::clipRegion() const while(w->d_func()->children.at(i++) != static_cast<const QObject *>(ignoreUpTo)) ; for ( ; i < w->d_func()->children.size(); ++i) { - if(QWidget *sibling = qobject_cast<QWidget *>(w->d_func()->children.at(i))) { - if(sibling->isVisible() && !sibling->isWindow()) { + if (QWidget *sibling = qobject_cast<QWidget *>(w->d_func()->children.at(i))) { + if (sibling->isVisible() && !sibling->isWindow()) { QRect siblingRect(ox+sibling->x(), oy+sibling->y(), sibling->width(), sibling->height()); if (qRectIntersects(siblingRect, q->rect())) @@ -3119,7 +3119,7 @@ void QWidget::insertAction(QAction *before, QAction *action) } Q_D(QWidget); - if(d->actions.contains(action)) + if (d->actions.contains(action)) removeAction(action); int pos = d->actions.indexOf(before); @@ -6680,7 +6680,7 @@ QWidget *QWidget::previousInFocusChain() const bool QWidget::isActiveWindow() const { QWidget *tlw = window(); - if(tlw == QApplication::activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup))) + if (tlw == QApplication::activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup))) return true; #if QT_CONFIG(graphicsview) @@ -6691,7 +6691,7 @@ bool QWidget::isActiveWindow() const #endif if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, this)) { - if(tlw->windowType() == Qt::Tool && + if (tlw->windowType() == Qt::Tool && !tlw->isModal() && (!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow())) return true; @@ -6699,7 +6699,7 @@ bool QWidget::isActiveWindow() const while(w && tlw->windowType() == Qt::Tool && !w->isModal() && w->parentWidget()) { w = w->parentWidget()->window(); - if(w == tlw) + if (w == tlw) return true; } } @@ -6842,7 +6842,7 @@ void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw) if (oldtlw == q->window()) return; // nothing to do - if(focus_child) + if (focus_child) focus_child->clearFocus(); // separate the focus chain into new (children of myself) and old (the rest) @@ -9879,7 +9879,7 @@ void QWidget::ensurePolished() const QList<QObject*> children = d->children; for (int i = 0; i < children.size(); ++i) { QObject *o = children.at(i); - if(!o->isWidgetType()) + if (!o->isWidgetType()) continue; if (QWidget *w = qobject_cast<QWidget *>(o)) w->ensurePolished(); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 9f5ba27e9e..c88d63686c 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -626,7 +626,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) QWidget *receiver = activePopupWidget; if (qt_button_down) receiver = qt_button_down; - else if(popupChild) + else if (popupChild) receiver = popupChild; QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPosition().toPoint(), event->modifiers()); QApplication::forwardEvent(receiver, &e, event); diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index bcddd452cd..fad02d5ae9 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1824,22 +1824,22 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, switch (tab->shape) { case QTabBar::TriangularNorth: rect.adjust(0, 0, 0, -tabOverlap); - if(!selected) + if (!selected) rect.adjust(1, 1, -1, 0); break; case QTabBar::TriangularSouth: rect.adjust(0, tabOverlap, 0, 0); - if(!selected) + if (!selected) rect.adjust(1, 0, -1, -1); break; case QTabBar::TriangularEast: rect.adjust(tabOverlap, 0, 0, 0); - if(!selected) + if (!selected) rect.adjust(0, 1, -1, -1); break; case QTabBar::TriangularWest: rect.adjust(0, 0, -tabOverlap, 0); - if(!selected) + if (!selected) rect.adjust(1, 1, 0, -1); break; default: @@ -4699,7 +4699,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid || tb->shape == QTabBar::RoundedWest || tb->shape == QTabBar::RoundedEast)) ret = 8; else - if(tb && (tb->shape == QTabBar::TriangularWest || tb->shape == QTabBar::TriangularEast)) + if (tb && (tb->shape == QTabBar::TriangularWest || tb->shape == QTabBar::TriangularEast)) ret = 3; else ret = 2; @@ -5191,7 +5191,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_FocusFrame_Mask: ret = 1; if (widget) { - if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { + if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { mask->region = widget->rect(); const int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt); const int hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt); @@ -5205,7 +5205,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = 0; if (rbOpt->shape == QRubberBand::Rectangle) { ret = true; - if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { + if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { mask->region = opt->rect; const int margin = proxy()->pixelMetric(PM_DefaultFrameWidth, opt) * 2; mask->region -= opt->rect.adjusted(margin, margin, -margin, -margin); diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index 54a399ed39..87a8000ce0 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -109,7 +109,7 @@ QStyle *QStyleFactory::create(const QString& key) { } // Keep these here - they make the #ifdefery above work if (!ret) ret = qLoadPlugin<QStyle, QStylePlugin>(loader(), style); - if(ret) + if (ret) ret->setObjectName(style); return ret; } diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index 5b771c6fba..d8e0495b37 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -385,7 +385,7 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec QRect(left, 0, size.width() -right - left, top)); //top-left - if(left > 0) + if (left > 0) painter->drawPixmap(QRect(rect.left(), rect.top(), left, top), pixmap, QRect(0, 0, left, top)); diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 407134298b..a4d41566ee 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3922,7 +3922,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q ParentStyle::drawControl(ce, opt, p, w); return; } - if(hasStyleRule(w, PseudoElement_HeaderViewSection)) { + if (hasStyleRule(w, PseudoElement_HeaderViewSection)) { QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); if (!subRule.hasNativeBorder() || !subRule.baseStyleCanDraw() || subRule.hasBackground() || subRule.hasPalette() || subRule.hasFont || subRule.hasBorder()) { @@ -4490,7 +4490,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op Q_FALLTHROUGH(); case PE_PanelMenu: case PE_PanelStatusBar: - if(rule.hasDrawable()) { + if (rule.hasDrawable()) { rule.drawRule(p, opt->rect); return; } @@ -4891,7 +4891,7 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const break; case PM_ScrollView_ScrollBarSpacing: - if(!rule.hasNativeBorder() || rule.hasBox()) + if (!rule.hasNativeBorder() || rule.hasBox()) return 0; break; #endif // QT_CONFIG(scrollbar) @@ -5058,7 +5058,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op case CT_ComboBox: case CT_PushButton: if (rule.hasBox() || !rule.hasNativeBorder()) { - if(ct == CT_ComboBox) { + if (ct == CT_ComboBox) { //add some space for the drop down. QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown); QRect comboRect = positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, opt->rect, opt->direction); diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 02188c5b29..ec252d9293 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -267,7 +267,7 @@ void QWindowsStyle::polish(QApplication *app) d->inactiveCaptionText = palette.window().color(); #if defined(Q_OS_WIN) //fetch native title bar colors - if(app->desktopSettingsAware()){ + if (app->desktopSettingsAware()){ DWORD activeCaption = GetSysColor(COLOR_ACTIVECAPTION); DWORD gradientActiveCaption = GetSysColor(COLOR_GRADIENTACTIVECAPTION); DWORD inactiveCaption = GetSysColor(COLOR_INACTIVECAPTION); @@ -630,7 +630,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid ret = 0; if (rbOpt->shape == QRubberBand::Rectangle) { ret = true; - if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(returnData)) { + if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(returnData)) { mask->region = opt->rect; int size = 1; if (widget && widget->isWindow()) @@ -673,7 +673,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QRect rect = opt->rect; const int margin = 2; QPen oldPen = p->pen(); - if(opt->state & State_Horizontal){ + if (opt->state & State_Horizontal){ const int offset = rect.width()/2; p->setPen(QPen(opt->palette.dark().color())); p->drawLine(rect.bottomLeft().x() + offset, @@ -758,7 +758,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, if (opt->state & (State_Raised | State_Sunken | State_On)) { if (opt->state & State_AutoRaise) { - if(opt->state & (State_Enabled | State_Sunken | State_On)){ + if (opt->state & (State_Enabled | State_Sunken | State_On)){ if (panel) qDrawShadePanel(p, opt->rect, opt->palette, opt->state & (State_Sunken | State_On), 1, &fill); @@ -1618,7 +1618,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai default: break; } - if(opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end + if (opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end bool tmp = paintLeftBorder; paintRightBorder=paintLeftBorder; paintLeftBorder=tmp; @@ -1733,7 +1733,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai int myHeight = pbBits.rect.height(); int chunksToDraw = chunksInRow; - if(step > chunkCount - 5)chunksToDraw = (chunkCount - step); + if (step > chunkCount - 5)chunksToDraw = (chunkCount - step); p->save(); p->setClipRect(m.mapRect(QRectF(rect)).toRect()); @@ -1747,7 +1747,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai x += reverse ? -unit_width : unit_width; } //Draw wrap-around chunks - if( step > chunkCount-5){ + if ( step > chunkCount-5){ x0 = reverse ? rect.left() + rect.width() - unit_width : rect.left() ; x = 0; int chunksToDraw = step - (chunkCount - chunksInRow); diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index abd49237a6..c9fcd587cd 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -690,7 +690,7 @@ void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow) void QBalloonTip::mousePressEvent(QMouseEvent *e) { close(); - if(e->button() == Qt::LeftButton) + if (e->button() == Qt::LeftButton) emit trayIcon->messageClicked(); } diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 2d92270eb7..fc01354046 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -1048,8 +1048,8 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) } if (d->spinClickTimerId == -1) stepBy(steps); - if(event->isAutoRepeat() && !isPgUpOrDown) { - if(d->spinClickThresholdTimerId == -1 && d->spinClickTimerId == -1) { + if (event->isAutoRepeat() && !isPgUpOrDown) { + if (d->spinClickThresholdTimerId == -1 && d->spinClickTimerId == -1) { d->updateState(up, true); } } diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 6a4abc2113..e9774aa556 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -1142,7 +1142,7 @@ QTextCharFormat QCalendarModel::formatForCell(int row, int col) const if (!header) { QDate date = dateForCell(row, col); format.merge(m_dateFormats.value(date)); - if(date < m_minimumDate || date > m_maximumDate) + if (date < m_minimumDate || date > m_maximumDate) format.setBackground(pal.brush(cg, QPalette::Window)); if (m_shownMonth != date.month(m_calendar)) format.setForeground(pal.brush(QPalette::Disabled, QPalette::Text)); @@ -1158,7 +1158,7 @@ QVariant QCalendarModel::data(const QModelIndex &index, int role) const int row = index.row(); int column = index.column(); - if(role == Qt::DisplayRole) { + if (role == Qt::DisplayRole) { if (m_weekNumbersShown && column == HeaderColumn && row >= m_firstRow && row < m_firstRow + RowCount) { QDate date = dateForCell(row, columnForDayOfWeek(Qt::Monday)); @@ -3165,7 +3165,7 @@ void QCalendarWidget::resizeEvent(QResizeEvent * event) // XXX Should really use a QWidgetStack for yearEdit and yearButton, // XXX here we hide the year edit when the layout is likely to break // XXX the manual positioning of the yearEdit over the yearButton. - if(d->yearEdit->isVisible() && event->size().width() != event->oldSize().width()) + if (d->yearEdit->isVisible() && event->size().width() != event->oldSize().width()) d->_q_yearEditingFinished(); QWidget::resizeEvent(event); diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp index aa9de7c35f..47ac8a5568 100644 --- a/src/widgets/widgets/qfocusframe.cpp +++ b/src/widgets/widgets/qfocusframe.cpp @@ -95,7 +95,7 @@ void QFocusFramePrivate::updateSize() pos = widget->parentWidget()->mapTo(q->parentWidget(), pos); QRect geom(pos.x()-hmargin, pos.y()-vmargin, widget->width()+(hmargin*2), widget->height()+(vmargin*2)); - if(q->geometry() == geom) + if (q->geometry() == geom) return; q->setGeometry(geom); @@ -279,7 +279,7 @@ bool QFocusFrame::eventFilter(QObject *o, QEvent *e) { Q_D(QFocusFrame); - if(o == d->widget) { + if (o == d->widget) { switch(e->type()) { case QEvent::Move: case QEvent::Resize: diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index b03235bbef..e124022e52 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -591,7 +591,7 @@ void QLabel::setMargin(int margin) QSize QLabelPrivate::sizeForWidth(int w) const { Q_Q(const QLabel); - if(q->minimumWidth() > 0) + if (q->minimumWidth() > 0) w = qMax(w, q->minimumWidth()); QSize contentsMargin(leftmargin + rightmargin, topmargin + bottommargin); @@ -1429,7 +1429,7 @@ void QLabel::setTextFormat(Qt::TextFormat format) void QLabel::changeEvent(QEvent *ev) { Q_D(QLabel); - if(ev->type() == QEvent::FontChange || ev->type() == QEvent::ApplicationFontChange) { + if (ev->type() == QEvent::FontChange || ev->type() == QEvent::ApplicationFontChange) { if (d->isTextLabel) { if (d->control) d->control->document()->setDefaultFont(font()); diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 9f1f00ced7..4a877c7596 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1901,7 +1901,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) d->control->setBlinkingCursorEnabled(true); QStyleOptionFrame opt; initStyleOption(&opt); - if((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) + if ((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)) d->setCursorVisible(true); #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 8aa2c24592..982638fa38 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -761,7 +761,7 @@ void QMainWindow::addToolBar(Qt::ToolBarArea area, QToolBar *toolbar) disconnect(this, SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)), toolbar, SLOT(_q_updateToolButtonStyle(Qt::ToolButtonStyle))); - if(toolbar->d_func()->state && toolbar->d_func()->state->dragging) { + if (toolbar->d_func()->state && toolbar->d_func()->state->dragging) { //removing a toolbar which is dragging will cause crash #if QT_CONFIG(dockwidget) bool animated = isAnimated(); diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 782c20660a..95988d2bfa 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -723,7 +723,7 @@ void QMdiAreaPrivate::_q_deactivateAllWindows(QMdiSubWindow *aboutToActivate) continue; // We don't want to handle signals caused by child->showNormal(). ignoreWindowStateChange = true; - if(!(options & QMdiArea::DontMaximizeSubWindowOnActivation) && !showActiveWindowMaximized) + if (!(options & QMdiArea::DontMaximizeSubWindowOnActivation) && !showActiveWindowMaximized) showActiveWindowMaximized = child->isMaximized() && child->isVisible(); if (showActiveWindowMaximized && child->isMaximized()) { if (q->updatesEnabled()) { diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index aa04873f63..4a6c51383d 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -154,7 +154,7 @@ public: void syncWithMenu(QMenu *menu, QActionEvent *act) { Q_D(QTornOffMenu); - if(menu != d->causedMenu) + if (menu != d->causedMenu) return; auto action = static_cast<QAction *>(act->action()); if (act->type() == QEvent::ActionAdded) { @@ -648,7 +648,7 @@ void QMenuPrivate::setSyncAction() { Q_Q(QMenu); QAction *current = currentAction; - if(current && (!current->isEnabled() || current->menu() || current->isSeparator())) + if (current && (!current->isEnabled() || current->menu() || current->isSeparator())) current = nullptr; for(QWidget *caused = q; caused;) { if (QMenu *m = qobject_cast<QMenu*>(caused)) { @@ -1122,7 +1122,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc break; } } - if(newOffset) + if (newOffset) newOffset -= fw * 2; } @@ -1158,9 +1158,9 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc QRect geom = q->geometry(); if (newOffset > scroll->scrollOffset && (scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollUp)) { //scroll up const int newHeight = geom.height()-(newOffset-scroll->scrollOffset); - if(newHeight > geom.height()) + if (newHeight > geom.height()) geom.setHeight(newHeight); - } else if(scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollDown) { + } else if (scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollDown) { int newTop = geom.top() + (newOffset-scroll->scrollOffset); if (newTop < desktopFrame+screen.top()) newTop = desktopFrame+screen.top(); @@ -1209,7 +1209,7 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ { Q_Q(QMenu); updateActionRects(); - if(location == QMenuScroller::ScrollBottom) { + if (location == QMenuScroller::ScrollBottom) { for(int i = actions.size()-1; i >= 0; --i) { QAction *act = actions.at(i); if (actionRects.at(i).isNull()) @@ -1217,14 +1217,14 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ if (!act->isSeparator() && (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q) || act->isEnabled())) { - if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) + if (scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollBottom, active); - else if(active) + else if (active) setCurrentAction(act, /*popup*/-1, QMenuPrivate::SelectedFromKeyboard); break; } } - } else if(location == QMenuScroller::ScrollTop) { + } else if (location == QMenuScroller::ScrollTop) { for(int i = 0; i < actions.size(); ++i) { QAction *act = actions.at(i); if (actionRects.at(i).isNull()) @@ -1232,9 +1232,9 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ if (!act->isSeparator() && (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q) || act->isEnabled())) { - if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) + if (scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollTop, active); - else if(active) + else if (active) setCurrentAction(act, /*popup*/-1, QMenuPrivate::SelectedFromKeyboard); break; } @@ -1281,7 +1281,7 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollDirection direction, bool pag break; } } - if(!scrolled) { + if (!scrolled) { scroll->scrollFlags &= ~QMenuScroller::ScrollDown; q->update(); } @@ -1382,7 +1382,7 @@ void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget>> &causedSta QAction::ActionEvent action_e, bool self) { QBoolBlocker guard(activationRecursionGuard); - if(self) + if (self) action->activate(action_e); for(int i = 0; i < causedStack.size(); ++i) { @@ -1439,7 +1439,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e } else { for(QWidget *widget = QApplication::activePopupWidget(); widget; ) { if (QMenu *qmenu = qobject_cast<QMenu*>(widget)) { - if(qmenu == q) + if (qmenu == q) hideUpToMenuBar(); widget = qmenu->d_func()->causedPopup.widget; } else { @@ -2518,7 +2518,7 @@ void QMenuPrivate::popup(const QPoint &p, QAction *atAction, PositionFunction po pos.setX(screen.left() + desktopFrame); } if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) { - if(snapToMouse) + if (snapToMouse) pos.setY(qMin(mouse.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1)); else pos.setY(qMax(p.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1)); @@ -3133,7 +3133,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) case Qt::Key_PageUp: key_consumed = true; if (d->currentAction && d->scroll) { - if(d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) + if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollUp, true, true); else d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollTop, true); @@ -3142,7 +3142,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) case Qt::Key_PageDown: key_consumed = true; if (d->currentAction && d->scroll) { - if(d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) + if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollDown, true, true); else d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollBottom, true); @@ -3154,7 +3154,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) QAction *nextAction = nullptr; QMenuPrivate::QMenuScroller::ScrollLocation scroll_loc = QMenuPrivate::QMenuScroller::ScrollStay; if (!d->currentAction) { - if(key == Qt::Key_Down) { + if (key == Qt::Key_Down) { for(int i = 0; i < d->actions.count(); ++i) { QAction *act = d->actions.at(i); if (d->actionRects.at(i).isNull()) @@ -3387,10 +3387,10 @@ void QMenu::keyPressEvent(QKeyEvent *e) QAction *act = d->actions.at(i); const QString act_text = act->text(); for(int c = 0; c < d->searchBuffer.size(); ++c) { - if(act_text.indexOf(d->searchBuffer.at(c), 0, Qt::CaseInsensitive) != -1) + if (act_text.indexOf(d->searchBuffer.at(c), 0, Qt::CaseInsensitive) != -1) ++match_count; } - if(match_count > best_match_count) { + if (match_count > best_match_count) { best_match_count = match_count; nextAction = act; } @@ -3429,7 +3429,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) #endif if (nextAction) { key_consumed = true; - if(d->scroll) + if (d->scroll) d->scrollMenu(nextAction, QMenuPrivate::QMenuScroller::ScrollCenter, false); d->setCurrentAction(nextAction, 0, QMenuPrivate::SelectedFromElsewhere, true); if (!nextAction->menu() && activateAction) { @@ -3540,7 +3540,7 @@ QMenu::timerEvent(QTimerEvent *e) internalDelayedPopup(); } else if (d->sloppyState.isTimerId(e->timerId())) { d->sloppyState.timeout(); - } else if(d->searchBufferTimer.timerId() == e->timerId()) { + } else if (d->searchBufferTimer.timerId() == e->timerId()) { d->searchBuffer.clear(); } } diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 5fd84f7f3b..f92a975455 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -115,7 +115,7 @@ QSize QMenuBarExtension::sizeHint() const QAction *QMenuBarPrivate::actionAt(QPoint p) const { for(int i = 0; i < actions.size(); ++i) { - if(actionRect(actions.at(i)).contains(p)) + if (actionRect(actions.at(i)).contains(p)) return actions.at(i); } return nullptr; @@ -163,11 +163,11 @@ bool QMenuBarPrivate::isVisible(QAction *action) void QMenuBarPrivate::updateGeometries() { Q_Q(QMenuBar); - if(!itemsDirty) + if (!itemsDirty) return; int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q)*2); int q_start = -1; - if(leftWidget || rightWidget) { + if (leftWidget || rightWidget) { int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, q) + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q); int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, q) @@ -190,7 +190,7 @@ void QMenuBarPrivate::updateGeometries() } #ifdef Q_OS_MAC - if(q->isNativeMenuBar()) {//nothing to see here folks, move along.. + if (q->isNativeMenuBar()) {//nothing to see here folks, move along.. itemsDirty = false; return; } @@ -198,7 +198,7 @@ void QMenuBarPrivate::updateGeometries() calcActionRects(q_width, q_start); currentAction = nullptr; #ifndef QT_NO_SHORTCUT - if(itemsDirty) { + if (itemsDirty) { for(int j = 0; j < shortcutIndexMap.size(); ++j) q->releaseShortcut(shortcutIndexMap.value(j)); shortcutIndexMap.clear(); @@ -271,7 +271,7 @@ QRect QMenuBarPrivate::actionRect(QAction *act) const void QMenuBarPrivate::focusFirstAction() { - if(!currentAction) { + if (!currentAction) { updateGeometries(); int index = 0; while (index < actions.count() && actionRects.at(index).isNull()) ++index; @@ -288,16 +288,16 @@ void QMenuBarPrivate::setKeyboardMode(bool b) return; } keyboardState = b; - if(b) { + if (b) { QWidget *fw = QApplication::focusWidget(); if (fw && fw != q && fw->window() != QApplication::activePopupWidget()) keyboardFocusWidget = fw; focusFirstAction(); q->setFocus(Qt::MenuBarFocusReason); } else { - if(!popupState) + if (!popupState) setCurrentAction(nullptr); - if(keyboardFocusWidget) { + if (keyboardFocusWidget) { if (QApplication::focusWidget() == q) keyboardFocusWidget->setFocus(Qt::MenuBarFocusReason); keyboardFocusWidget = nullptr; @@ -309,7 +309,7 @@ void QMenuBarPrivate::setKeyboardMode(bool b) void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) { Q_Q(QMenuBar); - if(!action || !action->menu() || closePopupMode) + if (!action || !action->menu() || closePopupMode) return; popupState = true; if (action->isEnabled() && action->menu()->isEnabled()) { @@ -351,11 +351,11 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) pos.rx() += actionWidth; } - if(!defaultPopDown || (fitUp && !fitDown)) + if (!defaultPopDown || (fitUp && !fitDown)) pos.setY(qMax(screenRect.y(), q->mapToGlobal(QPoint(0, adjustedActionRect.top()-popup_size.height())).y())); QMenuPrivate::get(activeMenu)->topData()->initialScreen = popupScreen; activeMenu->popup(pos); - if(activateFirst) + if (activateFirst) activeMenu->d_func()->setFirstActionActive(); } q->update(actionRect(action)); @@ -363,7 +363,7 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activateFirst) { - if(currentAction == action && popup == popupState) + if (currentAction == action && popup == popupState) return; autoReleaseTimer.stop(); @@ -371,7 +371,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat doChildEffects = (popup && !activeMenu); Q_Q(QMenuBar); QWidget *fw = nullptr; - if(QMenu *menu = activeMenu) { + if (QMenu *menu = activeMenu) { activeMenu = nullptr; if (popup) { fw = q->window()->focusWidget(); @@ -380,7 +380,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat menu->hide(); } - if(currentAction) + if (currentAction) q->update(actionRect(currentAction)); popupState = popup; @@ -390,7 +390,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat currentAction = action; if (action && action->isEnabled()) { activateAction(action, QAction::Hover); - if(popup) + if (popup) popupAction(action, activateFirst); q->update(actionRect(action)); #if QT_CONFIG(statustip) @@ -408,7 +408,7 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const { Q_Q(const QMenuBar); - if(!itemsDirty) + if (!itemsDirty) return; //let's reinitialize the buffer @@ -427,13 +427,13 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const icone = style->pixelMetric(QStyle::PM_SmallIconSize, nullptr, q); for(int i = 0; i < actions.count(); i++) { QAction *action = actions.at(i); - if(!action->isVisible()) + if (!action->isVisible()) continue; QSize sz; //calc what I think the size is.. - if(action->isSeparator()) { + if (action->isSeparator()) { if (style->styleHint(QStyle::SH_DrawMenuBarSeparator, nullptr, q)) separator = i; continue; //we don't really position these! @@ -452,10 +452,10 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const q->initStyleOption(&opt, action); sz = q->style()->sizeFromContents(QStyle::CT_MenuBarItem, &opt, sz, q); - if(!sz.isEmpty()) { + if (!sz.isEmpty()) { { //update the separator state int iWidth = sz.width() + itemSpacing; - if(separator == -1) + if (separator == -1) separator_start += iWidth; else separator_len += iWidth; @@ -480,9 +480,9 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const rect.setHeight(max_item_height); //move - if(separator != -1 && i >= separator) { //after the separator + if (separator != -1 && i >= separator) { //after the separator int left = (max_width - separator_len - hmargin - itemSpacing) + (x - separator_start - hmargin); - if(left < separator_start) { //wrap + if (left < separator_start) { //wrap separator_start = x = hmargin; y += max_item_height; } @@ -509,9 +509,9 @@ void QMenuBarPrivate::activateAction(QAction *action, QAction::ActionEvent actio if (action_e == QAction::Hover) action->showStatusText(q); -// if(action_e == QAction::Trigger) +// if (action_e == QAction::Trigger) // emit q->activated(action); -// else if(action_e == QAction::Hover) +// else if (action_e == QAction::Hover) // emit q->highlighted(action); } @@ -989,7 +989,7 @@ void QMenuBar::paintEvent(QPaintEvent *e) QRect adjustedActionRect = d->actionRect(action); if (adjustedActionRect.isEmpty() || !d->isVisible(action)) continue; - if(!e->rect().intersects(adjustedActionRect)) + if (!e->rect().intersects(adjustedActionRect)) continue; emptyArea -= adjustedActionRect; @@ -1046,7 +1046,7 @@ void QMenuBar::setVisible(bool visible) void QMenuBar::mousePressEvent(QMouseEvent *e) { Q_D(QMenuBar); - if(e->button() != Qt::LeftButton) + if (e->button() != Qt::LeftButton) return; d->mouseDown = true; @@ -1061,8 +1061,8 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) return; } - if(d->currentAction == action && d->popupState) { - if(QMenu *menu = d->activeMenu) { + if (d->currentAction == action && d->popupState) { + if (QMenu *menu = d->activeMenu) { d->activeMenu = nullptr; menu->setAttribute(Qt::WA_NoMouseReplay); menu->hide(); @@ -1078,7 +1078,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) void QMenuBar::mouseReleaseEvent(QMouseEvent *e) { Q_D(QMenuBar); - if(e->button() != Qt::LeftButton || !d->mouseDown) + if (e->button() != Qt::LeftButton || !d->mouseDown) return; d->mouseDown = false; @@ -1087,11 +1087,11 @@ void QMenuBar::mouseReleaseEvent(QMouseEvent *e) // do noting if the action is hidden if (!d->isVisible(action)) return; - if((d->closePopupMode && action == d->currentAction) || !action || !action->menu()) { + if ((d->closePopupMode && action == d->currentAction) || !action || !action->menu()) { //we set the current action before activating //so that we let the leave event set the current back to 0 d->setCurrentAction(action, false); - if(action) + if (action) d->activateAction(action, QAction::Trigger); } d->closePopupMode = 0; @@ -1105,15 +1105,15 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) Q_D(QMenuBar); d->updateGeometries(); int key = e->key(); - if(isRightToLeft()) { // in reverse mode open/close key for submenues are reversed - if(key == Qt::Key_Left) + if (isRightToLeft()) { // in reverse mode open/close key for submenues are reversed + if (key == Qt::Key_Left) key = Qt::Key_Right; - else if(key == Qt::Key_Right) + else if (key == Qt::Key_Right) key = Qt::Key_Left; } - if(key == Qt::Key_Tab) //means right + if (key == Qt::Key_Tab) //means right key = Qt::Key_Right; - else if(key == Qt::Key_Backtab) //means left + else if (key == Qt::Key_Backtab) //means left key = Qt::Key_Left; bool key_consumed = false; @@ -1125,9 +1125,9 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) case Qt::Key_Return: { if (!style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, this) || !d->currentAction) break; - if(d->currentAction->menu()) { + if (d->currentAction->menu()) { d->popupAction(d->currentAction, true); - } else if(key == Qt::Key_Enter || key == Qt::Key_Return || key == Qt::Key_Space) { + } else if (key == Qt::Key_Enter || key == Qt::Key_Return || key == Qt::Key_Space) { d->activateAction(d->currentAction, QAction::Trigger); d->setCurrentAction(d->currentAction, false); d->setKeyboardMode(false); @@ -1137,7 +1137,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) case Qt::Key_Right: case Qt::Key_Left: { - if(d->currentAction) { + if (d->currentAction) { int index = d->actions.indexOf(d->currentAction); if (QAction *nextAction = d->getNextAction(index, key == Qt::Key_Left ? -1 : +1)) { d->setCurrentAction(nextAction, d->popupState, true); @@ -1158,7 +1158,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) } #endif - if(!key_consumed && + if (!key_consumed && (!e->modifiers() || (e->modifiers()&(Qt::MetaModifier|Qt::AltModifier))) && e->text().length()==1 && !d->popupState) { int clashCount = 0; @@ -1170,14 +1170,14 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) continue; QAction *act = d->actions.at(i); QString s = act->text(); - if(!s.isEmpty()) { + if (!s.isEmpty()) { int ampersand = s.indexOf(QLatin1Char('&')); - if(ampersand >= 0) { - if(s[ampersand+1].toUpper() == c) { + if (ampersand >= 0) { + if (s[ampersand+1].toUpper() == c) { clashCount++; - if(!first) + if (!first) first = act; - if(act == d->currentAction) + if (act == d->currentAction) currentSelected = act; else if (!firstAfterCurrent && currentSelected) firstAfterCurrent = act; @@ -1187,18 +1187,18 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) } } QAction *next_action = nullptr; - if(clashCount >= 1) { - if(clashCount == 1 || !d->currentAction || (currentSelected && !firstAfterCurrent)) + if (clashCount >= 1) { + if (clashCount == 1 || !d->currentAction || (currentSelected && !firstAfterCurrent)) next_action = first; else next_action = firstAfterCurrent; } - if(next_action) { + if (next_action) { key_consumed = true; d->setCurrentAction(next_action, true, true); } } - if(key_consumed) + if (key_consumed) e->accept(); else e->ignore(); @@ -1231,7 +1231,7 @@ void QMenuBar::mouseMoveEvent(QMouseEvent *e) void QMenuBar::leaveEvent(QEvent *) { Q_D(QMenuBar); - if((!hasFocus() && !d->popupState) || + if ((!hasFocus() && !d->popupState) || (d->currentAction && d->currentAction->menu() == nullptr)) d->setCurrentAction(nullptr); } @@ -1322,10 +1322,10 @@ void QMenuBar::actionEvent(QActionEvent *e) } } - if(e->type() == QEvent::ActionAdded) { + if (e->type() == QEvent::ActionAdded) { connect(e->action(), SIGNAL(triggered()), this, SLOT(_q_actionTriggered())); connect(e->action(), SIGNAL(hovered()), this, SLOT(_q_actionHovered())); - } else if(e->type() == QEvent::ActionRemoved) { + } else if (e->type() == QEvent::ActionRemoved) { e->action()->disconnect(this); } // updateGeometries() is also needed for native menu bars because @@ -1342,7 +1342,7 @@ void QMenuBar::actionEvent(QActionEvent *e) void QMenuBar::focusInEvent(QFocusEvent *) { Q_D(QMenuBar); - if(d->keyboardState) + if (d->keyboardState) d->focusFirstAction(); } @@ -1352,7 +1352,7 @@ void QMenuBar::focusInEvent(QFocusEvent *) void QMenuBar::focusOutEvent(QFocusEvent *) { Q_D(QMenuBar); - if(!d->popupState) { + if (!d->popupState) { d->setCurrentAction(nullptr); d->setKeyboardMode(false); } @@ -1431,10 +1431,10 @@ void QMenuBarPrivate::handleReparent() void QMenuBar::changeEvent(QEvent *e) { Q_D(QMenuBar); - if(e->type() == QEvent::StyleChange) { + if (e->type() == QEvent::StyleChange) { d->itemsDirty = true; setMouseTracking(style()->styleHint(QStyle::SH_MenuBar_MouseTracking, nullptr, this)); - if(parentWidget()) + if (parentWidget()) resize(parentWidget()->width(), heightForWidth(parentWidget()->width())); d->updateGeometries(); } else if (e->type() == QEvent::ParentChange) { @@ -1458,12 +1458,12 @@ bool QMenuBar::event(QEvent *e) case QEvent::KeyPress: { QKeyEvent *ke = (QKeyEvent*)e; #if 0 - if(!d->keyboardState) { //all keypresses.. + if (!d->keyboardState) { //all keypresses.. d->setCurrentAction(0); return ; } #endif - if(ke->key() == Qt::Key_Tab || ke->key() == Qt::Key_Backtab) { + if (ke->key() == Qt::Key_Tab || ke->key() == Qt::Key_Backtab) { keyPressEvent(ke); return true; } @@ -1622,7 +1622,7 @@ QSize QMenuBar::minimumSizeHint() const const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); - if(as_gui_menubar) { + if (as_gui_menubar) { int w = parentWidget() ? parentWidget()->width() : QGuiApplication::primaryScreen()->virtualGeometry().width(); d->calcActionRects(w - (2 * fw), 0); for (int i = 0; ret.isNull() && i < d->actions.count(); ++i) @@ -1632,19 +1632,19 @@ QSize QMenuBar::minimumSizeHint() const ret += QSize(2*fw + hmargin, 2*fw + vmargin); } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; - if(d->leftWidget) { + if (d->leftWidget) { QSize sz = d->leftWidget->minimumSizeHint(); ret.setWidth(ret.width() + sz.width()); - if(sz.height() + margin > ret.height()) + if (sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } - if(d->rightWidget) { + if (d->rightWidget) { QSize sz = d->rightWidget->minimumSizeHint(); ret.setWidth(ret.width() + sz.width()); - if(sz.height() + margin > ret.height()) + if (sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } - if(as_gui_menubar) { + if (as_gui_menubar) { QStyleOptionMenuItem opt; opt.rect = rect(); opt.menuRect = rect(); @@ -1672,7 +1672,7 @@ QSize QMenuBar::sizeHint() const const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); - if(as_gui_menubar) { + if (as_gui_menubar) { const int w = parentWidget() ? parentWidget()->width() : QGuiApplication::primaryScreen()->virtualGeometry().width(); d->calcActionRects(w - (2 * fw), 0); for (int i = 0; i < d->actionRects.count(); ++i) { @@ -1684,18 +1684,18 @@ QSize QMenuBar::sizeHint() const ret += QSize(fw + hmargin, fw + vmargin); } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; - if(d->leftWidget) { + if (d->leftWidget) { QSize sz = d->leftWidget->sizeHint(); sz.rheight() += margin; ret = ret.expandedTo(sz); } - if(d->rightWidget) { + if (d->rightWidget) { QSize sz = d->rightWidget->sizeHint(); ret.setWidth(ret.width() + sz.width()); - if(sz.height() + margin > ret.height()) + if (sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } - if(as_gui_menubar) { + if (as_gui_menubar) { QStyleOptionMenuItem opt; opt.rect = rect(); opt.menuRect = rect(); @@ -1721,7 +1721,7 @@ int QMenuBar::heightForWidth(int) const const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); - if(as_gui_menubar) { + if (as_gui_menubar) { for (int i = 0; i < d->actionRects.count(); ++i) height = qMax(height, d->actionRects.at(i).height()); if (height) //there is at least one non-null item @@ -1730,11 +1730,11 @@ int QMenuBar::heightForWidth(int) const height += 2*vmargin; } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; - if(d->leftWidget) + if (d->leftWidget) height = qMax(d->leftWidget->sizeHint().height() + margin, height); - if(d->rightWidget) + if (d->rightWidget) height = qMax(d->rightWidget->sizeHint().height() + margin, height); - if(as_gui_menubar) { + if (as_gui_menubar) { QStyleOptionMenuItem opt; opt.initFrom(this); opt.menuRect = rect(); diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 2b91ca2ecb..ed2370f65a 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -2317,7 +2317,7 @@ void QPlainTextEdit::changeEvent(QEvent *e) if (e->type() == QEvent::ApplicationFontChange || e->type() == QEvent::FontChange) { d->control->document()->setDefaultFont(font()); - } else if(e->type() == QEvent::ActivationChange) { + } else if (e->type() == QEvent::ActivationChange) { if (!isActiveWindow()) d->autoScrollTimer.stop(); } else if (e->type() == QEvent::EnabledChange) { diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 65c0966092..0ae74cb85b 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -352,7 +352,7 @@ void QPushButton::setAutoDefault(bool enable) bool QPushButton::autoDefault() const { Q_D(const QPushButton); - if(d->autoDefault == QPushButtonPrivate::Auto) + if (d->autoDefault == QPushButtonPrivate::Auto) return ( d->dialogParent() != nullptr ); return d->autoDefault; } @@ -418,9 +418,9 @@ QSize QPushButton::sizeHint() const s = QStringLiteral("XXXX"); QFontMetrics fm = fontMetrics(); QSize sz = fm.size(Qt::TextShowMnemonic, s); - if(!empty || !w) + if (!empty || !w) w += sz.width(); - if(!empty || !h) + if (!empty || !h) h = qMax(h, sz.height()); opt.rect.setSize(QSize(w, h)); // PM_MenuButtonIndicator depends on the height #if QT_CONFIG(menu) diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 46d49391ba..619b3788c8 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -1652,7 +1652,7 @@ void QSplitter::setHandleWidth(int width) void QSplitter::changeEvent(QEvent *ev) { Q_D(QSplitter); - if(ev->type() == QEvent::StyleChange) + if (ev->type() == QEvent::StyleChange) d->updateHandles(); QFrame::changeEvent(ev); } diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 2c65240434..b21e038843 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2274,7 +2274,7 @@ void QTabBarPrivate::moveTabFinished(int index) } #endif // animation if (allAnimationsFinished && cleanup) { - if(movingTab) + if (movingTab) movingTab->setVisible(false); // We might not get a mouse release for (auto tab : qAsConst(tabList)) { tab->dragOffset = 0; diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 3c2bc4f66b..34f9384cdf 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -469,7 +469,7 @@ int QTabWidget::insertTab(int index, QWidget *w, const QString &label) int QTabWidget::insertTab(int index, QWidget *w, const QIcon& icon, const QString &label) { Q_D(QTabWidget); - if(!w) + if (!w) return -1; index = d->stack->insertWidget(index, w); d->tabs->insertTab(index, icon, label); @@ -878,7 +878,7 @@ QSize QTabWidget::sizeHint() const if (d->leftCornerWidget) lc = d->leftCornerWidget->sizeHint(); - if(d->rightCornerWidget) + if (d->rightCornerWidget) rc = d->rightCornerWidget->sizeHint(); if (!d->dirty) { QTabWidget *that = const_cast<QTabWidget*>(this); @@ -916,9 +916,9 @@ QSize QTabWidget::minimumSizeHint() const Q_D(const QTabWidget); QSize lc(0, 0), rc(0, 0); - if(d->leftCornerWidget) + if (d->leftCornerWidget) lc = d->leftCornerWidget->minimumSizeHint(); - if(d->rightCornerWidget) + if (d->rightCornerWidget) rc = d->rightCornerWidget->minimumSizeHint(); if (!d->dirty) { QTabWidget *that = const_cast<QTabWidget*>(this); @@ -954,7 +954,7 @@ int QTabWidget::heightForWidth(int width) const QSize lc(0, 0), rc(0, 0); if (d->leftCornerWidget) lc = d->leftCornerWidget->sizeHint(); - if(d->rightCornerWidget) + if (d->rightCornerWidget) rc = d->rightCornerWidget->sizeHint(); if (!d->dirty) { QTabWidget *that = const_cast<QTabWidget*>(this); diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index 05f73dd5df..753655909c 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -502,7 +502,7 @@ void QTextBrowserPrivate::keypadMove(bool next) // up e.g. 110% // Obviously if a link is entirely visible, we still // focus it. - if(bothViewRects.contains(desiredRect) + if (bothViewRects.contains(desiredRect) || bothViewRects.adjusted(0, visibleLinkAmount, 0, -visibleLinkAmount).intersects(desiredRect)) { focusIt = true; @@ -531,7 +531,7 @@ void QTextBrowserPrivate::keypadMove(bool next) if (!focusIt && prevFocus.hasSelection()) { QRectF desiredRect = control->selectionRect(prevFocus); // XXX this may be better off also using the visibleLinkAmount value - if(newViewRect.intersects(desiredRect)) { + if (newViewRect.intersects(desiredRect)) { focusedPos = scrollYOffset; focusIt = true; anchorToFocus = prevFocus; diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index f7483b02de..ad307606d1 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -1915,7 +1915,7 @@ void QTextEdit::changeEvent(QEvent *e) if (e->type() == QEvent::ApplicationFontChange || e->type() == QEvent::FontChange) { d->control->document()->setDefaultFont(font()); - } else if(e->type() == QEvent::ActivationChange) { + } else if (e->type() == QEvent::ActivationChange) { if (!isActiveWindow()) d->autoScrollTimer.stop(); } else if (e->type() == QEvent::EnabledChange) { diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp index 3d1ed5dedf..c5af8697dc 100644 --- a/src/widgets/widgets/qtoolbarlayout.cpp +++ b/src/widgets/widgets/qtoolbarlayout.cpp @@ -460,7 +460,7 @@ bool QToolBarLayout::layoutActions(const QSize &size) if (space <= 0) return false; // nothing to do. - if(popupMenu) + if (popupMenu) popupMenu->clear(); bool ranOutOfSpace = false; diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp index acd306b7f6..cbb25ec159 100644 --- a/src/widgets/widgets/qtoolbox.cpp +++ b/src/widgets/widgets/qtoolbox.cpp @@ -713,7 +713,7 @@ void QToolBox::showEvent(QShowEvent *e) void QToolBox::changeEvent(QEvent *ev) { Q_D(QToolBox); - if(ev->type() == QEvent::StyleChange) + if (ev->type() == QEvent::StyleChange) d->updateTabs(); QFrame::changeEvent(ev); } diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 30ac2f219c..1b04f3df72 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -628,7 +628,7 @@ void QToolButton::mouseReleaseEvent(QMouseEvent *e) bool QToolButton::hitButton(const QPoint &pos) const { Q_D(const QToolButton); - if(QAbstractButton::hitButton(pos)) + if (QAbstractButton::hitButton(pos)) return (d->buttonPressed != QToolButtonPrivate::MenuButtonPressed); return false; } diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 08f3133b96..29ac32cadc 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -669,7 +669,7 @@ void QWidgetLineControl::draw(QPainter *painter, const QPoint &offset, const QRe void QWidgetLineControl::selectWordAtPos(int cursor) { int next = cursor + 1; - if(next > end()) + if (next > end()) --next; int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords); moveCursor(c, false); |