summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorZhang Sheng <zhangsheng@uniontech.com>2020-11-16 11:19:17 +0800
committerZhang Sheng <zhangsheng@uniontech.com>2020-11-16 12:53:37 +0000
commite13173c112b729da8f53dd2e81e8116a1ed857cf (patch)
tree49c2bce0c3349eebd0f2b62c80a1b7168ae45dc2 /src/widgets/widgets
parent802e5a45baf3ac7da2cb3be06d10bdd69696fcae (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/widgets')
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp4
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp6
-rw-r--r--src/widgets/widgets/qfocusframe.cpp4
-rw-r--r--src/widgets/widgets/qlabel.cpp4
-rw-r--r--src/widgets/widgets/qlineedit.cpp2
-rw-r--r--src/widgets/widgets/qmainwindow.cpp2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp2
-rw-r--r--src/widgets/widgets/qmenu.cpp44
-rw-r--r--src/widgets/widgets/qmenubar.cpp148
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp2
-rw-r--r--src/widgets/widgets/qpushbutton.cpp6
-rw-r--r--src/widgets/widgets/qsplitter.cpp2
-rw-r--r--src/widgets/widgets/qtabbar.cpp2
-rw-r--r--src/widgets/widgets/qtabwidget.cpp10
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp4
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp2
-rw-r--r--src/widgets/widgets/qtoolbox.cpp2
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp2
20 files changed, 126 insertions, 126 deletions
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);