diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/accessible/itemviews.cpp | 1 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicswidget.cpp | 1 | ||||
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 1 | ||||
-rw-r--r-- | src/widgets/itemviews/qheaderview.cpp | 1 | ||||
-rw-r--r-- | src/widgets/itemviews/qitemeditorfactory.cpp | 9 | ||||
-rw-r--r-- | src/widgets/itemviews/qlistview.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qpixmapstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/util/qcompleter.cpp | 8 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit_p.cpp | 3 | ||||
-rw-r--r-- | src/widgets/widgets/qmainwindowlayout.cpp | 3 | ||||
-rw-r--r-- | src/widgets/widgets/qmenubar.cpp | 11 | ||||
-rw-r--r-- | src/widgets/widgets/qsplitter.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 46 |
15 files changed, 41 insertions, 55 deletions
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index db5af4fd7c..eec9a0021c 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -310,6 +310,7 @@ bool QAccessibleTable::selectColumn(int column) case QAbstractItemView::SingleSelection: if (view()->selectionBehavior() != QAbstractItemView::SelectColumns && rowCount() > 1) return false; + Q_FALLTHROUGH(); case QAbstractItemView::ContiguousSelection: if ((!column || !view()->selectionModel()->isColumnSelected(column - 1, view()->rootIndex())) && !view()->selectionModel()->isColumnSelected(column + 1, view()->rootIndex())) diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 2adc58e4a4..1ff01b875c 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -1500,6 +1500,7 @@ void QGraphicsWidget::changeEvent(QEvent *event) unsetWindowFrameMargins(); if (d->layout) d->layout->invalidate(); + Q_FALLTHROUGH(); case QEvent::FontChange: update(); updateGeometry(); diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 20002b1f82..d24456edef 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -4035,6 +4035,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionC switch (static_cast<const QKeyEvent*>(event)->key()) { case Qt::Key_Backtab: modifiers = modifiers & ~Qt::ShiftModifier; // special case for backtab + Q_FALLTHROUGH(); case Qt::Key_Down: case Qt::Key_Up: case Qt::Key_Left: diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index d2f9618c29..e0e993ce77 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2565,6 +2565,7 @@ void QHeaderView::mouseReleaseEvent(QMouseEvent *e) d->updateSectionIndicator(d->section, pos); break; } // not moving + Q_FALLTHROUGH(); case QHeaderViewPrivate::SelectSections: if (!d->clickableSections) { int section = logicalIndexAt(pos); diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index c044d37575..c535cf5f9e 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -55,6 +55,7 @@ #include <qapplication.h> #include <qdebug.h> +#include <vector> #include <algorithm> QT_BEGIN_NAMESPACE @@ -191,9 +192,11 @@ QByteArray QItemEditorFactory::valuePropertyName(int userType) const QItemEditorFactory::~QItemEditorFactory() { //we make sure we delete all the QItemEditorCreatorBase - //this has to be done only once, hence the QSet - QSet<QItemEditorCreatorBase*> set = creatorMap.values().toSet(); - qDeleteAll(set); + //this has to be done only once, hence the sort-unique idiom + std::vector<QItemEditorCreatorBase*> creators(creatorMap.cbegin(), creatorMap.cend()); + std::sort(creators.begin(), creators.end()); + const auto it = std::unique(creators.begin(), creators.end()); + qDeleteAll(creators.begin(), it); } /*! diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 653b03ef0d..3ef5b788c6 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -1157,6 +1157,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie rect.moveTop(rect.top() - d->viewport->height() + 2 * rect.height()); if (rect.top() < rect.height()) rect.moveTop(rect.height()); + Q_FALLTHROUGH(); case MovePrevious: case MoveUp: while (intersectVector.isEmpty()) { @@ -1185,6 +1186,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie rect.moveTop(rect.top() + d->viewport->height() - 2 * rect.height()); if (rect.bottom() > contents.height() - rect.height()) rect.moveBottom(contents.height() - rect.height()); + Q_FALLTHROUGH(); case MoveNext: case MoveDown: while (intersectVector.isEmpty()) { diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 92cd5cc0f1..851b7a33c8 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4882,6 +4882,8 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz.rheight() += 2; // Prevent icons from overlapping. } break; +#else + Q_UNUSED(d); #endif // QT_NO_ITEMVIEWS #ifndef QT_NO_SPINBOX case CT_SpinBox: diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index 3aec3cf991..19f4cc3617 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -732,6 +732,8 @@ void QPixmapStyle::drawLineEdit(const QStyleOption *option, #if QT_CONFIG(combobox) if (widget && qobject_cast<const QComboBox*>(widget->parentWidget())) return; +#else + Q_UNUSED(widget); #endif const bool enabled = option->state & State_Enabled; const bool focused = option->state & State_HasFocus; diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index e8f23f08bc..5a31eb4e52 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -493,7 +493,7 @@ QMatchData QCompletionEngine::filterHistory() bool QCompletionEngine::matchHint(QString part, const QModelIndex& parent, QMatchData *hint) { if (c->cs == Qt::CaseInsensitive) - part = part.toLower(); + part = std::move(part).toLower(); const CacheItem& map = cache[parent]; @@ -512,7 +512,7 @@ bool QCompletionEngine::matchHint(QString part, const QModelIndex& parent, QMatc bool QCompletionEngine::lookupCache(QString part, const QModelIndex& parent, QMatchData *m) { if (c->cs == Qt::CaseInsensitive) - part = part.toLower(); + part = std::move(part).toLower(); const CacheItem& map = cache[parent]; if (!map.contains(part)) return false; @@ -548,7 +548,7 @@ void QCompletionEngine::saveInCache(QString part, const QModelIndex& parent, con } if (c->cs == Qt::CaseInsensitive) - part = part.toLower(); + part = std::move(part).toLower(); cache[parent][part] = m; } @@ -558,7 +558,7 @@ QIndexMapper QSortedModelEngine::indexHint(QString part, const QModelIndex& pare const QAbstractItemModel *model = c->proxy->sourceModel(); if (c->cs == Qt::CaseInsensitive) - part = part.toLower(); + part = std::move(part).toLower(); const CacheItem& map = cache[parent]; diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 5926476470..29c8a42cad 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -64,6 +64,8 @@ #include "qdebug.h" #include "qtextedit.h" #include <private/qtextedit_p.h> +#include <private/qwidgettextcontrol_p.h> + #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" #endif diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 68be82c71d..7c5ba79cb6 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -536,7 +536,8 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE // If there is a 'before' action, it takes preference // There's a bug in GHS compiler that causes internal error on the following code. - // The affected GHS compiler versions are 2016.5.4 and 2017.1 + // The affected GHS compiler versions are 2016.5.4 and 2017.1. GHS internal reference + // to track the progress of this issue is TOOLS-26637. // This temporary workaround allows to compile with GHS toolchain and should be // removed when GHS provides a patch to fix the compiler issue. diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 63b6bcfaef..98421588a7 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2330,6 +2330,9 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group) } #endif +#if !QT_CONFIG(dockwidget) || !QT_CONFIG(tabbar) + Q_UNUSED(group); +#endif layoutState.unplug(path ,&savedState); savedState.fitLayout(); diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 77ed7a4f78..c16b2a5ac1 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -1470,6 +1470,17 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event) } } + if (isNativeMenuBar() && event->type() == QEvent::ShowToParent) { + // On some desktops like Unity, the D-Bus menu bar is unregistered + // when the window is hidden. So when the window is shown, we need + // to forcefully re-register it. The only way to force re-registering + // with D-Bus menu is the handleReparent method. + QWidget *widget = qobject_cast<QWidget *>(object); + QWindow *handle = widget ? widget->windowHandle() : nullptr; + if (handle != nullptr) + d->platformMenuBar->handleReparent(handle); + } + if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)) { if (d->altPressed) { switch (event->type()) { diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index e6332293e4..e92347c65c 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -1798,9 +1798,9 @@ QTextStream& operator>>(QTextStream& ts, QSplitter& splitter) QString line = ts.readLine(); line = line.simplified(); line.replace(QLatin1Char(' '), QString()); - line = line.toUpper(); + line = std::move(line).toUpper(); - splitter.restoreState(line.toLatin1()); + splitter.restoreState(std::move(line).toLatin1()); return ts; } diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 9e848ca834..0d34fae78f 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -1144,52 +1144,8 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget case QEvent::ShortcutOverride: if (d->interactionFlags & Qt::TextEditable) { QKeyEvent* ke = static_cast<QKeyEvent *>(e); - if (ke->modifiers() == Qt::NoModifier - || ke->modifiers() == Qt::ShiftModifier - || ke->modifiers() == Qt::KeypadModifier) { - if (ke->key() < Qt::Key_Escape) { - ke->accept(); - } else { - switch (ke->key()) { - case Qt::Key_Return: - case Qt::Key_Enter: - case Qt::Key_Delete: - case Qt::Key_Home: - case Qt::Key_End: - case Qt::Key_Backspace: - case Qt::Key_Left: - case Qt::Key_Right: - case Qt::Key_Up: - case Qt::Key_Down: - case Qt::Key_Tab: - ke->accept(); - default: - break; - } - } -#ifndef QT_NO_SHORTCUT - } else if (ke == QKeySequence::Copy - || ke == QKeySequence::Paste - || ke == QKeySequence::Cut - || ke == QKeySequence::Redo - || ke == QKeySequence::Undo - || ke == QKeySequence::MoveToNextWord - || ke == QKeySequence::MoveToPreviousWord - || ke == QKeySequence::MoveToStartOfDocument - || ke == QKeySequence::MoveToEndOfDocument - || ke == QKeySequence::SelectNextWord - || ke == QKeySequence::SelectPreviousWord - || ke == QKeySequence::SelectStartOfLine - || ke == QKeySequence::SelectEndOfLine - || ke == QKeySequence::SelectStartOfBlock - || ke == QKeySequence::SelectEndOfBlock - || ke == QKeySequence::SelectStartOfDocument - || ke == QKeySequence::SelectEndOfDocument - || ke == QKeySequence::SelectAll - ) { + if (isCommonTextEditShortcut(ke)) ke->accept(); -#endif - } } break; default: |