summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/accessible/complexwidgets.cpp32
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.h4
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp73
-rw-r--r--src/widgets/dialogs/qcolordialog.h10
-rw-r--r--src/widgets/dialogs/qcolordialog_p.h6
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp4
-rw-r--r--src/widgets/dialogs/qerrormessage.h4
-rw-r--r--src/widgets/dialogs/qfiledialog.h14
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h22
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.h36
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp2
-rw-r--r--src/widgets/dialogs/qfontdialog.h14
-rw-r--r--src/widgets/dialogs/qfontdialog_p.h6
-rw-r--r--src/widgets/dialogs/qfscompleter_p.h4
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp8
-rw-r--r--src/widgets/dialogs/qinputdialog.h14
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp10
-rw-r--r--src/widgets/dialogs/qmessagebox.h18
-rw-r--r--src/widgets/dialogs/qprogressdialog.h16
-rw-r--r--src/widgets/dialogs/qsidebar_p.h20
-rw-r--r--src/widgets/dialogs/qwizard.cpp4
-rw-r--r--src/widgets/dialogs/qwizard.h12
-rw-r--r--src/widgets/effects/qgraphicseffect.h12
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp7
-rw-r--r--src/widgets/effects/qpixmapfilter_p.h14
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.h12
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.cpp1
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.h12
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp10
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.h222
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.h4
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h7
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.cpp1
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.h12
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.h64
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp.cpp6
-rw-r--r--src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h20
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex_p.h10
-rw-r--r--src/widgets/graphicsview/qgraphicstransform.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsview.h50
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp12
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.h34
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.h16
-rw-r--r--src/widgets/itemviews/itemviews.pri1
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp118
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.h3
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate_p.h70
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp6
-rw-r--r--src/widgets/itemviews/qabstractitemview.h44
-rw-r--r--src/widgets/itemviews/qcolumnview.h36
-rw-r--r--src/widgets/itemviews/qcolumnview_p.h24
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip_p.h10
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp2
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp5
-rw-r--r--src/widgets/itemviews/qdirmodel.h32
-rw-r--r--src/widgets/itemviews/qheaderview.cpp120
-rw-r--r--src/widgets/itemviews/qheaderview.h55
-rw-r--r--src/widgets/itemviews/qheaderview_p.h6
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp109
-rw-r--r--src/widgets/itemviews/qitemdelegate.h18
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp4
-rw-r--r--src/widgets/itemviews/qitemeditorfactory_p.h2
-rw-r--r--src/widgets/itemviews/qlistview.h62
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp19
-rw-r--r--src/widgets/itemviews/qlistwidget.h6
-rw-r--r--src/widgets/itemviews/qlistwidget_p.h2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp103
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.h18
-rw-r--r--src/widgets/itemviews/qtableview.cpp2
-rw-r--r--src/widgets/itemviews/qtableview.h50
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp19
-rw-r--r--src/widgets/itemviews/qtablewidget.h6
-rw-r--r--src/widgets/itemviews/qtablewidget_p.h2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp4
-rw-r--r--src/widgets/itemviews/qtreeview.h70
-rw-r--r--src/widgets/itemviews/qtreeview_p.h2
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp5
-rw-r--r--src/widgets/itemviews/qtreewidget.h8
-rw-r--r--src/widgets/itemviews/qtreewidget_p.h40
-rw-r--r--src/widgets/kernel/qaction.h2
-rw-r--r--src/widgets/kernel/qapplication.cpp53
-rw-r--r--src/widgets/kernel/qapplication.h13
-rw-r--r--src/widgets/kernel/qapplication_p.h14
-rw-r--r--src/widgets/kernel/qboxlayout.h26
-rw-r--r--src/widgets/kernel/qdesktopwidget.h2
-rw-r--r--src/widgets/kernel/qdesktopwidget_p.h4
-rw-r--r--src/widgets/kernel/qformlayout.h26
-rw-r--r--src/widgets/kernel/qgesture.cpp106
-rw-r--r--src/widgets/kernel/qgesture.h13
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp53
-rw-r--r--src/widgets/kernel/qgridlayout.h26
-rw-r--r--src/widgets/kernel/qlayout.cpp8
-rw-r--r--src/widgets/kernel/qlayout.h24
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp98
-rw-r--r--src/widgets/kernel/qopenglwidget.h8
-rw-r--r--src/widgets/kernel/qshortcut.h2
-rw-r--r--src/widgets/kernel/qsizepolicy.h1
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp5
-rw-r--r--src/widgets/kernel/qstackedlayout.h22
-rw-r--r--src/widgets/kernel/qstandardgestures_p.h30
-rw-r--r--src/widgets/kernel/qtooltip.cpp10
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp14
-rw-r--r--src/widgets/kernel/qwidget.cpp23
-rw-r--r--src/widgets/kernel/qwidget.h14
-rw-r--r--src/widgets/kernel/qwidget_p.h10
-rw-r--r--src/widgets/kernel/qwidgetaction.h4
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp18
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp5
-rw-r--r--src/widgets/kernel/qwidgetwindow_p.h8
-rw-r--r--src/widgets/kernel/qwindowcontainer_p.h2
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition_p.h4
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition_p.h4
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.h4
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.h4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp25
-rw-r--r--src/widgets/styles/qcommonstyle.h36
-rw-r--r--src/widgets/styles/qfusionstyle.cpp5
-rw-r--r--src/widgets/styles/qfusionstyle_p.h42
-rw-r--r--src/widgets/styles/qgtk2painter_p.h30
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp14
-rw-r--r--src/widgets/styles/qgtkstyle_p.h42
-rw-r--r--src/widgets/styles/qgtkstyle_p_p.h2
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm33
-rw-r--r--src/widgets/styles/qproxystyle.h48
-rw-r--r--src/widgets/styles/qstyle.cpp31
-rw-r--r--src/widgets/styles/qstyle.h9
-rw-r--r--src/widgets/styles/qstyleanimation_p.h12
-rw-r--r--src/widgets/styles/qstyleoption.cpp3
-rw-r--r--src/widgets/styles/qstyleoption.h2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp20
-rw-r--r--src/widgets/styles/qstylesheetstyle_p.h48
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp11
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h30
-rw-r--r--src/widgets/util/qcompleter.h4
-rw-r--r--src/widgets/util/qcompleter_p.h26
-rw-r--r--src/widgets/util/qflickgesture.cpp2
-rw-r--r--src/widgets/util/qscroller.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp6
-rw-r--r--src/widgets/util/qsystemtrayicon.h2
-rw-r--r--src/widgets/util/qsystemtrayicon_p.h12
-rw-r--r--src/widgets/util/qsystemtrayicon_qpa.cpp8
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp43
-rw-r--r--src/widgets/util/qundoview.cpp10
-rw-r--r--src/widgets/widgets/qabstractbutton.h20
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp17
-rw-r--r--src/widgets/widgets/qabstractscrollarea.h35
-rw-r--r--src/widgets/widgets/qabstractscrollarea_p.h2
-rw-r--r--src/widgets/widgets/qabstractslider.h10
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp74
-rw-r--r--src/widgets/widgets/qcalendarwidget.h14
-rw-r--r--src/widgets/widgets/qcheckbox.h16
-rw-r--r--src/widgets/widgets/qcombobox.cpp3
-rw-r--r--src/widgets/widgets/qcombobox.h36
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.h10
-rw-r--r--src/widgets/widgets/qdial.cpp2
-rw-r--r--src/widgets/widgets/qdial.h18
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.h4
-rw-r--r--src/widgets/widgets/qdockwidget.cpp8
-rw-r--r--src/widgets/widgets/qdockwidget.h8
-rw-r--r--src/widgets/widgets/qdockwidget_p.h22
-rw-r--r--src/widgets/widgets/qeffects.cpp10
-rw-r--r--src/widgets/widgets/qfocusframe.h6
-rw-r--r--src/widgets/widgets/qfontcombobox.cpp4
-rw-r--r--src/widgets/widgets/qfontcombobox.h4
-rw-r--r--src/widgets/widgets/qframe.cpp76
-rw-r--r--src/widgets/widgets/qframe.h10
-rw-r--r--src/widgets/widgets/qgroupbox.h20
-rw-r--r--src/widgets/widgets/qlabel.h28
-rw-r--r--src/widgets/widgets/qlcdnumber.h6
-rw-r--r--src/widgets/widgets/qlineedit.cpp8
-rw-r--r--src/widgets/widgets/qlineedit.h44
-rw-r--r--src/widgets/widgets/qlineedit_p.h2
-rw-r--r--src/widgets/widgets/qmainwindow.h4
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp2
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h18
-rw-r--r--src/widgets/widgets/qmdiarea.cpp4
-rw-r--r--src/widgets/widgets/qmdiarea.h24
-rw-r--r--src/widgets/widgets/qmdiarea_p.h10
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp26
-rw-r--r--src/widgets/widgets/qmdisubwindow.h44
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h2
-rw-r--r--src/widgets/widgets/qmenu.cpp311
-rw-r--r--src/widgets/widgets/qmenu.h35
-rw-r--r--src/widgets/widgets/qmenu_p.h251
-rw-r--r--src/widgets/widgets/qmenubar.cpp13
-rw-r--r--src/widgets/widgets/qmenubar.h4
-rw-r--r--src/widgets/widgets/qplaintextedit.h62
-rw-r--r--src/widgets/widgets/qplaintextedit_p.h14
-rw-r--r--src/widgets/widgets/qprogressbar.cpp2
-rw-r--r--src/widgets/widgets/qprogressbar.h8
-rw-r--r--src/widgets/widgets/qpushbutton.h14
-rw-r--r--src/widgets/widgets/qradiobutton.h12
-rw-r--r--src/widgets/widgets/qrubberband.h12
-rw-r--r--src/widgets/widgets/qscrollarea.h12
-rw-r--r--src/widgets/widgets/qscrollbar.h20
-rw-r--r--src/widgets/widgets/qsizegrip.h22
-rw-r--r--src/widgets/widgets/qslider.h14
-rw-r--r--src/widgets/widgets/qspinbox.cpp12
-rw-r--r--src/widgets/widgets/qsplashscreen.h4
-rw-r--r--src/widgets/widgets/qsplitter.h26
-rw-r--r--src/widgets/widgets/qstackedwidget.h2
-rw-r--r--src/widgets/widgets/qstatusbar.h8
-rw-r--r--src/widgets/widgets/qtabbar.h28
-rw-r--r--src/widgets/widgets/qtabbar_p.h12
-rw-r--r--src/widgets/widgets/qtabwidget.h20
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp2
-rw-r--r--src/widgets/widgets/qtextbrowser.h18
-rw-r--r--src/widgets/widgets/qtextedit.cpp6
-rw-r--r--src/widgets/widgets/qtextedit.h48
-rw-r--r--src/widgets/widgets/qtoolbar.cpp9
-rw-r--r--src/widgets/widgets/qtoolbar.h14
-rw-r--r--src/widgets/widgets/qtoolbarextension_p.h4
-rw-r--r--src/widgets/widgets/qtoolbarlayout_p.h24
-rw-r--r--src/widgets/widgets/qtoolbarseparator_p.h4
-rw-r--r--src/widgets/widgets/qtoolbox.cpp6
-rw-r--r--src/widgets/widgets/qtoolbox.h6
-rw-r--r--src/widgets/widgets/qtoolbutton.h30
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h2
-rw-r--r--src/widgets/widgets/qwidgetresizehandler_p.h2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp6
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h8
226 files changed, 2722 insertions, 2220 deletions
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index 30f9ccb1f4..1945fd8416 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -77,16 +77,16 @@ public:
: m_parent(parent), m_index(index)
{}
- void *interface_cast(QAccessible::InterfaceType t) {
+ void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE {
if (t == QAccessible::ActionInterface) {
return static_cast<QAccessibleActionInterface*>(this);
}
return 0;
}
- QObject *object() const { return 0; }
- QAccessible::Role role() const { return QAccessible::PageTab; }
- QAccessible::State state() const {
+ QObject *object() const Q_DECL_OVERRIDE { return 0; }
+ QAccessible::Role role() const Q_DECL_OVERRIDE { return QAccessible::PageTab; }
+ QAccessible::State state() const Q_DECL_OVERRIDE {
if (!isValid()) {
QAccessible::State s;
s.invalid = true;
@@ -94,7 +94,7 @@ public:
}
return parent()->state();
}
- QRect rect() const {
+ QRect rect() const Q_DECL_OVERRIDE {
if (!isValid())
return QRect();
@@ -104,13 +104,13 @@ public:
return rec;
}
- bool isValid() const { return m_parent.data() && m_parent->count() > m_index; }
+ bool isValid() const Q_DECL_OVERRIDE { return m_parent.data() && m_parent->count() > m_index; }
- QAccessibleInterface *childAt(int, int) const { return 0; }
- int childCount() const { return 0; }
- int indexOfChild(const QAccessibleInterface *) const { return -1; }
+ QAccessibleInterface *childAt(int, int) const Q_DECL_OVERRIDE { return 0; }
+ int childCount() const Q_DECL_OVERRIDE { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const Q_DECL_OVERRIDE { return -1; }
- QString text(QAccessible::Text t) const
+ QString text(QAccessible::Text t) const Q_DECL_OVERRIDE
{
if (!isValid())
return QString();
@@ -129,26 +129,26 @@ public:
return QString();
}
- void setText(QAccessible::Text, const QString &) {}
+ void setText(QAccessible::Text, const QString &) Q_DECL_OVERRIDE {}
- QAccessibleInterface *parent() const {
+ QAccessibleInterface *parent() const Q_DECL_OVERRIDE {
return QAccessible::queryAccessibleInterface(m_parent.data());
}
- QAccessibleInterface *child(int) const { return 0; }
+ QAccessibleInterface *child(int) const Q_DECL_OVERRIDE { return 0; }
// action interface
- QStringList actionNames() const
+ QStringList actionNames() const Q_DECL_OVERRIDE
{
return QStringList(pressAction());
}
- void doAction(const QString &actionName)
+ void doAction(const QString &actionName) Q_DECL_OVERRIDE
{
if (isValid() && actionName == pressAction())
m_parent->setCurrentIndex(m_index);
}
- QStringList keyBindingsForAction(const QString &) const
+ QStringList keyBindingsForAction(const QString &) const Q_DECL_OVERRIDE
{
return QStringList();
}
diff --git a/src/widgets/accessible/qaccessiblewidgets.h b/src/widgets/accessible/qaccessiblewidgets.h
index b2459fe71e..50a01be397 100644
--- a/src/widgets/accessible/qaccessiblewidgets.h
+++ b/src/widgets/accessible/qaccessiblewidgets.h
@@ -67,7 +67,7 @@ class QAccessibleTextWidget : public QAccessibleWidget,
public:
QAccessibleTextWidget(QWidget *o, QAccessible::Role r = QAccessible::EditableText, const QString &name = QString());
- QAccessible::State state() const;
+ QAccessible::State state() const Q_DECL_OVERRIDE;
// QAccessibleTextInterface
// selection
@@ -89,7 +89,7 @@ public:
int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType,
int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
- int characterCount() const;
+ int characterCount() const Q_DECL_OVERRIDE;
// character <-> geometry
QRect characterRect(int offset) const Q_DECL_OVERRIDE;
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index f04e5b9ea6..40ef6505cf 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -83,7 +83,7 @@ public:
virtual void setCurrent(int row, int col);
virtual void setSelected(int row, int col);
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
virtual void setCellBrush(int row, int col, const QBrush &);
QBrush cellBrush(int row, int col);
@@ -136,12 +136,12 @@ protected:
virtual void paintCell(QPainter *, int row, int col, const QRect&);
virtual void paintCellContents(QPainter *, int row, int col, const QRect&);
- void mousePressEvent(QMouseEvent*);
- void mouseReleaseEvent(QMouseEvent*);
- void keyPressEvent(QKeyEvent*);
- void focusInEvent(QFocusEvent*);
- void focusOutEvent(QFocusEvent*);
- void paintEvent(QPaintEvent *);
+ void mousePressEvent(QMouseEvent*) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent*) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent*) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent*) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent*) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QWellArray)
@@ -513,15 +513,15 @@ public:
{ setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); }
protected:
- void paintCellContents(QPainter *, int row, int col, const QRect&);
- void mousePressEvent(QMouseEvent *e);
- void mouseMoveEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
+ void paintCellContents(QPainter *, int row, int col, const QRect&) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *e);
- void dragLeaveEvent(QDragLeaveEvent *e);
- void dragMoveEvent(QDragMoveEvent *e);
- void dropEvent(QDropEvent *e);
+ void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
#endif
private:
@@ -635,11 +635,11 @@ signals:
void newCol(int h, int s);
protected:
- QSize sizeHint() const;
- void paintEvent(QPaintEvent*);
- void mouseMoveEvent(QMouseEvent *);
- void mousePressEvent(QMouseEvent *);
- void resizeEvent(QResizeEvent *);
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
private:
int hue;
@@ -672,9 +672,9 @@ signals:
void newHsv(int h, int s, int v);
protected:
- void paintEvent(QPaintEvent*);
- void mouseMoveEvent(QMouseEvent *);
- void mousePressEvent(QMouseEvent *);
+ void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
private:
enum { foff = 3, coff = 4 }; //frame and contents offset
@@ -994,14 +994,14 @@ signals:
void colorDropped(QRgb);
protected:
- void paintEvent(QPaintEvent *);
- void mousePressEvent(QMouseEvent *e);
- void mouseMoveEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *e);
- void dragLeaveEvent(QDragLeaveEvent *e);
- void dropEvent(QDropEvent *e);
+ void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
#endif
private:
@@ -1669,7 +1669,7 @@ void QColorDialogPrivate::initWidgets()
#if !defined(Q_OS_WINCE) && !defined(QT_SMALL_COLORDIALOG)
// The screen color picker button
- screenColorPickerButton = new QPushButton(QColorDialog::tr("Pick Screen Color"));
+ screenColorPickerButton = new QPushButton();
leftLay->addWidget(screenColorPickerButton);
lblScreenColorInfo = new QLabel(QLatin1String("\n"));
leftLay->addWidget(lblScreenColorInfo);
@@ -1812,6 +1812,7 @@ void QColorDialogPrivate::retranslateStrings()
lblBasicColors->setText(QColorDialog::tr("&Basic colors"));
lblCustomColors->setText(QColorDialog::tr("&Custom colors"));
addCusBt->setText(QColorDialog::tr("&Add to Custom Colors"));
+ screenColorPickerButton->setText(QColorDialog::tr("&Pick Screen Color"));
}
cs->retranslateStrings();
@@ -2114,16 +2115,6 @@ void QColorDialog::open(QObject *receiver, const char *member)
}
/*!
- \fn QColorDialog::open()
-
- \since 4.5
- Shows the dialog as a \l{QDialog#Modal Dialogs}{window modal dialog},
- returning immediately.
-
- \sa QDialog::open()
-*/
-
-/*!
\since 4.5
Pops up a modal color dialog with the given window \a title (or "Select Color" if none is
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index d23254a2b2..22ff907e7a 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -75,14 +75,10 @@ public:
void setOptions(ColorDialogOptions options);
ColorDialogOptions options() const;
-#ifdef Q_NO_USING_KEYWORD
- void open() { QDialog::open(); }
-#else
using QDialog::open;
-#endif
void open(QObject *receiver, const char *member);
- void setVisible(bool visible);
+ void setVisible(bool visible) Q_DECL_OVERRIDE;
static QColor getColor(const QColor &initial = Qt::white,
QWidget *parent = 0,
@@ -103,8 +99,8 @@ Q_SIGNALS:
void colorSelected(const QColor &color);
protected:
- void changeEvent(QEvent *event);
- void done(int result);
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void done(int result) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QColorDialog)
diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h
index af3ebe8925..c2d6f48f49 100644
--- a/src/widgets/dialogs/qcolordialog_p.h
+++ b/src/widgets/dialogs/qcolordialog_p.h
@@ -109,7 +109,7 @@ public:
bool handleColorPickingMouseButtonRelease(QMouseEvent *e);
bool handleColorPickingKeyPress(QKeyEvent *e);
- bool canBeNativeDialog() const;
+ bool canBeNativeDialog() const Q_DECL_OVERRIDE;
QWellArray *custom;
QWellArray *standard;
@@ -155,8 +155,8 @@ public:
void mac_nativeDialogModalHelp();
#endif
private:
- virtual void initHelper(QPlatformDialogHelper *h);
- virtual void helperPrepareShow(QPlatformDialogHelper *h);
+ virtual void initHelper(QPlatformDialogHelper *h) Q_DECL_OVERRIDE;
+ virtual void helperPrepareShow(QPlatformDialogHelper *h) Q_DECL_OVERRIDE;
};
#endif // QT_NO_COLORDIALOG
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 6bab921d21..65da7e3928 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -84,8 +84,8 @@ public:
QErrorMessageTextView(QWidget *parent)
: QTextEdit(parent) { setReadOnly(true); }
- virtual QSize minimumSizeHint() const;
- virtual QSize sizeHint() const;
+ virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ virtual QSize sizeHint() const Q_DECL_OVERRIDE;
};
QSize QErrorMessageTextView::minimumSizeHint() const
diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h
index 0925923d96..301fbc7f8d 100644
--- a/src/widgets/dialogs/qerrormessage.h
+++ b/src/widgets/dialogs/qerrormessage.h
@@ -58,8 +58,8 @@ public Q_SLOTS:
void showMessage(const QString &message, const QString &type);
protected:
- void done(int);
- void changeEvent(QEvent *e);
+ void done(int) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QErrorMessage)
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index 70e498a2cd..c991256eef 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -172,15 +172,9 @@ public:
void setOptions(Options options);
Options options() const;
-#ifdef Q_NO_USING_KEYWORD
-#ifndef Q_QDOC
- void open() { QDialog::open(); }
-#endif
-#else
using QDialog::open;
-#endif
void open(QObject *receiver, const char *member);
- void setVisible(bool visible);
+ void setVisible(bool visible) Q_DECL_OVERRIDE;
Q_SIGNALS:
void fileSelected(const QString &file);
@@ -256,9 +250,9 @@ public:
protected:
QFileDialog(const QFileDialogArgs &args);
- void done(int result);
- void accept();
- void changeEvent(QEvent *e);
+ void done(int result) Q_DECL_OVERRIDE;
+ void accept() Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QFileDialog)
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index cc2f481eb9..991d2a0f7a 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -243,7 +243,7 @@ public:
// setVisible_sys returns true if it ends up showing a native
// dialog. Returning false means that a non-native dialog must be
// used instead.
- bool canBeNativeDialog() const;
+ bool canBeNativeDialog() const Q_DECL_OVERRIDE;
inline bool usingWidgets() const;
void setDirectory_sys(const QUrl &directory);
@@ -273,9 +273,9 @@ public:
~QFileDialogPrivate();
private:
- virtual void initHelper(QPlatformDialogHelper *);
- virtual void helperPrepareShow(QPlatformDialogHelper *);
- virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *);
+ virtual void initHelper(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
+ virtual void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
+ virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) Q_DECL_OVERRIDE;
Q_DISABLE_COPY(QFileDialogPrivate)
};
@@ -285,7 +285,7 @@ class QFileDialogLineEdit : public QLineEdit
public:
QFileDialogLineEdit(QWidget *parent = 0) : QLineEdit(parent), d_ptr(0){}
void setFileDialogPrivate(QFileDialogPrivate *d_pointer) {d_ptr = d_pointer; }
- void keyPressEvent(QKeyEvent *e);
+ void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
bool hideOnEsc;
private:
QFileDialogPrivate *d_ptr;
@@ -296,10 +296,10 @@ class QFileDialogComboBox : public QComboBox
public:
QFileDialogComboBox(QWidget *parent = 0) : QComboBox(parent), urlModel(0) {}
void setFileDialogPrivate(QFileDialogPrivate *d_pointer);
- void showPopup();
+ void showPopup() Q_DECL_OVERRIDE;
void setHistory(const QStringList &paths);
QStringList history() const { return m_history; }
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
private:
QUrlModel *urlModel;
@@ -312,9 +312,9 @@ class QFileDialogListView : public QListView
public:
QFileDialogListView(QWidget *parent = 0);
void setFileDialogPrivate(QFileDialogPrivate *d_pointer);
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
protected:
- void keyPressEvent(QKeyEvent *e);
+ void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
private:
QFileDialogPrivate *d_ptr;
};
@@ -324,10 +324,10 @@ class QFileDialogTreeView : public QTreeView
public:
QFileDialogTreeView(QWidget *parent);
void setFileDialogPrivate(QFileDialogPrivate *d_pointer);
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
protected:
- void keyPressEvent(QKeyEvent *e);
+ void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
private:
QFileDialogPrivate *d_ptr;
};
diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h
index bde699d2a0..28c5660080 100644
--- a/src/widgets/dialogs/qfilesystemmodel.h
+++ b/src/widgets/dialogs/qfilesystemmodel.h
@@ -72,31 +72,31 @@ public:
explicit QFileSystemModel(QObject *parent = 0);
~QFileSystemModel();
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
QModelIndex index(const QString &path, int column = 0) const;
- QModelIndex parent(const QModelIndex &child) const;
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
- bool canFetchMore(const QModelIndex &parent) const;
- void fetchMore(const QModelIndex &parent);
+ QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE;
+ void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
QVariant myComputer(int role = Qt::DisplayRole) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE;
- QStringList mimeTypes() const;
- QMimeData *mimeData(const QModelIndexList &indexes) const;
+ QStringList mimeTypes() const Q_DECL_OVERRIDE;
+ QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent);
- Qt::DropActions supportedDropActions() const;
+ int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
+ Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
// QFileSystemModel specific API
QModelIndex setRootPath(const QString &path);
@@ -137,8 +137,8 @@ public:
protected:
QFileSystemModel(QFileSystemModelPrivate &, QObject *parent = 0);
- void timerEvent(QTimerEvent *event);
- bool event(QEvent *event);
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QFileSystemModel)
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index d12b109d9f..5294e78bfe 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -84,7 +84,7 @@ public:
int row = QListView::currentIndex().row();
return row < 0 ? QString() : model()->stringList().at(row);
}
- void currentChanged(const QModelIndex &current, const QModelIndex &previous) {
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE {
QListView::currentChanged(current, previous);
if (current.isValid())
emit highlighted(current.row());
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index 455b5d3f3e..a065f8bebf 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -79,16 +79,10 @@ public:
void setOptions(FontDialogOptions options);
FontDialogOptions options() const;
-#ifdef Q_NO_USING_KEYWORD
-#ifndef Q_QDOC
- void open() { QDialog::open(); }
-#endif
-#else
using QDialog::open;
-#endif
void open(QObject *receiver, const char *member);
- void setVisible(bool visible);
+ void setVisible(bool visible) Q_DECL_OVERRIDE;
static QFont getFont(bool *ok, QWidget *parent = 0);
static QFont getFont(bool *ok, const QFont &initial, QWidget *parent = 0, const QString &title = QString(),
@@ -99,9 +93,9 @@ Q_SIGNALS:
void fontSelected(const QFont &font);
protected:
- void changeEvent(QEvent *event);
- void done(int result);
- bool eventFilter(QObject *object, QEvent *event);
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void done(int result) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QFontDialog)
diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h
index 3af6f9f29a..9e6adfbf27 100644
--- a/src/widgets/dialogs/qfontdialog_p.h
+++ b/src/widgets/dialogs/qfontdialog_p.h
@@ -135,12 +135,12 @@ public:
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
- bool canBeNativeDialog() const;
+ bool canBeNativeDialog() const Q_DECL_OVERRIDE;
void _q_runNativeAppModalPanel();
private:
- virtual void initHelper(QPlatformDialogHelper *);
- virtual void helperPrepareShow(QPlatformDialogHelper *);
+ virtual void initHelper(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
+ virtual void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
};
#endif // QT_NO_FONTDIALOG
diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h
index a5871e34f7..4a75f59f26 100644
--- a/src/widgets/dialogs/qfscompleter_p.h
+++ b/src/widgets/dialogs/qfscompleter_p.h
@@ -62,8 +62,8 @@ public:
setCaseSensitivity(Qt::CaseInsensitive);
#endif
}
- QString pathFromIndex(const QModelIndex &index) const;
- QStringList splitPath(const QString& path) const;
+ QString pathFromIndex(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QStringList splitPath(const QString& path) const Q_DECL_OVERRIDE;
QAbstractProxyModel *proxyModel;
QFileSystemModel *sourceModel;
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index b52cebadfa..67ed741159 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -111,7 +111,7 @@ private slots:
void notifyTextChanged() { emit textChanged(hasAcceptableInput()); }
private:
- void keyPressEvent(QKeyEvent *event) {
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE {
if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && !hasAcceptableInput()) {
#ifndef QT_NO_PROPERTIES
setProperty("value", property("value"));
@@ -122,7 +122,7 @@ private:
notifyTextChanged();
}
- void mousePressEvent(QMouseEvent *event) {
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE {
QSpinBox::mousePressEvent(event);
notifyTextChanged();
}
@@ -146,7 +146,7 @@ private slots:
void notifyTextChanged() { emit textChanged(hasAcceptableInput()); }
private:
- void keyPressEvent(QKeyEvent *event) {
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE {
if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && !hasAcceptableInput()) {
#ifndef QT_NO_PROPERTIES
setProperty("value", property("value"));
@@ -157,7 +157,7 @@ private:
notifyTextChanged();
}
- void mousePressEvent(QMouseEvent *event) {
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE {
QDoubleSpinBox::mousePressEvent(event);
notifyTextChanged();
}
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 4511e367d4..a56bd6d78b 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -143,19 +143,13 @@ public:
void setCancelButtonText(const QString &text);
QString cancelButtonText() const;
-#ifdef Q_NO_USING_KEYWORD
-#ifndef Q_QDOC
- void open() { QDialog::open(); }
-#endif
-#else
using QDialog::open;
-#endif
void open(QObject *receiver, const char *member);
- QSize minimumSizeHint() const;
- QSize sizeHint() const;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
- void setVisible(bool visible);
+ void setVisible(bool visible) Q_DECL_OVERRIDE;
static QString getText(QWidget *parent, const QString &title, const QString &label,
QLineEdit::EchoMode echo = QLineEdit::Normal,
@@ -195,7 +189,7 @@ Q_SIGNALS:
void doubleValueSelected(double value);
public:
- void done(int result);
+ void done(int result) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QInputDialog)
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index effcef2bc9..e4862f16d1 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -89,7 +89,7 @@ public:
{
public:
TextEdit(QWidget *parent=0) : QTextEdit(parent) { }
- void contextMenuEvent(QContextMenuEvent * e)
+ void contextMenuEvent(QContextMenuEvent * e) Q_DECL_OVERRIDE
{
#ifndef QT_NO_CONTEXTMENU
QMenu *menu = createStandardContextMenu();
@@ -167,7 +167,7 @@ public:
void setLabel(DetailButtonLabel lbl)
{ setText(label(lbl)); }
- QSize sizeHint() const
+ QSize sizeHint() const Q_DECL_OVERRIDE
{
ensurePolished();
QStyleOptionButton opt;
@@ -256,9 +256,9 @@ public:
QByteArray signalToDisconnectOnClose;
QSharedPointer<QMessageDialogOptions> options;
private:
- void initHelper(QPlatformDialogHelper *);
- void helperPrepareShow(QPlatformDialogHelper *);
- void helperDone(QDialog::DialogCode, QPlatformDialogHelper *);
+ void initHelper(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
+ void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
+ void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) Q_DECL_OVERRIDE;
};
void QMessageBoxPrivate::init(const QString &title, const QString &text)
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index 1b47e9c575..f75331c967 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -140,13 +140,7 @@ public:
void setVisible(bool visible);
#endif
-#ifdef Q_NO_USING_KEYWORD
-#ifndef Q_QDOC
- void open() { QDialog::open(); }
-#endif
-#else
using QDialog::open;
-#endif
void open(QObject *receiver, const char *member);
QList<QAbstractButton *> buttons() const;
@@ -293,12 +287,12 @@ public Q_SLOTS:
#endif
protected:
- bool event(QEvent *e);
- void resizeEvent(QResizeEvent *event);
- void showEvent(QShowEvent *event);
- void closeEvent(QCloseEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void changeEvent(QEvent *event);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
private:
Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *))
diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h
index 7547f06682..2b7a14aed3 100644
--- a/src/widgets/dialogs/qprogressdialog.h
+++ b/src/widgets/dialogs/qprogressdialog.h
@@ -77,7 +77,7 @@ public:
int value() const;
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
QString labelText() const;
int minimumDuration() const;
@@ -87,13 +87,7 @@ public:
void setAutoClose(bool close);
bool autoClose() const;
-#ifdef Q_NO_USING_KEYWORD
-#ifndef Q_QDOC
- void open() { QDialog::open(); }
-#endif
-#else
using QDialog::open;
-#endif
void open(QObject *receiver, const char *member);
public Q_SLOTS:
@@ -111,10 +105,10 @@ Q_SIGNALS:
void canceled();
protected:
- void resizeEvent(QResizeEvent *event);
- void closeEvent(QCloseEvent *event);
- void changeEvent(QEvent *event);
- void showEvent(QShowEvent *event);
+ void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
protected Q_SLOTS:
void forceShow();
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 402863da85..e90fe5e636 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -61,7 +61,7 @@ class QSideBarDelegate : public QStyledItemDelegate
public:
QSideBarDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {}
void initStyleOption(QStyleOptionViewItem *option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
};
class Q_AUTOTEST_EXPORT QUrlModel : public QStandardItemModel
@@ -76,14 +76,14 @@ public:
QUrlModel(QObject *parent = 0);
- QStringList mimeTypes() const;
- QMimeData *mimeData(const QModelIndexList &indexes) const;
+ QStringList mimeTypes() const Q_DECL_OVERRIDE;
+ QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
bool canDrop(QDragEnterEvent *event);
- bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
+ bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
#endif
- Qt::ItemFlags flags(const QModelIndex &index) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);
+ Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) Q_DECL_OVERRIDE;
void setUrls(const QList<QUrl> &list);
void addUrls(const QList<QUrl> &urls, int row = -1, bool move = true);
@@ -116,7 +116,7 @@ public:
void setModelAndUrls(QFileSystemModel *model, const QList<QUrl> &newUrls);
~QSidebar();
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
void setUrls(const QList<QUrl> &list) { urlModel->setUrls(list); }
void addUrls(const QList<QUrl> &list, int row) { urlModel->addUrls(list, row); }
@@ -125,10 +125,10 @@ public:
void selectUrl(const QUrl &url);
protected:
- bool event(QEvent * e);
- void focusInEvent(QFocusEvent *event);
+ bool event(QEvent * e) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
#endif
private Q_SLOTS:
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index a378daa3d3..35ff6d73f1 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -290,7 +290,7 @@ public:
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat);
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
private:
bool vistaDisabled() const;
@@ -446,7 +446,7 @@ public:
m_layout->addWidget(m_sideWidget);
}
- QSize minimumSizeHint() const {
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE {
if (!pixmap() && !pixmap()->isNull())
return pixmap()->size();
return QFrame::minimumSizeHint();
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 25b0d5e3ee..7ceddf5049 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -161,8 +161,8 @@ public:
void setDefaultProperty(const char *className, const char *property,
const char *changedSignal);
- void setVisible(bool visible);
- QSize sizeHint() const;
+ void setVisible(bool visible) Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
Q_SIGNALS:
void currentIdChanged(int id);
@@ -177,13 +177,13 @@ public Q_SLOTS:
void restart();
protected:
- bool event(QEvent *event);
- void resizeEvent(QResizeEvent *event);
- void paintEvent(QPaintEvent *event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
#ifdef Q_OS_WIN
bool nativeEvent(const QByteArray &eventType, void * message, long * result);
#endif
- void done(int result);
+ void done(int result) Q_DECL_OVERRIDE;
virtual void initializePage(int id);
virtual void cleanupPage(int id);
diff --git a/src/widgets/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h
index a7db19431d..bdb1770f83 100644
--- a/src/widgets/effects/qgraphicseffect.h
+++ b/src/widgets/effects/qgraphicseffect.h
@@ -137,7 +137,7 @@ Q_SIGNALS:
void strengthChanged(qreal strength);
protected:
- void draw(QPainter *painter);
+ void draw(QPainter *painter) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QGraphicsColorizeEffect)
@@ -162,7 +162,7 @@ public:
QGraphicsBlurEffect(QObject *parent = 0);
~QGraphicsBlurEffect();
- QRectF boundingRectFor(const QRectF &rect) const;
+ QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
qreal blurRadius() const;
BlurHints blurHints() const;
@@ -175,7 +175,7 @@ Q_SIGNALS:
void blurHintsChanged(BlurHints hints);
protected:
- void draw(QPainter *painter);
+ void draw(QPainter *painter) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QGraphicsBlurEffect)
@@ -197,7 +197,7 @@ public:
QGraphicsDropShadowEffect(QObject *parent = 0);
~QGraphicsDropShadowEffect();
- QRectF boundingRectFor(const QRectF &rect) const;
+ QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
QPointF offset() const;
inline qreal xOffset() const
@@ -233,7 +233,7 @@ Q_SIGNALS:
void colorChanged(const QColor &color);
protected:
- void draw(QPainter *painter);
+ void draw(QPainter *painter) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QGraphicsDropShadowEffect)
@@ -262,7 +262,7 @@ Q_SIGNALS:
void opacityMaskChanged(const QBrush &mask);
protected:
- void draw(QPainter *painter);
+ void draw(QPainter *painter) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QGraphicsOpacityEffect)
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 6f618b8914..e4e409a542 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -705,7 +705,8 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp
Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied
|| img.format() == QImage::Format_RGB32
- || img.format() == QImage::Format_Indexed8);
+ || img.format() == QImage::Format_Indexed8
+ || img.format() == QImage::Format_Grayscale8);
// choose the alpha such that pixels at radius distance from a fully
// saturated pixel will have an alpha component of no greater than
@@ -780,7 +781,7 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source)
QImage srcImage = source;
- if (source.format() == QImage::Format_Indexed8) {
+ if (source.format() == QImage::Format_Indexed8 || source.format() == QImage::Format_Grayscale8) {
// assumes grayscale
QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
@@ -890,7 +891,7 @@ Q_WIDGETS_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius,
Q_WIDGETS_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0)
{
- if (blurImage.format() == QImage::Format_Indexed8)
+ if (blurImage.format() == QImage::Format_Indexed8 || blurImage.format() == QImage::Format_Grayscale8)
expblur<12, 10, true>(blurImage, radius, quality, transposed);
else
expblur<12, 10, false>(blurImage, radius, quality, transposed);
diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h
index 22925f66cf..6f71bd93e0 100644
--- a/src/widgets/effects/qpixmapfilter_p.h
+++ b/src/widgets/effects/qpixmapfilter_p.h
@@ -98,8 +98,8 @@ public:
void setConvolutionKernel(const qreal *matrix, int rows, int columns);
- QRectF boundingRectFor(const QRectF &rect) const;
- void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const;
+ QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
+ void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const Q_DECL_OVERRIDE;
private:
friend class QGLPixmapConvolutionFilter;
@@ -126,8 +126,8 @@ public:
qreal radius() const;
QGraphicsBlurEffect::BlurHints blurHints() const;
- QRectF boundingRectFor(const QRectF &rect) const;
- void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const;
+ QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
+ void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const Q_DECL_OVERRIDE;
private:
friend class QGLPixmapBlurFilter;
@@ -149,7 +149,7 @@ public:
void setStrength(qreal strength);
qreal strength() const;
- void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const;
+ void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const Q_DECL_OVERRIDE;
};
class QPixmapDropShadowFilterPrivate;
@@ -163,8 +163,8 @@ public:
QPixmapDropShadowFilter(QObject *parent = 0);
~QPixmapDropShadowFilter();
- QRectF boundingRectFor(const QRectF &rect) const;
- void draw(QPainter *p, const QPointF &pos, const QPixmap &px, const QRectF &src = QRectF()) const;
+ QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
+ void draw(QPainter *p, const QPointF &pos, const QPixmap &px, const QRectF &src = QRectF()) const Q_DECL_OVERRIDE;
qreal blurRadius() const;
void setBlurRadius(qreal radius);
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.h b/src/widgets/graphicsview/qgraphicsanchorlayout.h
index 13494dd81a..cec85f8430 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.h
@@ -92,14 +92,14 @@ public:
qreal horizontalSpacing() const;
qreal verticalSpacing() const;
- void removeAt(int index);
- void setGeometry(const QRectF &rect);
- int count() const;
- QGraphicsLayoutItem *itemAt(int index) const;
+ void removeAt(int index) Q_DECL_OVERRIDE;
+ void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
+ int count() const Q_DECL_OVERRIDE;
+ QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- void invalidate();
+ void invalidate() Q_DECL_OVERRIDE;
protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsAnchorLayout)
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
index 457a5a2769..96ca7544ee 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
@@ -189,7 +189,7 @@ struct SequentialAnchorData : public AnchorData
#endif
}
- virtual void updateChildrenSizes();
+ virtual void updateChildrenSizes() Q_DECL_OVERRIDE;
void calculateSizeHints();
QVector<AnchorVertex*> m_children; // list of vertices in the sequence
@@ -217,7 +217,7 @@ struct ParallelAnchorData : public AnchorData
#endif
}
- virtual void updateChildrenSizes();
+ virtual void updateChildrenSizes() Q_DECL_OVERRIDE;
bool calculateSizeHints();
bool secondForward() const {
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
index 9720bbf9ba..5f689edef6 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
@@ -108,7 +108,6 @@ QGraphicsLayoutStyleInfo *QGraphicsGridLayoutPrivate::styleInfo() const
{
if (!m_styleInfo)
m_styleInfo = new QGraphicsLayoutStyleInfo(this);
- m_styleInfo->updateChanged(QAbstractLayoutStyleInfo::Unknown);
return m_styleInfo;
}
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.h b/src/widgets/graphicsview/qgraphicsgridlayout.h
index 26b6daa96f..43400c3ce4 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.h
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.h
@@ -100,16 +100,16 @@ public:
QGraphicsLayoutItem *itemAt(int row, int column) const;
// inherited from QGraphicsLayout
- int count() const;
- QGraphicsLayoutItem *itemAt(int index) const;
- void removeAt(int index);
+ int count() const Q_DECL_OVERRIDE;
+ QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
+ void removeAt(int index) Q_DECL_OVERRIDE;
void removeItem(QGraphicsLayoutItem *item);
- void invalidate();
+ void invalidate() Q_DECL_OVERRIDE;
// inherited from QGraphicsLayoutItem
- void setGeometry(const QRectF &rect);
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+ void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
// ####
//QRect cellRect(int row, int column, int rowSpan = 1, int columnSpan = 1) const;
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index a543445244..3e9294343e 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -8034,16 +8034,6 @@ void QGraphicsItemPrivate::resetHeight()
*/
/*!
- \fn const QObjectList &QGraphicsObject::children() const
- \internal
-
- This function returns the same value as QObject::children(). It's
- provided to differentiate between the obsolete member
- QGraphicsItem::children() and QObject::children(). QGraphicsItem now
- provides childItems() instead.
-*/
-
-/*!
\property QGraphicsObject::transformOriginPoint
\brief the transformation origin
diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h
index 3a238390d7..4435840e22 100644
--- a/src/widgets/graphicsview/qgraphicsitem.h
+++ b/src/widgets/graphicsview/qgraphicsitem.h
@@ -556,11 +556,7 @@ public:
explicit QGraphicsObject(QGraphicsItem *parent = 0);
~QGraphicsObject();
-#ifdef Q_NO_USING_KEYWORD
- const QObjectList &children() const { return QObject::children(); }
-#else
using QObject::children;
-#endif
#ifndef QT_NO_GESTURES
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
@@ -587,7 +583,7 @@ Q_SIGNALS:
protected:
QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent);
- bool event(QEvent *ev);
+ bool event(QEvent *ev) Q_DECL_OVERRIDE;
private:
friend class QGraphicsItem;
@@ -608,8 +604,8 @@ public:
QBrush brush() const;
void setBrush(const QBrush &brush);
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
protected:
QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd,
@@ -631,22 +627,22 @@ public:
QPainterPath path() const;
void setPath(const QPainterPath &path);
- QRectF boundingRect() const;
- QPainterPath shape() const;
- bool contains(const QPointF &point) const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
+ bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
enum { Type = 2 };
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
protected:
- bool supportsExtension(Extension extension) const;
- void setExtension(Extension extension, const QVariant &variant);
- QVariant extension(const QVariant &variant) const;
+ bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
+ QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsPathItem)
@@ -666,22 +662,22 @@ public:
void setRect(const QRectF &rect);
inline void setRect(qreal x, qreal y, qreal w, qreal h);
- QRectF boundingRect() const;
- QPainterPath shape() const;
- bool contains(const QPointF &point) const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
+ bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
enum { Type = 3 };
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
protected:
- bool supportsExtension(Extension extension) const;
- void setExtension(Extension extension, const QVariant &variant);
- QVariant extension(const QVariant &variant) const;
+ bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
+ QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsRectItem)
@@ -710,22 +706,22 @@ public:
int spanAngle() const;
void setSpanAngle(int angle);
- QRectF boundingRect() const;
- QPainterPath shape() const;
- bool contains(const QPointF &point) const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
+ bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
enum { Type = 4 };
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
protected:
- bool supportsExtension(Extension extension) const;
- void setExtension(Extension extension, const QVariant &variant);
- QVariant extension(const QVariant &variant) const;
+ bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
+ QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsEllipseItem)
@@ -750,22 +746,22 @@ public:
Qt::FillRule fillRule() const;
void setFillRule(Qt::FillRule rule);
- QRectF boundingRect() const;
- QPainterPath shape() const;
- bool contains(const QPointF &point) const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
+ bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
enum { Type = 5 };
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
protected:
- bool supportsExtension(Extension extension) const;
- void setExtension(Extension extension, const QVariant &variant);
- QVariant extension(const QVariant &variant) const;
+ bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
+ QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsPolygonItem)
@@ -789,22 +785,22 @@ public:
inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2)
{ setLine(QLineF(x1, y1, x2, y2)); }
- QRectF boundingRect() const;
- QPainterPath shape() const;
- bool contains(const QPointF &point) const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
+ bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
enum { Type = 6 };
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
protected:
- bool supportsExtension(Extension extension) const;
- void setExtension(Extension extension, const QVariant &variant);
- QVariant extension(const QVariant &variant) const;
+ bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
+ QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsLineItem)
@@ -835,25 +831,25 @@ public:
void setOffset(const QPointF &offset);
inline void setOffset(qreal x, qreal y);
- QRectF boundingRect() const;
- QPainterPath shape() const;
- bool contains(const QPointF &point) const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
+ bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
enum { Type = 7 };
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
ShapeMode shapeMode() const;
void setShapeMode(ShapeMode mode);
protected:
- bool supportsExtension(Extension extension) const;
- void setExtension(Extension extension, const QVariant &variant);
- QVariant extension(const QVariant &variant) const;
+ bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
+ QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsPixmapItem)
@@ -889,17 +885,17 @@ public:
void setDefaultTextColor(const QColor &c);
QColor defaultTextColor() const;
- QRectF boundingRect() const;
- QPainterPath shape() const;
- bool contains(const QPointF &point) const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
+ bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
enum { Type = 8 };
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
void setTextWidth(qreal width);
qreal textWidth() const;
@@ -926,30 +922,30 @@ Q_SIGNALS:
void linkHovered(const QString &);
protected:
- bool sceneEvent(QEvent *event);
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
- void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
- void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *event);
- void focusInEvent(QFocusEvent *event);
- void focusOutEvent(QFocusEvent *event);
- void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
- void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
- void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
- void dropEvent(QGraphicsSceneDragDropEvent *event);
- void inputMethodEvent(QInputMethodEvent *event);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
-
- QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
-
- bool supportsExtension(Extension extension) const;
- void setExtension(Extension extension, const QVariant &variant);
- QVariant extension(const QVariant &variant) const;
+ bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
+
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
+
+ bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
+ QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsTextItem)
@@ -974,22 +970,22 @@ public:
void setFont(const QFont &font);
QFont font() const;
- QRectF boundingRect() const;
- QPainterPath shape() const;
- bool contains(const QPointF &point) const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
+ bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
enum { Type = 9 };
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
protected:
- bool supportsExtension(Extension extension) const;
- void setExtension(Extension extension, const QVariant &variant);
- QVariant extension(const QVariant &variant) const;
+ bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
+ QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsSimpleTextItem)
@@ -1006,14 +1002,14 @@ public:
void addToGroup(QGraphicsItem *item);
void removeFromGroup(QGraphicsItem *item);
- QRectF boundingRect() const;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
- bool isObscuredBy(const QGraphicsItem *item) const;
- QPainterPath opaqueArea() const;
+ bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
+ QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
enum { Type = 10 };
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGraphicsItemGroup)
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index f1986a5072..4af39cac2f 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -699,11 +699,11 @@ public:
return info->widget->rect();
}
- QRectF boundingRect(Qt::CoordinateSystem system) const;
- void draw(QPainter *);
+ QRectF boundingRect(Qt::CoordinateSystem system) const Q_DECL_OVERRIDE;
+ void draw(QPainter *) Q_DECL_OVERRIDE;
QPixmap pixmap(Qt::CoordinateSystem system,
QPoint *offset,
- QGraphicsEffect::PixmapPadMode mode) const;
+ QGraphicsEffect::PixmapPadMode mode) const Q_DECL_OVERRIDE;
QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded = 0) const;
QGraphicsItem *item;
diff --git a/src/widgets/graphicsview/qgraphicslayout.h b/src/widgets/graphicsview/qgraphicslayout.h
index 83004e36f9..226c3984cf 100644
--- a/src/widgets/graphicsview/qgraphicslayout.h
+++ b/src/widgets/graphicsview/qgraphicslayout.h
@@ -52,12 +52,12 @@ public:
~QGraphicsLayout();
void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom);
- void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const;
+ void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const Q_DECL_OVERRIDE;
void activate();
bool isActivated() const;
virtual void invalidate();
- virtual void updateGeometry();
+ virtual void updateGeometry() Q_DECL_OVERRIDE;
virtual void widgetEvent(QEvent *e);
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h
index a45cb31b28..698118eb75 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.h
+++ b/src/widgets/graphicsview/qgraphicslayout_p.h
@@ -65,7 +65,7 @@ inline bool qt_graphicsLayoutDebug()
{
static int checked_env = -1;
if(checked_env == -1)
- checked_env = !!qgetenv("QT_GRAPHICSLAYOUT_DEBUG").toInt();
+ checked_env = !!qEnvironmentVariableIntValue("QT_GRAPHICSLAYOUT_DEBUG");
return checked_env;
}
#endif
diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h
index 9e216c8200..1cf94d3962 100644
--- a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h
+++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h
@@ -77,13 +77,6 @@ public:
QAbstractLayoutStyleInfo::invalidate();
}
- virtual bool hasChangedCore() const Q_DECL_OVERRIDE
- {
- QStyle *s = m_style;
- // Note that style() will change m_style
- return s != style();
- }
-
QWidget *widget() const;
QStyle *style() const;
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
index cad049c30a..baf68d6eef 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
@@ -173,7 +173,6 @@ QGraphicsLayoutStyleInfo *QGraphicsLinearLayoutPrivate::styleInfo() const
{
if (!m_styleInfo)
m_styleInfo = new QGraphicsLayoutStyleInfo(this);
- m_styleInfo->updateChanged(QAbstractLayoutStyleInfo::Unknown);
return m_styleInfo;
}
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.h b/src/widgets/graphicsview/qgraphicslinearlayout.h
index 28c6fb4813..2602ea2a51 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.h
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.h
@@ -61,7 +61,7 @@ public:
void insertStretch(int index, int stretch = 1);
void removeItem(QGraphicsLayoutItem *item);
- void removeAt(int index);
+ void removeAt(int index) Q_DECL_OVERRIDE;
void setSpacing(qreal spacing);
qreal spacing() const;
@@ -74,13 +74,13 @@ public:
void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment);
Qt::Alignment alignment(QGraphicsLayoutItem *item) const;
- void setGeometry(const QRectF &rect);
+ void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
- int count() const;
- QGraphicsLayoutItem *itemAt(int index) const;
+ int count() const Q_DECL_OVERRIDE;
+ QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- void invalidate();
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+ void invalidate() Q_DECL_OVERRIDE;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
#if 0 // ###
Q5SizePolicy::ControlTypes controlTypes(LayoutSide side) const;
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h
index 765caea0b1..c2bd73e056 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.h
@@ -55,63 +55,63 @@ public:
QRectF subWidgetRect(const QWidget *widget) const;
- void setGeometry(const QRectF &rect);
+ void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
enum {
Type = 12
};
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
QGraphicsProxyWidget *createProxyForChildWidget(QWidget *child);
protected:
- QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
- bool event(QEvent *event);
- bool eventFilter(QObject *object, QEvent *event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *event);
- void hideEvent(QHideEvent *event);
+ void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
+ void hideEvent(QHideEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
+ void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
#endif
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
- void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
- void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
- void dropEvent(QGraphicsSceneDragDropEvent *event);
+ void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
#endif
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
- void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
- void grabMouseEvent(QEvent *event);
- void ungrabMouseEvent(QEvent *event);
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
+ void grabMouseEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void ungrabMouseEvent(QEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
- void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QGraphicsSceneWheelEvent *event);
+ void wheelEvent(QGraphicsSceneWheelEvent *event) Q_DECL_OVERRIDE;
#endif
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void focusInEvent(QFocusEvent *event);
- void focusOutEvent(QFocusEvent *event);
- bool focusNextPrevChild(bool next);
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
- QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
- void inputMethodEvent(QInputMethodEvent *event);
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
+ void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
- void resizeEvent(QGraphicsSceneResizeEvent *event);
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
+ void resizeEvent(QGraphicsSceneResizeEvent *event) Q_DECL_OVERRIDE;
protected Q_SLOTS:
QGraphicsProxyWidget *newProxyWidget(const QWidget *);
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 988152da9d..8765b8114d 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -4910,7 +4910,7 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q
if (painterStateProtection || restorePainterClip)
painter->restore();
- static int drawRect = qgetenv("QT_DRAW_SCENE_ITEM_RECTS").toInt();
+ static int drawRect = qEnvironmentVariableIntValue("QT_DRAW_SCENE_ITEM_RECTS");
if (drawRect) {
QPen oldPen = painter->pen();
QBrush oldBrush = painter->brush();
diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h
index 24255c3b30..6cd5da00c8 100644
--- a/src/widgets/graphicsview/qgraphicsscene.h
+++ b/src/widgets/graphicsview/qgraphicsscene.h
@@ -253,8 +253,8 @@ public Q_SLOTS:
void clear();
protected:
- bool event(QEvent *event);
- bool eventFilter(QObject *watched, QEvent *event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
index 739acecf5b..9a2932d127 100644
--- a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
@@ -45,7 +45,7 @@ class QGraphicsSceneInsertItemBspTreeVisitor : public QGraphicsSceneBspTreeVisit
public:
QGraphicsItem *item;
- void visit(QList<QGraphicsItem *> *items)
+ void visit(QList<QGraphicsItem *> *items) Q_DECL_OVERRIDE
{ items->prepend(item); }
};
@@ -54,7 +54,7 @@ class QGraphicsSceneRemoveItemBspTreeVisitor : public QGraphicsSceneBspTreeVisit
public:
QGraphicsItem *item;
- void visit(QList<QGraphicsItem *> *items)
+ void visit(QList<QGraphicsItem *> *items) Q_DECL_OVERRIDE
{ items->removeAll(item); }
};
@@ -64,7 +64,7 @@ public:
QList<QGraphicsItem *> *foundItems;
bool onlyTopLevelItems;
- void visit(QList<QGraphicsItem *> *items)
+ void visit(QList<QGraphicsItem *> *items) Q_DECL_OVERRIDE
{
for (int i = 0; i < items->size(); ++i) {
QGraphicsItem *item = items->at(i);
diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
index 02a3b44ff2..c329083844 100644
--- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -71,25 +71,25 @@ public:
QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0);
~QGraphicsSceneBspTreeIndex();
- QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const;
- QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const;
- QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const;
+ QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const Q_DECL_OVERRIDE;
+ QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const Q_DECL_OVERRIDE;
+ QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const Q_DECL_OVERRIDE;
int bspTreeDepth() const;
void setBspTreeDepth(int depth);
protected Q_SLOTS:
- void updateSceneRect(const QRectF &rect);
+ void updateSceneRect(const QRectF &rect) Q_DECL_OVERRIDE;
protected:
- bool event(QEvent *event);
- void clear();
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void clear() Q_DECL_OVERRIDE;
- void addItem(QGraphicsItem *item);
- void removeItem(QGraphicsItem *item);
- void prepareBoundingRectChange(const QGraphicsItem *item);
+ void addItem(QGraphicsItem *item) Q_DECL_OVERRIDE;
+ void removeItem(QGraphicsItem *item) Q_DECL_OVERRIDE;
+ void prepareBoundingRectChange(const QGraphicsItem *item) Q_DECL_OVERRIDE;
- void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const void *const value);
+ void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const void *const value) Q_DECL_OVERRIDE;
private :
Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex)
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
index 57d4ce9702..691e030a89 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
@@ -65,10 +65,10 @@ public:
QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0) : QGraphicsSceneIndex(scene), m_numSortedElements(0)
{ }
- QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const
+ QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const Q_DECL_OVERRIDE
{ Q_UNUSED(order); return m_items; }
- virtual QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const
+ virtual QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const Q_DECL_OVERRIDE
{
Q_UNUSED(rect);
Q_UNUSED(order);
@@ -76,16 +76,16 @@ public:
}
protected :
- virtual void clear()
+ virtual void clear() Q_DECL_OVERRIDE
{
m_items.clear();
m_numSortedElements = 0;
}
- virtual void addItem(QGraphicsItem *item)
+ virtual void addItem(QGraphicsItem *item) Q_DECL_OVERRIDE
{ m_items << item; }
- virtual void removeItem(QGraphicsItem *item)
+ virtual void removeItem(QGraphicsItem *item) Q_DECL_OVERRIDE
{
// Sort m_items if needed
if (m_numSortedElements < m_items.size())
diff --git a/src/widgets/graphicsview/qgraphicstransform.h b/src/widgets/graphicsview/qgraphicstransform.h
index db8b574515..c2ee71d78d 100644
--- a/src/widgets/graphicsview/qgraphicstransform.h
+++ b/src/widgets/graphicsview/qgraphicstransform.h
@@ -93,7 +93,7 @@ public:
qreal zScale() const;
void setZScale(qreal);
- void applyTo(QMatrix4x4 *matrix) const;
+ void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE;
Q_SIGNALS:
void originChanged();
@@ -129,7 +129,7 @@ public:
void setAxis(const QVector3D &axis);
void setAxis(Qt::Axis axis);
- void applyTo(QMatrix4x4 *matrix) const;
+ void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE;
Q_SIGNALS:
void originChanged();
diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h
index b681551fe7..39c28a1b64 100644
--- a/src/widgets/graphicsview/qgraphicsview.h
+++ b/src/widgets/graphicsview/qgraphicsview.h
@@ -110,7 +110,7 @@ public:
QGraphicsView(QGraphicsScene *scene, QWidget *parent = 0);
~QGraphicsView();
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
QPainter::RenderHints renderHints() const;
void setRenderHint(QPainter::RenderHint hint, bool enabled = true);
@@ -206,7 +206,7 @@ public:
inline QPoint mapFromScene(qreal x, qreal y) const;
inline QPolygon mapFromScene(qreal x, qreal y, qreal w, qreal h) const;
- QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
QBrush backgroundBrush() const;
void setBackgroundBrush(const QBrush &brush);
@@ -225,37 +225,37 @@ Q_SIGNALS:
#endif
protected Q_SLOTS:
- void setupViewport(QWidget *widget);
+ void setupViewport(QWidget *widget) Q_DECL_OVERRIDE;
protected:
QGraphicsView(QGraphicsViewPrivate &, QWidget *parent = 0);
- bool event(QEvent *event);
- bool viewportEvent(QEvent *event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *event);
+ void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
#endif
- void dragEnterEvent(QDragEnterEvent *event);
- void dragLeaveEvent(QDragLeaveEvent *event);
- void dragMoveEvent(QDragMoveEvent *event);
- void dropEvent(QDropEvent *event);
- void focusInEvent(QFocusEvent *event);
- bool focusNextPrevChild(bool next);
- void focusOutEvent(QFocusEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *event);
+ void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
#endif
- void paintEvent(QPaintEvent *event);
- void resizeEvent(QResizeEvent *event);
- void scrollContentsBy(int dx, int dy);
- void showEvent(QShowEvent *event);
- void inputMethodEvent(QInputMethodEvent *event);
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
+ void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
virtual void drawBackground(QPainter *painter, const QRectF &rect);
virtual void drawForeground(QPainter *painter, const QRectF &rect);
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index 5bd563e535..fd4f66e3a8 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -2390,18 +2390,6 @@ bool QGraphicsWidget::close()
return true;
}
-#ifdef Q_NO_USING_KEYWORD
-/*!
- \fn const QObjectList &QGraphicsWidget::children() const
- \internal
-
- This function returns the same value as QObject::children(). It's
- provided to differentiate between the obsolete member
- QGraphicsItem::children() and QObject::children(). QGraphicsItem now
- provides childItems() instead.
-*/
-#endif
-
#if 0
void QGraphicsWidget::dumpFocusChain()
{
diff --git a/src/widgets/graphicsview/qgraphicswidget.h b/src/widgets/graphicsview/qgraphicswidget.h
index d0f3ac9af6..7999add64e 100644
--- a/src/widgets/graphicsview/qgraphicswidget.h
+++ b/src/widgets/graphicsview/qgraphicswidget.h
@@ -100,12 +100,12 @@ public:
inline void resize(qreal w, qreal h) { resize(QSizeF(w, h)); }
QSizeF size() const;
- void setGeometry(const QRectF &rect);
+ void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
inline void setGeometry(qreal x, qreal y, qreal w, qreal h);
inline QRectF rect() const { return QRectF(QPointF(), size()); }
void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom);
- void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const;
+ void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const Q_DECL_OVERRIDE;
void setWindowFrameMargins(qreal left, qreal top, qreal right, qreal bottom);
void getWindowFrameMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const;
@@ -150,22 +150,18 @@ public:
enum {
Type = 11
};
- int type() const;
+ int type() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
virtual void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
- QRectF boundingRect() const;
- QPainterPath shape() const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
#if 0
void dumpFocusChain();
#endif
-#ifdef Q_NO_USING_KEYWORD
- const QObjectList &children() const { return QObject::children(); }
-#else
using QObject::children;
-#endif
Q_SIGNALS:
void geometryChanged();
@@ -177,28 +173,28 @@ public Q_SLOTS:
protected:
virtual void initStyleOption(QStyleOption *option) const;
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
- void updateGeometry();
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
+ void updateGeometry() Q_DECL_OVERRIDE;
// Notification
- QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
virtual QVariant propertyChange(const QString &propertyName, const QVariant &value);
// Scene events
- bool sceneEvent(QEvent *event);
+ bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE;
virtual bool windowFrameEvent(QEvent *e);
virtual Qt::WindowFrameSection windowFrameSectionAt(const QPointF& pos) const;
// Base event handlers
- bool event(QEvent *event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
//virtual void actionEvent(QActionEvent *event);
virtual void changeEvent(QEvent *event);
virtual void closeEvent(QCloseEvent *event);
//void create(WId window = 0, bool initializeWindow = true, bool destroyOldWindow = true);
//void destroy(bool destroyWindow = true, bool destroySubWindows = true);
- void focusInEvent(QFocusEvent *event);
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
virtual bool focusNextPrevChild(bool next);
- void focusOutEvent(QFocusEvent *event);
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
virtual void hideEvent(QHideEvent *event);
//virtual int metric(PaintDeviceMetric m ) const;
virtual void moveEvent(QGraphicsSceneMoveEvent *event);
@@ -207,8 +203,8 @@ protected:
virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
virtual void showEvent(QShowEvent *event);
//virtual void tabletEvent(QTabletEvent *event);
- virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
- virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+ virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
+ virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
virtual void grabMouseEvent(QEvent *event);
virtual void ungrabMouseEvent(QEvent *event);
virtual void grabKeyboardEvent(QEvent *event);
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.h b/src/widgets/graphicsview/qgraphicswidget_p.h
index 2cb6565f87..16bf2e7c51 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.h
+++ b/src/widgets/graphicsview/qgraphicswidget_p.h
@@ -103,13 +103,13 @@ public:
QPalette palette;
uint inheritedPaletteResolveMask;
void setPalette_helper(const QPalette &palette);
- void resolvePalette(uint inheritedMask);
+ void resolvePalette(uint inheritedMask) Q_DECL_OVERRIDE;
void updatePalette(const QPalette &palette);
QPalette naturalWidgetPalette() const;
QFont font;
uint inheritedFontResolveMask;
void setFont_helper(const QFont &font);
- void resolveFont(uint inheritedMask);
+ void resolveFont(uint inheritedMask) Q_DECL_OVERRIDE;
void updateFont(const QFont &font);
QFont naturalWidgetFont() const;
@@ -124,13 +124,13 @@ public:
bool hasDecoration() const;
// Private Properties
- qreal width() const;
- void setWidth(qreal);
- void resetWidth();
+ qreal width() const Q_DECL_OVERRIDE;
+ void setWidth(qreal) Q_DECL_OVERRIDE;
+ void resetWidth() Q_DECL_OVERRIDE;
- qreal height() const;
- void setHeight(qreal);
- void resetHeight();
+ qreal height() const Q_DECL_OVERRIDE;
+ void setHeight(qreal) Q_DECL_OVERRIDE;
+ void resetHeight() Q_DECL_OVERRIDE;
void setGeometryFromSetPos();
// State
diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri
index 4e152d18bb..2bbf7ac1ff 100644
--- a/src/widgets/itemviews/itemviews.pri
+++ b/src/widgets/itemviews/itemviews.pri
@@ -12,6 +12,7 @@ HEADERS += \
itemviews/qtreeview.h \
itemviews/qtreeview_p.h \
itemviews/qabstractitemdelegate.h \
+ itemviews/qabstractitemdelegate_p.h \
itemviews/qitemdelegate.h \
itemviews/qdirmodel.h \
itemviews/qlistwidget.h \
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 4dffa6efe7..4d0840c3d6 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -42,7 +42,17 @@
#include <qevent.h>
#include <qstring.h>
#include <qdebug.h>
+#include <qlineedit.h>
+#include <qtextedit.h>
+#include <qplaintextedit.h>
+#include <qapplication.h>
#include <private/qtextengine_p.h>
+#include <private/qabstractitemdelegate_p.h>
+
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformdrag.h>
+#include <private/qguiapplication_p.h>
+#include <private/qdnd_p.h>
QT_BEGIN_NAMESPACE
@@ -165,7 +175,7 @@ QT_BEGIN_NAMESPACE
Creates a new abstract item delegate with the given \a parent.
*/
QAbstractItemDelegate::QAbstractItemDelegate(QObject *parent)
- : QObject(parent)
+ : QObject(*new QAbstractItemDelegatePrivate, parent)
{
}
@@ -405,6 +415,112 @@ QVector<int> QAbstractItemDelegate::paintingRoles() const
return QVector<int>();
}
+QAbstractItemDelegatePrivate::QAbstractItemDelegatePrivate()
+ : QObjectPrivate()
+{
+}
+
+bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *event)
+{
+ Q_Q(QAbstractItemDelegate);
+
+ QWidget *editor = qobject_cast<QWidget*>(object);
+ if (!editor)
+ return false;
+ if (event->type() == QEvent::KeyPress) {
+ switch (static_cast<QKeyEvent *>(event)->key()) {
+ case Qt::Key_Tab:
+ if (tryFixup(editor)) {
+ emit q->commitData(editor);
+ emit q->closeEditor(editor, QAbstractItemDelegate::EditNextItem);
+ }
+ return true;
+ case Qt::Key_Backtab:
+ if (tryFixup(editor)) {
+ emit q->commitData(editor);
+ emit q->closeEditor(editor, QAbstractItemDelegate::EditPreviousItem);
+ }
+ return true;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+#ifndef QT_NO_TEXTEDIT
+ if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor))
+ return false; // don't filter enter key events for QTextEdit or QPlainTextEdit
+#endif // QT_NO_TEXTEDIT
+ // We want the editor to be able to process the key press
+ // before committing the data (e.g. so it can do
+ // validation/fixup of the input).
+ if (!tryFixup(editor))
+ return true;
+
+ QMetaObject::invokeMethod(q, "_q_commitDataAndCloseEditor",
+ Qt::QueuedConnection, Q_ARG(QWidget*, editor));
+ return false;
+ case Qt::Key_Escape:
+ // don't commit data
+ emit q->closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
+ return true;
+ default:
+ return false;
+ }
+ } else if (event->type() == QEvent::FocusOut || (event->type() == QEvent::Hide && editor->isWindow())) {
+ //the Hide event will take care of he editors that are in fact complete dialogs
+ if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) {
+ QWidget *w = QApplication::focusWidget();
+ while (w) { // don't worry about focus changes internally in the editor
+ if (w == editor)
+ return false;
+ w = w->parentWidget();
+ }
+#ifndef QT_NO_DRAGANDDROP
+ // The window may lose focus during an drag operation.
+ // i.e when dragging involves the taskbar on Windows.
+ QPlatformDrag *platformDrag = QGuiApplicationPrivate::instance()->platformIntegration()->drag();
+ if (platformDrag && platformDrag->currentDrag()) {
+ return false;
+ }
+#endif
+ if (tryFixup(editor))
+ emit q->commitData(editor);
+
+ emit q->closeEditor(editor, QAbstractItemDelegate::NoHint);
+ }
+ } else if (event->type() == QEvent::ShortcutOverride) {
+ if (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape) {
+ event->accept();
+ return true;
+ }
+ }
+ return false;
+}
+
+bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor)
+{
+#ifndef QT_NO_LINEEDIT
+ if (QLineEdit *e = qobject_cast<QLineEdit*>(editor)) {
+ if (!e->hasAcceptableInput()) {
+ if (const QValidator *validator = e->validator()) {
+ QString text = e->text();
+ validator->fixup(text);
+ e->setText(text);
+ }
+ return e->hasAcceptableInput();
+ }
+ }
+#endif // QT_NO_LINEEDIT
+
+ return true;
+}
+
+void QAbstractItemDelegatePrivate::_q_commitDataAndCloseEditor(QWidget *editor)
+{
+ Q_Q(QAbstractItemDelegate);
+ emit q->commitData(editor);
+ emit q->closeEditor(editor, QAbstractItemDelegate::SubmitModelCache);
+}
+
QT_END_NAMESPACE
+#include "moc_qabstractitemdelegate.cpp"
+
#endif // QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qabstractitemdelegate.h b/src/widgets/itemviews/qabstractitemdelegate.h
index 9bce527bdc..8cd902f58e 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.h
+++ b/src/widgets/itemviews/qabstractitemdelegate.h
@@ -47,6 +47,7 @@ class QModelIndex;
class QAbstractItemModel;
class QAbstractItemView;
class QHelpEvent;
+class QAbstractItemDelegatePrivate;
class Q_WIDGETS_EXPORT QAbstractItemDelegate : public QObject
{
@@ -114,7 +115,9 @@ Q_SIGNALS:
protected:
QAbstractItemDelegate(QObjectPrivate &, QObject *parent = 0);
private:
+ Q_DECLARE_PRIVATE(QAbstractItemDelegate)
Q_DISABLE_COPY(QAbstractItemDelegate)
+ Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*))
};
#endif // QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qabstractitemdelegate_p.h b/src/widgets/itemviews/qabstractitemdelegate_p.h
new file mode 100644
index 0000000000..debc9f5926
--- /dev/null
+++ b/src/widgets/itemviews/qabstractitemdelegate_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWidgets module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QABSTRACTITEMDELEGATE_P_H
+#define QABSTRACTITEMDELEGATE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qabstractitemdelegate.h"
+#include <private/qobject_p.h>
+
+#ifndef QT_NO_ITEMVIEWS
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractItemDelegatePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QAbstractItemDelegate)
+public:
+ explicit QAbstractItemDelegatePrivate();
+
+ bool editorEventFilter(QObject *object, QEvent *event);
+ bool tryFixup(QWidget *editor);
+ void _q_commitDataAndCloseEditor(QWidget *editor);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ITEMVIEWS
+
+#endif // QABSTRACTITEMDELEGATE_P_H
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 0f346a9682..2460955eb4 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -594,11 +594,6 @@ void QAbstractItemViewPrivate::_q_scrollerStateChanged()
*/
/*!
- \fn void QAbstractItemView::update()
- \internal
-*/
-
-/*!
Constructs an abstract item view with the given \a parent.
*/
QAbstractItemView::QAbstractItemView(QWidget *parent)
@@ -1538,6 +1533,7 @@ void QAbstractItemView::setIconSize(const QSize &size)
return;
d->iconSize = size;
d->doDelayedItemsLayout();
+ emit iconSizeChanged(size);
}
QSize QAbstractItemView::iconSize() const
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index f7cdcc8451..28c43633ea 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -68,7 +68,7 @@ class Q_WIDGETS_EXPORT QAbstractItemView : public QAbstractScrollArea
Q_PROPERTY(bool alternatingRowColors READ alternatingRowColors WRITE setAlternatingRowColors)
Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode)
Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior)
- Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
+ Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged)
Q_PROPERTY(Qt::TextElideMode textElideMode READ textElideMode WRITE setTextElideMode)
Q_PROPERTY(ScrollMode verticalScrollMode READ verticalScrollMode WRITE setVerticalScrollMode)
Q_PROPERTY(ScrollMode horizontalScrollMode READ horizontalScrollMode WRITE setHorizontalScrollMode)
@@ -209,13 +209,9 @@ public:
QAbstractItemDelegate *itemDelegate(const QModelIndex &index) const;
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
+ virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
-#ifdef Q_NO_USING_KEYWORD
- inline void update() { QAbstractScrollArea::update(); }
-#else
using QAbstractScrollArea::update;
-#endif
public Q_SLOTS:
virtual void reset();
@@ -255,6 +251,8 @@ Q_SIGNALS:
void entered(const QModelIndex &index);
void viewportEntered();
+ void iconSizeChanged(const QSize &size);
+
protected:
QAbstractItemView(QAbstractItemViewPrivate &, QWidget *parent = 0);
@@ -313,25 +311,25 @@ protected:
void stopAutoScroll();
void doAutoScroll();
- bool focusNextPrevChild(bool next);
- bool event(QEvent *event);
- bool viewportEvent(QEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
+ bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *event);
- void dragMoveEvent(QDragMoveEvent *event);
- void dragLeaveEvent(QDragLeaveEvent *event);
- void dropEvent(QDropEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
#endif
- void focusInEvent(QFocusEvent *event);
- void focusOutEvent(QFocusEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void resizeEvent(QResizeEvent *event);
- void timerEvent(QTimerEvent *event);
- void inputMethodEvent(QInputMethodEvent *event);
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
enum DropIndicatorPosition { OnItem, AboveItem, BelowItem, OnViewport };
diff --git a/src/widgets/itemviews/qcolumnview.h b/src/widgets/itemviews/qcolumnview.h
index 85b38840cf..91b5c10376 100644
--- a/src/widgets/itemviews/qcolumnview.h
+++ b/src/widgets/itemviews/qcolumnview.h
@@ -56,14 +56,14 @@ public:
~QColumnView();
// QAbstractItemView overloads
- QModelIndex indexAt(const QPoint &point) const;
- void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible);
- QSize sizeHint() const;
- QRect visualRect(const QModelIndex &index) const;
- void setModel(QAbstractItemModel *model);
- void setSelectionModel(QItemSelectionModel * selectionModel);
- void setRootIndex(const QModelIndex &index);
- void selectAll();
+ QModelIndex indexAt(const QPoint &point) const Q_DECL_OVERRIDE;
+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
+ void setSelectionModel(QItemSelectionModel * selectionModel) Q_DECL_OVERRIDE;
+ void setRootIndex(const QModelIndex &index) Q_DECL_OVERRIDE;
+ void selectAll() Q_DECL_OVERRIDE;
// QColumnView functions
void setResizeGripsVisible(bool visible);
@@ -79,18 +79,18 @@ protected:
QColumnView(QColumnViewPrivate &dd, QWidget *parent = 0);
// QAbstractItemView overloads
- bool isIndexHidden(const QModelIndex &index) const;
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
- void resizeEvent(QResizeEvent *event);
- void setSelection(const QRect & rect, QItemSelectionModel::SelectionFlags command);
- QRegion visualRegionForSelection(const QItemSelection &selection) const;
- int horizontalOffset() const;
- int verticalOffset() const;
- void rowsInserted(const QModelIndex &parent, int start, int end);
- void currentChanged(const QModelIndex &current, const QModelIndex &previous);
+ bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void setSelection(const QRect & rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
+ int horizontalOffset() const Q_DECL_OVERRIDE;
+ int verticalOffset() const Q_DECL_OVERRIDE;
+ void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE;
// QColumnView functions
- void scrollContentsBy(int dx, int dy);
+ void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
virtual QAbstractItemView* createColumn(const QModelIndex &rootIndex);
void initializeColumn(QAbstractItemView *column) const;
diff --git a/src/widgets/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h
index f96170679f..29bd97e5ef 100644
--- a/src/widgets/itemviews/qcolumnview_p.h
+++ b/src/widgets/itemviews/qcolumnview_p.h
@@ -73,7 +73,7 @@ public:
setMinimumWidth(previewWidget->minimumWidth());
}
- void resizeEvent(QResizeEvent * event){
+ void resizeEvent(QResizeEvent * event) Q_DECL_OVERRIDE{
if (!previewWidget)
return;
previewWidget->resize(
@@ -89,36 +89,36 @@ public:
QAbstractScrollArea::resizeEvent(event);
}
- QRect visualRect(const QModelIndex &) const
+ QRect visualRect(const QModelIndex &) const Q_DECL_OVERRIDE
{
return QRect();
}
- void scrollTo(const QModelIndex &, ScrollHint)
+ void scrollTo(const QModelIndex &, ScrollHint) Q_DECL_OVERRIDE
{
}
- QModelIndex indexAt(const QPoint &) const
+ QModelIndex indexAt(const QPoint &) const Q_DECL_OVERRIDE
{
return QModelIndex();
}
- QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers)
+ QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) Q_DECL_OVERRIDE
{
return QModelIndex();
}
- int horizontalOffset () const {
+ int horizontalOffset () const Q_DECL_OVERRIDE {
return 0;
}
- int verticalOffset () const {
+ int verticalOffset () const Q_DECL_OVERRIDE {
return 0;
}
- QRegion visualRegionForSelection(const QItemSelection &) const
+ QRegion visualRegionForSelection(const QItemSelection &) const Q_DECL_OVERRIDE
{
return QRegion();
}
- bool isIndexHidden(const QModelIndex &) const
+ bool isIndexHidden(const QModelIndex &) const Q_DECL_OVERRIDE
{
return false;
}
- void setSelection(const QRect &, QItemSelectionModel::SelectionFlags)
+ void setSelection(const QRect &, QItemSelectionModel::SelectionFlags) Q_DECL_OVERRIDE
{
}
private:
@@ -146,7 +146,7 @@ public:
void _q_gripMoved(int offset);
void _q_changeCurrentColumn();
void _q_clicked(const QModelIndex &index);
- void _q_columnsInserted(const QModelIndex &parent, int start, int end);
+ void _q_columnsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
QList<QAbstractItemView*> columns;
QVector<int> columnSizes; // used during init and corner moving
@@ -171,7 +171,7 @@ public:
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
};
#endif // QT_NO_QCOLUMNVIEW
diff --git a/src/widgets/itemviews/qcolumnviewgrip_p.h b/src/widgets/itemviews/qcolumnviewgrip_p.h
index e5e936a30d..e80f4b37be 100644
--- a/src/widgets/itemviews/qcolumnviewgrip_p.h
+++ b/src/widgets/itemviews/qcolumnviewgrip_p.h
@@ -67,11 +67,11 @@ public:
protected:
QColumnViewGrip(QColumnViewGripPrivate &, QWidget *parent = 0, Qt::WindowFlags f = 0);
- void paintEvent(QPaintEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QColumnViewGrip)
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index 43ed0b2ae5..2cf0725657 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -202,7 +202,7 @@ void QDataWidgetMapperPrivate::_q_commitData(QWidget *w)
class QFocusHelper: public QWidget
{
public:
- bool focusNextPrevChild(bool next)
+ bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE
{
return QWidget::focusNextPrevChild(next);
}
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index 6bb8cd29c5..bff50fae0a 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -1146,11 +1146,6 @@ QFileInfo QDirModel::fileInfo(const QModelIndex &index) const
return node->info;
}
-/*!
- \fn QObject *QDirModel::parent() const
- \internal
-*/
-
/*
The root node is never seen outside the model.
*/
diff --git a/src/widgets/itemviews/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h
index 249d7711c0..56b5a247d4 100644
--- a/src/widgets/itemviews/qdirmodel.h
+++ b/src/widgets/itemviews/qdirmodel.h
@@ -64,27 +64,27 @@ public:
explicit QDirModel(QObject *parent = 0);
~QDirModel();
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &child) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool hasChildren(const QModelIndex &index = QModelIndex()) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
+ bool hasChildren(const QModelIndex &index = QModelIndex()) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE;
- QStringList mimeTypes() const;
- QMimeData *mimeData(const QModelIndexList &indexes) const;
+ QStringList mimeTypes() const Q_DECL_OVERRIDE;
+ QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent);
- Qt::DropActions supportedDropActions() const;
+ int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
+ Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
// QDirModel specific API
@@ -121,11 +121,7 @@ public:
QIcon fileIcon(const QModelIndex &index) const;
QFileInfo fileInfo(const QModelIndex &index) const;
-#ifdef Q_NO_USING_KEYWORD
- inline QObject *parent() const { return QObject::parent(); }
-#else
using QObject::parent;
-#endif
public Q_SLOTS:
void refresh(const QModelIndex &parent = QModelIndex());
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index beade16339..aad382ed49 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1515,6 +1515,11 @@ void QHeaderView::setCascadingSectionResizes(bool enable)
This property only affects sections that have \l Interactive or \l Fixed
as their resize mode.
+ By default, the value of this property is style dependent.
+ Thus, when the style changes, this property updates from it.
+ Calling setDefaultSectionSize() stops the updates, calling
+ resetDefaultSectionSize() will restore default behavior.
+
\sa setSectionResizeMode(), minimumSectionSize
*/
int QHeaderView::defaultSectionSize() const
@@ -1531,6 +1536,15 @@ void QHeaderView::setDefaultSectionSize(int size)
d->setDefaultSectionSize(size);
}
+void QHeaderView::resetDefaultSectionSize()
+{
+ Q_D(QHeaderView);
+ if (d->customDefaultSectionSize) {
+ d->updateDefaultSectionSizeFromStyle();
+ d->customDefaultSectionSize = false;
+ }
+}
+
/*!
\since 4.2
\property QHeaderView::minimumSectionSize
@@ -2209,6 +2223,10 @@ bool QHeaderView::event(QEvent *e)
resizeSections();
}
break; }
+ case QEvent::StyleChange:
+ if (!d->customDefaultSectionSize)
+ d->updateDefaultSectionSizeFromStyle();
+ break;
default:
break;
}
@@ -2371,7 +2389,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QHeaderView);
int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
- if (pos < 0)
+ if (pos < 0 && d->state != QHeaderViewPrivate::SelectSections)
return;
if (e->buttons() == Qt::NoButton) {
#if !defined(Q_WS_MAC)
@@ -2430,7 +2448,9 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
return;
}
case QHeaderViewPrivate::SelectSections: {
- int logical = logicalIndexAt(pos);
+ int logical = logicalIndexAt(qMax(-d->offset, pos));
+ if (logical == -1 && pos > 0)
+ logical = d->lastVisibleVisualIndex();
if (logical == d->pressed)
return; // nothing to do
else if (d->pressed != -1)
@@ -3463,6 +3483,7 @@ void QHeaderViewPrivate::setDefaultSectionSize(int size)
executePostedLayout();
invalidateCachedSizeHint();
defaultSectionSize = size;
+ customDefaultSectionSize = true;
if (state == QHeaderViewPrivate::ResizeSection)
preventCursorChangeInSetOffset = true;
for (int i = 0; i < sectionItems.count(); ++i) {
@@ -3483,6 +3504,17 @@ void QHeaderViewPrivate::setDefaultSectionSize(int size)
viewport->update();
}
+void QHeaderViewPrivate::updateDefaultSectionSizeFromStyle()
+{
+ Q_Q(QHeaderView);
+ if (orientation == Qt::Horizontal) {
+ defaultSectionSize = q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeHorizontal, 0, q);
+ } else {
+ defaultSectionSize = qMax(q->minimumSectionSize(),
+ q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeVertical, 0, q));
+ }
+}
+
void QHeaderViewPrivate::recalcSectionStartPos() const // linear (but fast)
{
int pixelpos = 0;
@@ -3630,6 +3662,7 @@ void QHeaderViewPrivate::write(QDataStream &out) const
out << sectionItems;
out << resizeContentsPrecision;
+ out << customDefaultSectionSize;
}
bool QHeaderViewPrivate::read(QDataStream &in)
@@ -3641,6 +3674,17 @@ bool QHeaderViewPrivate::read(QDataStream &in)
QVector<int> visualIndicesIn;
QVector<int> logicalIndicesIn;
QHash<int, int> hiddenSectionSizeIn;
+ bool movableSectionsIn;
+ bool clickableSectionsIn;
+ bool highlightSelectedIn;
+ bool stretchLastSectionIn;
+ bool cascadingResizingIn;
+ int stretchSectionsIn;
+ int contentsSectionsIn;
+ int defaultSectionSizeIn;
+ int minimumSectionSizeIn;
+ QVector<SectionItem> sectionItemsIn;
+
in >> orient;
in >> order;
@@ -3662,6 +3706,37 @@ bool QHeaderViewPrivate::read(QDataStream &in)
if (in.status() != QDataStream::Ok || lengthIn < 0)
return false;
+ in >> movableSectionsIn;
+ in >> clickableSectionsIn;
+ in >> highlightSelectedIn;
+ in >> stretchLastSectionIn;
+ in >> cascadingResizingIn;
+ in >> stretchSectionsIn;
+ in >> contentsSectionsIn;
+ in >> defaultSectionSizeIn;
+ in >> minimumSectionSizeIn;
+
+ in >> align;
+
+ in >> global;
+
+ in >> sectionItemsIn;
+ // In Qt4 we had a vector of spans where one span could hold information on more sections.
+ // Now we have an itemvector where one items contains information about one section
+ // For backward compatibility with Qt4 we do the following
+ QVector<SectionItem> newSectionItems;
+ for (int u = 0; u < sectionItemsIn.count(); ++u) {
+ int count = sectionItemsIn.at(u).tmpDataStreamSectionCount;
+ for (int n = 0; n < count; ++n)
+ newSectionItems.append(sectionItemsIn[u]);
+ }
+
+ int sectionItemsLengthTotal = 0;
+ foreach (const SectionItem& section, sectionItemsIn)
+ sectionItemsLengthTotal += section.size;
+ if (sectionItemsLengthTotal != lengthIn)
+ return false;
+
orientation = static_cast<Qt::Orientation>(orient);
sortIndicatorOrder = static_cast<Qt::SortOrder>(order);
sortIndicatorSection = sortIndicatorSectionIn;
@@ -3671,32 +3746,19 @@ bool QHeaderViewPrivate::read(QDataStream &in)
hiddenSectionSize = hiddenSectionSizeIn;
length = lengthIn;
- in >> movableSections;
- in >> clickableSections;
- in >> highlightSelected;
- in >> stretchLastSection;
- in >> cascadingResizing;
- in >> stretchSections;
- in >> contentsSections;
- in >> defaultSectionSize;
- in >> minimumSectionSize;
+ movableSections = movableSectionsIn;
+ clickableSections = clickableSectionsIn;
+ highlightSelected = highlightSelectedIn;
+ stretchLastSection = stretchLastSectionIn;
+ cascadingResizing = cascadingResizingIn;
+ stretchSections = stretchSectionsIn;
+ contentsSections = contentsSectionsIn;
+ defaultSectionSize = defaultSectionSizeIn;
+ minimumSectionSize = minimumSectionSizeIn;
- in >> align;
defaultAlignment = Qt::Alignment(align);
+ globalResizeMode = static_cast<QHeaderView::ResizeMode>(global);
- in >> global;
- globalResizeMode = (QHeaderView::ResizeMode)global;
-
- in >> sectionItems;
- // In Qt4 we had a vector of spans where one span could hold information on more sections.
- // Now we have an itemvector where one items contains information about one section
- // For backward compatibility with Qt4 we do the following
- QVector<SectionItem> newSectionItems;
- for (int u = 0; u < sectionItems.count(); ++u) {
- int count = sectionItems.at(u).tmpDataStreamSectionCount;
- for (int n = 0; n < count; ++n)
- newSectionItems.append(sectionItems[u]);
- }
sectionItems = newSectionItems;
setHiddenSectionsFromBitVector(sectionHidden);
recalcSectionStartPos();
@@ -3706,6 +3768,14 @@ bool QHeaderViewPrivate::read(QDataStream &in)
if (in.status() == QDataStream::Ok) // we haven't read past end
resizeContentsPrecision = tmpint;
+ bool tmpbool;
+ in >> tmpbool;
+ if (in.status() == QDataStream::Ok) { // we haven't read past end
+ customDefaultSectionSize = tmpbool;
+ if (!customDefaultSectionSize)
+ updateDefaultSectionSizeFromStyle();
+ }
+
return true;
}
diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h
index 4a627b26b4..0163243cdf 100644
--- a/src/widgets/itemviews/qheaderview.h
+++ b/src/widgets/itemviews/qheaderview.h
@@ -51,7 +51,7 @@ class Q_WIDGETS_EXPORT QHeaderView : public QAbstractItemView
Q_PROPERTY(bool highlightSections READ highlightSections WRITE setHighlightSections)
Q_PROPERTY(bool stretchLastSection READ stretchLastSection WRITE setStretchLastSection)
Q_PROPERTY(bool cascadingSectionResizes READ cascadingSectionResizes WRITE setCascadingSectionResizes)
- Q_PROPERTY(int defaultSectionSize READ defaultSectionSize WRITE setDefaultSectionSize)
+ Q_PROPERTY(int defaultSectionSize READ defaultSectionSize WRITE setDefaultSectionSize RESET resetDefaultSectionSize)
Q_PROPERTY(int minimumSectionSize READ minimumSectionSize WRITE setMinimumSectionSize)
Q_PROPERTY(int maximumSectionSize READ maximumSectionSize WRITE setMaximumSectionSize)
Q_PROPERTY(Qt::Alignment defaultAlignment READ defaultAlignment WRITE setDefaultAlignment)
@@ -71,13 +71,13 @@ public:
explicit QHeaderView(Qt::Orientation orientation, QWidget *parent = 0);
virtual ~QHeaderView();
- void setModel(QAbstractItemModel *model);
+ void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
Qt::Orientation orientation() const;
int offset() const;
int length() const;
- QSize sizeHint() const;
- void setVisible(bool v);
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ void setVisible(bool v) Q_DECL_OVERRIDE;
int sectionSizeHint(int logicalIndex) const;
int visualIndexAt(int position) const;
@@ -156,6 +156,7 @@ public:
int defaultSectionSize() const;
void setDefaultSectionSize(int size);
+ void resetDefaultSectionSize();
int minimumSectionSize() const;
void setMinimumSectionSize(int size);
@@ -165,7 +166,7 @@ public:
Qt::Alignment defaultAlignment() const;
void setDefaultAlignment(Qt::Alignment alignment);
- void doItemsLayout();
+ void doItemsLayout() Q_DECL_OVERRIDE;
bool sectionsMoved() const;
bool sectionsHidden() const;
@@ -174,7 +175,7 @@ public:
bool restoreState(const QByteArray &state);
#endif
- void reset();
+ void reset() Q_DECL_OVERRIDE;
public Q_SLOTS:
void setOffset(int offset);
@@ -206,36 +207,36 @@ protected:
void initializeSections();
void initializeSections(int start, int end);
- void currentChanged(const QModelIndex &current, const QModelIndex &old);
+ void currentChanged(const QModelIndex &current, const QModelIndex &old) Q_DECL_OVERRIDE;
- bool event(QEvent *e);
- void paintEvent(QPaintEvent *e);
- void mousePressEvent(QMouseEvent *e);
- void mouseMoveEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
- void mouseDoubleClickEvent(QMouseEvent *e);
- bool viewportEvent(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ bool viewportEvent(QEvent *e) Q_DECL_OVERRIDE;
virtual void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
virtual QSize sectionSizeFromContents(int logicalIndex) const;
- int horizontalOffset() const;
- int verticalOffset() const;
- void updateGeometries();
- void scrollContentsBy(int dx, int dy);
+ int horizontalOffset() const Q_DECL_OVERRIDE;
+ int verticalOffset() const Q_DECL_OVERRIDE;
+ void updateGeometries() Q_DECL_OVERRIDE;
+ void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
- void rowsInserted(const QModelIndex &parent, int start, int end);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) Q_DECL_OVERRIDE;
+ void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
- QRect visualRect(const QModelIndex &index) const;
- void scrollTo(const QModelIndex &index, ScrollHint hint);
+ QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void scrollTo(const QModelIndex &index, ScrollHint hint) Q_DECL_OVERRIDE;
- QModelIndex indexAt(const QPoint &p) const;
- bool isIndexHidden(const QModelIndex &index) const;
+ QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
+ bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
- QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers);
- void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags);
- QRegion visualRegionForSelection(const QItemSelection &selection) const;
+ QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) Q_DECL_OVERRIDE;
+ void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags) Q_DECL_OVERRIDE;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionHeader *option) const;
friend class QTableView;
diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h
index fd99ea5474..2fde1bf79a 100644
--- a/src/widgets/itemviews/qheaderview_p.h
+++ b/src/widgets/itemviews/qheaderview_p.h
@@ -84,6 +84,7 @@ public:
cascadingResizing(false),
resizeRecursionBlock(false),
allowUserMoveOfSection0(true), // will be false for QTreeView and true for QTableView
+ customDefaultSectionSize(false),
stretchSections(0),
contentsSections(0),
minimumSectionSize(-1),
@@ -155,8 +156,7 @@ public:
inline void setDefaultValues(Qt::Orientation o) {
orientation = o;
- defaultSectionSize = (o == Qt::Horizontal ? 100
- : qMax(q_func()->minimumSectionSize(), 30));
+ updateDefaultSectionSizeFromStyle();
defaultAlignment = (o == Qt::Horizontal
? Qt::Alignment(Qt::AlignCenter)
: Qt::AlignLeft|Qt::AlignVCenter);
@@ -275,6 +275,7 @@ public:
bool cascadingResizing;
bool resizeRecursionBlock;
bool allowUserMoveOfSection0;
+ bool customDefaultSectionSize;
int stretchSections;
int contentsSections;
int defaultSectionSize;
@@ -321,6 +322,7 @@ public:
void removeSectionsFromSectionItems(int start, int end);
void resizeSectionItem(int visualIndex, int oldSize, int newSize);
void setDefaultSectionSize(int size);
+ void updateDefaultSectionSizeFromStyle();
void recalcSectionStartPos() const; // not really const
inline int headerLength() const { // for debugging
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index ef14ab8ed5..9303800e87 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -36,13 +36,7 @@
#ifndef QT_NO_ITEMVIEWS
#include <qabstractitemmodel.h>
#include <qapplication.h>
-#include <qpa/qplatformintegration.h>
-#include <qpa/qplatformdrag.h>
-#include <private/qguiapplication_p.h>
#include <qbrush.h>
-#include <qlineedit.h>
-#include <qtextedit.h>
-#include <qplaintextedit.h>
#include <qpainter.h>
#include <qpalette.h>
#include <qpoint.h>
@@ -58,8 +52,7 @@
#include <qitemeditorfactory.h>
#include <qmetaobject.h>
#include <qtextlayout.h>
-#include <private/qobject_p.h>
-#include <private/qdnd_p.h>
+#include <private/qabstractitemdelegate_p.h>
#include <private/qtextengine_p.h>
#include <qdebug.h>
#include <qlocale.h>
@@ -74,7 +67,7 @@
QT_BEGIN_NAMESPACE
-class QItemDelegatePrivate : public QObjectPrivate
+class QItemDelegatePrivate : public QAbstractItemDelegatePrivate
{
Q_DECLARE_PUBLIC(QItemDelegate)
@@ -105,9 +98,6 @@ public:
static QString valueToText(const QVariant &value, const QStyleOptionViewItem &option);
- bool tryFixup(QWidget *editor);
- void _q_commitDataAndCloseEditor(QWidget *editor);
-
QItemEditorFactory *f;
bool clipPainting;
@@ -129,13 +119,6 @@ public:
} tmp;
};
-void QItemDelegatePrivate::_q_commitDataAndCloseEditor(QWidget *editor)
-{
- Q_Q(QItemDelegate);
- emit q->commitData(editor);
- emit q->closeEditor(editor, QAbstractItemDelegate::SubmitModelCache);
-}
-
QRect QItemDelegatePrivate::textLayoutBounds(const QStyleOptionViewItem &option) const
{
QRect rect = option.rect;
@@ -379,24 +362,6 @@ QString QItemDelegatePrivate::valueToText(const QVariant &value, const QStyleOpt
return text;
}
-bool QItemDelegatePrivate::tryFixup(QWidget *editor)
-{
-#ifndef QT_NO_LINEEDIT
- if (QLineEdit *e = qobject_cast<QLineEdit*>(editor)) {
- if (!e->hasAcceptableInput()) {
- if (const QValidator *validator = e->validator()) {
- QString text = e->text();
- validator->fixup(text);
- e->setText(text);
- }
- return e->hasAcceptableInput();
- }
- }
-#endif // QT_NO_LINEEDIT
-
- return true;
-}
-
/*!
Renders the delegate using the given \a painter and style \a option for
the item specified by \a index.
@@ -1166,75 +1131,7 @@ QRect QItemDelegate::textRectangle(QPainter * /*painter*/, const QRect &rect,
bool QItemDelegate::eventFilter(QObject *object, QEvent *event)
{
Q_D(QItemDelegate);
-
- QWidget *editor = qobject_cast<QWidget*>(object);
- if (!editor)
- return false;
- if (event->type() == QEvent::KeyPress) {
- switch (static_cast<QKeyEvent *>(event)->key()) {
- case Qt::Key_Tab:
- if (d->tryFixup(editor)) {
- emit commitData(editor);
- emit closeEditor(editor, EditNextItem);
- }
- return true;
- case Qt::Key_Backtab:
- if (d->tryFixup(editor)) {
- emit commitData(editor);
- emit closeEditor(editor, EditPreviousItem);
- }
- return true;
- case Qt::Key_Enter:
- case Qt::Key_Return:
-#ifndef QT_NO_TEXTEDIT
- if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor))
- return false; // don't filter enter key events for QTextEdit
- // We want the editor to be able to process the key press
- // before committing the data (e.g. so it can do
- // validation/fixup of the input).
-#endif // QT_NO_TEXTEDIT
- if (!d->tryFixup(editor))
- return true;
-
- QMetaObject::invokeMethod(this, "_q_commitDataAndCloseEditor",
- Qt::QueuedConnection, Q_ARG(QWidget*, editor));
- return false;
- case Qt::Key_Escape:
- // don't commit data
- emit closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
- return true;
- default:
- return false;
- }
- } else if (event->type() == QEvent::FocusOut || (event->type() == QEvent::Hide && editor->isWindow())) {
- //the Hide event will take care of he editors that are in fact complete dialogs
- if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) {
- QWidget *w = QApplication::focusWidget();
- while (w) { // don't worry about focus changes internally in the editor
- if (w == editor)
- return false;
- w = w->parentWidget();
- }
-#ifndef QT_NO_DRAGANDDROP
- // The window may lose focus during an drag operation.
- // i.e when dragging involves the taskbar on Windows.
- QPlatformDrag *platformDrag = QGuiApplicationPrivate::instance()->platformIntegration()->drag();
- if (platformDrag && platformDrag->currentDrag()) {
- return false;
- }
-#endif
- if (d->tryFixup(editor))
- emit commitData(editor);
-
- emit closeEditor(editor, NoHint);
- }
- } else if (event->type() == QEvent::ShortcutOverride) {
- if (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape) {
- event->accept();
- return true;
- }
- }
- return false;
+ return d->editorEventFilter(object, event);
}
/*!
diff --git a/src/widgets/itemviews/qitemdelegate.h b/src/widgets/itemviews/qitemdelegate.h
index 55b33b69b2..148e049333 100644
--- a/src/widgets/itemviews/qitemdelegate.h
+++ b/src/widgets/itemviews/qitemdelegate.h
@@ -62,21 +62,21 @@ public:
// painting
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
// editing
QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
- void setEditorData(QWidget *editor, const QModelIndex &index) const;
- void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const Q_DECL_OVERRIDE;
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
// editor factory
QItemEditorFactory *itemEditorFactory() const;
@@ -99,9 +99,9 @@ protected:
QRect rect(const QStyleOptionViewItem &option, const QModelIndex &index, int role) const;
- bool eventFilter(QObject *object, QEvent *event);
+ bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
bool editorEvent(QEvent *event, QAbstractItemModel *model,
- const QStyleOptionViewItem &option, const QModelIndex &index);
+ const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
QStyleOptionViewItem setOptions(const QModelIndex &index,
const QStyleOptionViewItem &option) const;
@@ -117,8 +117,6 @@ protected:
private:
Q_DECLARE_PRIVATE(QItemDelegate)
Q_DISABLE_COPY(QItemDelegate)
-
- Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*))
};
#endif // QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 2e8cca2997..ee1cb9b002 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -213,8 +213,8 @@ class QDefaultItemEditorFactory : public QItemEditorFactory
{
public:
inline QDefaultItemEditorFactory() {}
- QWidget *createEditor(int userType, QWidget *parent) const;
- QByteArray valuePropertyName(int) const;
+ QWidget *createEditor(int userType, QWidget *parent) const Q_DECL_OVERRIDE;
+ QByteArray valuePropertyName(int) const Q_DECL_OVERRIDE;
};
QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) const
diff --git a/src/widgets/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h
index 9b46f1c728..739b75c63e 100644
--- a/src/widgets/itemviews/qitemeditorfactory_p.h
+++ b/src/widgets/itemviews/qitemeditorfactory_p.h
@@ -69,7 +69,7 @@ public:
}
protected:
- void changeEvent(QEvent *e);
+ void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
public Q_SLOTS:
void resizeToContents();
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index ed0972413b..8e4cc7ff41 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -115,13 +115,13 @@ public:
void setSelectionRectVisible(bool show);
bool isSelectionRectVisible() const;
- QRect visualRect(const QModelIndex &index) const;
- void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible);
- QModelIndex indexAt(const QPoint &p) const;
+ QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
+ QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
- void doItemsLayout();
- void reset();
- void setRootIndex(const QModelIndex &index);
+ void doItemsLayout() Q_DECL_OVERRIDE;
+ void reset() Q_DECL_OVERRIDE;
+ void setRootIndex(const QModelIndex &index) Q_DECL_OVERRIDE;
Q_SIGNALS:
void indexesMoved(const QModelIndexList &indexes);
@@ -129,48 +129,48 @@ Q_SIGNALS:
protected:
QListView(QListViewPrivate &, QWidget *parent = 0);
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
- void scrollContentsBy(int dx, int dy);
+ void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
void resizeContents(int width, int height);
QSize contentsSize() const;
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
- void rowsInserted(const QModelIndex &parent, int start, int end);
- void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) Q_DECL_OVERRIDE;
+ void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
+ void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
+ void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *e);
- void resizeEvent(QResizeEvent *e);
+ void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
- void dragMoveEvent(QDragMoveEvent *e);
- void dragLeaveEvent(QDragLeaveEvent *e);
- void dropEvent(QDropEvent *e);
- void startDrag(Qt::DropActions supportedActions);
+ void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
+ void startDrag(Qt::DropActions supportedActions) Q_DECL_OVERRIDE;
#endif // QT_NO_DRAGANDDROP
- QStyleOptionViewItem viewOptions() const;
- void paintEvent(QPaintEvent *e);
+ QStyleOptionViewItem viewOptions() const Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
- int horizontalOffset() const;
- int verticalOffset() const;
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
+ int horizontalOffset() const Q_DECL_OVERRIDE;
+ int verticalOffset() const Q_DECL_OVERRIDE;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
QRect rectForIndex(const QModelIndex &index) const;
void setPositionForIndex(const QPoint &position, const QModelIndex &index);
- void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command);
- QRegion visualRegionForSelection(const QItemSelection &selection) const;
- QModelIndexList selectedIndexes() const;
+ void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
+ QModelIndexList selectedIndexes() const Q_DECL_OVERRIDE;
- void updateGeometries();
+ void updateGeometries() Q_DECL_OVERRIDE;
- bool isIndexHidden(const QModelIndex &index) const;
+ bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
- void currentChanged(const QModelIndex &current, const QModelIndex &previous);
+ void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) Q_DECL_OVERRIDE;
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE;
QSize viewportSizeHint() const Q_DECL_OVERRIDE;
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index 51561ac23b..aae75e5651 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -1783,9 +1783,24 @@ QStringList QListWidget::mimeTypes() const
If the list of items is empty, 0 is returned instead of a serialized empty
list.
*/
-QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*>) const
+QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*> items) const
{
- return d_func()->listModel()->internalMimeData();
+ Q_D(const QListWidget);
+
+ QModelIndexList &cachedIndexes = d->listModel()->cachedIndexes;
+
+ // if non empty, it's called from the model's own mimeData
+ if (cachedIndexes.isEmpty()) {
+ foreach (QListWidgetItem *item, items)
+ cachedIndexes << indexFromItem(item);
+
+ QMimeData *result = d->listModel()->internalMimeData();
+
+ cachedIndexes.clear();
+ return result;
+ }
+
+ return d->listModel()->internalMimeData();
}
#ifndef QT_NO_DRAGANDDROP
diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h
index 753ad250cd..d5b131722d 100644
--- a/src/widgets/itemviews/qlistwidget.h
+++ b/src/widgets/itemviews/qlistwidget.h
@@ -243,7 +243,7 @@ public:
bool isItemHidden(const QListWidgetItem *item) const;
void setItemHidden(const QListWidgetItem *item, bool hide);
- void dropEvent(QDropEvent *event);
+ void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
public Q_SLOTS:
void scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint = EnsureVisible);
@@ -264,7 +264,7 @@ Q_SIGNALS:
void itemSelectionChanged();
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
virtual QStringList mimeTypes() const;
virtual QMimeData *mimeData(const QList<QListWidgetItem*> items) const;
#ifndef QT_NO_DRAGANDDROP
@@ -277,7 +277,7 @@ protected:
QListWidgetItem *itemFromIndex(const QModelIndex &index) const;
private:
- void setModel(QAbstractItemModel *model);
+ void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
Qt::SortOrder sortOrder() const;
Q_DECLARE_PRIVATE(QListWidget)
diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h
index b019cd5eaf..1f2e9e8819 100644
--- a/src/widgets/itemviews/qlistwidget_p.h
+++ b/src/widgets/itemviews/qlistwidget_p.h
@@ -72,6 +72,8 @@ public:
class Q_AUTOTEST_EXPORT QListModel : public QAbstractListModel
{
Q_OBJECT
+ friend class QListWidget;
+
public:
QListModel(QListWidget *parent);
~QListModel();
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index fd4fb4440e..9d16b2abfc 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -36,9 +36,6 @@
#ifndef QT_NO_ITEMVIEWS
#include <qabstractitemmodel.h>
#include <qapplication.h>
-#include <qpa/qplatformintegration.h>
-#include <qpa/qplatformdrag.h>
-#include <private/qguiapplication_p.h>
#include <qbrush.h>
#include <qlineedit.h>
#include <qtextedit.h>
@@ -59,8 +56,7 @@
#include <private/qitemeditorfactory_p.h>
#include <qmetaobject.h>
#include <qtextlayout.h>
-#include <private/qobject_p.h>
-#include <private/qdnd_p.h>
+#include <private/qabstractitemdelegate_p.h>
#include <private/qtextengine_p.h>
#include <private/qlayoutengine_p.h>
#include <qdebug.h>
@@ -72,7 +68,7 @@
QT_BEGIN_NAMESPACE
-class QStyledItemDelegatePrivate : public QObjectPrivate
+class QStyledItemDelegatePrivate : public QAbstractItemDelegatePrivate
{
Q_DECLARE_PUBLIC(QStyledItemDelegate)
@@ -89,34 +85,9 @@ public:
return factory ? factory : QItemEditorFactory::defaultFactory();
}
- bool tryFixup(QWidget *editor);
- void _q_commitDataAndCloseEditor(QWidget *editor)
- {
- Q_Q(QStyledItemDelegate);
- emit q->commitData(editor);
- emit q->closeEditor(editor, QAbstractItemDelegate::SubmitModelCache);
- }
QItemEditorFactory *factory;
};
-bool QStyledItemDelegatePrivate::tryFixup(QWidget *editor)
-{
-#ifndef QT_NO_LINEEDIT
- if (QLineEdit *e = qobject_cast<QLineEdit*>(editor)) {
- if (!e->hasAcceptableInput()) {
- if (const QValidator *validator = e->validator()) {
- QString text = e->text();
- validator->fixup(text);
- e->setText(text);
- }
- return e->hasAcceptableInput();
- }
- }
-#endif // QT_NO_LINEEDIT
-
- return true;
-}
-
/*!
\class QStyledItemDelegate
@@ -637,75 +608,7 @@ void QStyledItemDelegate::setItemEditorFactory(QItemEditorFactory *factory)
bool QStyledItemDelegate::eventFilter(QObject *object, QEvent *event)
{
Q_D(QStyledItemDelegate);
-
- QWidget *editor = qobject_cast<QWidget*>(object);
- if (!editor)
- return false;
- if (event->type() == QEvent::KeyPress) {
- switch (static_cast<QKeyEvent *>(event)->key()) {
- case Qt::Key_Tab:
- if (d->tryFixup(editor)) {
- emit commitData(editor);
- emit closeEditor(editor, EditNextItem);
- }
- return true;
- case Qt::Key_Backtab:
- if (d->tryFixup(editor)) {
- emit commitData(editor);
- emit closeEditor(editor, EditPreviousItem);
- }
- return true;
- case Qt::Key_Enter:
- case Qt::Key_Return:
-#ifndef QT_NO_TEXTEDIT
- if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor))
- return false; // don't filter enter key events for QTextEdit
- // We want the editor to be able to process the key press
- // before committing the data (e.g. so it can do
- // validation/fixup of the input).
-#endif // QT_NO_TEXTEDIT
- if (!d->tryFixup(editor))
- return true;
-
- QMetaObject::invokeMethod(this, "_q_commitDataAndCloseEditor",
- Qt::QueuedConnection, Q_ARG(QWidget*, editor));
- return false;
- case Qt::Key_Escape:
- // don't commit data
- emit closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
- return true;
- default:
- return false;
- }
- } else if (event->type() == QEvent::FocusOut || (event->type() == QEvent::Hide && editor->isWindow())) {
- //the Hide event will take care of he editors that are in fact complete dialogs
- if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) {
- QWidget *w = QApplication::focusWidget();
- while (w) { // don't worry about focus changes internally in the editor
- if (w == editor)
- return false;
- w = w->parentWidget();
- }
-#ifndef QT_NO_DRAGANDDROP
- // The window may lose focus during an drag operation.
- // i.e when dragging involves the taskbar on Windows.
- QPlatformDrag *platformDrag = QGuiApplicationPrivate::instance()->platformIntegration()->drag();
- if (platformDrag && platformDrag->currentDrag()) {
- return false;
- }
-#endif
- if (d->tryFixup(editor))
- emit commitData(editor);
-
- emit closeEditor(editor, NoHint);
- }
- } else if (event->type() == QEvent::ShortcutOverride) {
- if (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape) {
- event->accept();
- return true;
- }
- }
- return false;
+ return d->editorEventFilter(object, event);
}
/*!
diff --git a/src/widgets/itemviews/qstyleditemdelegate.h b/src/widgets/itemviews/qstyleditemdelegate.h
index b523263bd9..7f4ff006a3 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.h
+++ b/src/widgets/itemviews/qstyleditemdelegate.h
@@ -57,23 +57,23 @@ public:
// painting
void paint(QPainter *painter,
- const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
// editing
QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
- void setEditorData(QWidget *editor, const QModelIndex &index) const;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
void setModelData(QWidget *editor,
QAbstractItemModel *model,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
// editor factory
QItemEditorFactory *itemEditorFactory() const;
@@ -85,15 +85,13 @@ protected:
virtual void initStyleOption(QStyleOptionViewItem *option,
const QModelIndex &index) const;
- bool eventFilter(QObject *object, QEvent *event);
+ bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
bool editorEvent(QEvent *event, QAbstractItemModel *model,
- const QStyleOptionViewItem &option, const QModelIndex &index);
+ const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QStyledItemDelegate)
Q_DISABLE_COPY(QStyledItemDelegate)
-
- Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*))
};
#endif // QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index b5eb509766..062debf4ee 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -584,7 +584,7 @@ class QTableCornerButton : public QAbstractButton
Q_OBJECT
public:
QTableCornerButton(QWidget *parent) : QAbstractButton(parent) {}
- void paintEvent(QPaintEvent*) {
+ void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE {
QStyleOptionHeader opt;
opt.init(this);
QStyle::State state = QStyle::State_None;
diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
index 66e1318fad..a38d28f93e 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -57,10 +57,10 @@ public:
explicit QTableView(QWidget *parent = 0);
~QTableView();
- void setModel(QAbstractItemModel *model);
- void setRootIndex(const QModelIndex &index);
- void setSelectionModel(QItemSelectionModel *selectionModel);
- void doItemsLayout();
+ void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
+ void setRootIndex(const QModelIndex &index) Q_DECL_OVERRIDE;
+ void setSelectionModel(QItemSelectionModel *selectionModel) Q_DECL_OVERRIDE;
+ void doItemsLayout() Q_DECL_OVERRIDE;
QHeaderView *horizontalHeader() const;
QHeaderView *verticalHeader() const;
@@ -99,9 +99,9 @@ public:
void setCornerButtonEnabled(bool enable);
bool isCornerButtonEnabled() const;
- QRect visualRect(const QModelIndex &index) const;
- void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible);
- QModelIndex indexAt(const QPoint &p) const;
+ QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
+ QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
void setSpan(int row, int column, int rowSpan, int columnSpan);
int rowSpan(int row, int column) const;
@@ -134,37 +134,37 @@ protected Q_SLOTS:
protected:
QTableView(QTableViewPrivate &, QWidget *parent);
- void scrollContentsBy(int dx, int dy);
+ void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
- QStyleOptionViewItem viewOptions() const;
- void paintEvent(QPaintEvent *e);
+ QStyleOptionViewItem viewOptions() const Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event);
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
- int horizontalOffset() const;
- int verticalOffset() const;
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
+ int horizontalOffset() const Q_DECL_OVERRIDE;
+ int verticalOffset() const Q_DECL_OVERRIDE;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
- void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command);
- QRegion visualRegionForSelection(const QItemSelection &selection) const;
- QModelIndexList selectedIndexes() const;
+ void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
+ QModelIndexList selectedIndexes() const Q_DECL_OVERRIDE;
- void updateGeometries();
+ void updateGeometries() Q_DECL_OVERRIDE;
QSize viewportSizeHint() const Q_DECL_OVERRIDE;
- int sizeHintForRow(int row) const;
- int sizeHintForColumn(int column) const;
+ int sizeHintForRow(int row) const Q_DECL_OVERRIDE;
+ int sizeHintForColumn(int column) const Q_DECL_OVERRIDE;
- void verticalScrollbarAction(int action);
- void horizontalScrollbarAction(int action);
+ void verticalScrollbarAction(int action) Q_DECL_OVERRIDE;
+ void horizontalScrollbarAction(int action) Q_DECL_OVERRIDE;
- bool isIndexHidden(const QModelIndex &index) const;
+ bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
void selectionChanged(const QItemSelection &selected,
- const QItemSelection &deselected);
+ const QItemSelection &deselected) Q_DECL_OVERRIDE;
void currentChanged(const QModelIndex &current,
- const QModelIndex &previous);
+ const QModelIndex &previous) Q_DECL_OVERRIDE;
private:
friend class QAccessibleItemView;
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index 7c24819c0e..eb239f8025 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -2553,9 +2553,24 @@ QStringList QTableWidget::mimeTypes() const
If the list of items is empty, 0 is returned rather than a serialized
empty list.
*/
-QMimeData *QTableWidget::mimeData(const QList<QTableWidgetItem*>) const
+QMimeData *QTableWidget::mimeData(const QList<QTableWidgetItem*> items) const
{
- return d_func()->tableModel()->internalMimeData();
+ Q_D(const QTableWidget);
+
+ QModelIndexList &cachedIndexes = d->tableModel()->cachedIndexes;
+
+ // if non empty, it's called from the model's own mimeData
+ if (cachedIndexes.isEmpty()) {
+ foreach (QTableWidgetItem *item, items)
+ cachedIndexes << indexFromItem(item);
+
+ QMimeData *result = d->tableModel()->internalMimeData();
+
+ cachedIndexes.clear();
+ return result;
+ }
+
+ return d->tableModel()->internalMimeData();
}
/*!
diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h
index a1d5b4e172..b7b5203d37 100644
--- a/src/widgets/itemviews/qtablewidget.h
+++ b/src/widgets/itemviews/qtablewidget.h
@@ -311,7 +311,7 @@ Q_SIGNALS:
void currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
virtual QStringList mimeTypes() const;
virtual QMimeData *mimeData(const QList<QTableWidgetItem*> items) const;
virtual bool dropMimeData(int row, int column, const QMimeData *data, Qt::DropAction action);
@@ -320,10 +320,10 @@ protected:
QModelIndex indexFromItem(QTableWidgetItem *item) const;
QTableWidgetItem *itemFromIndex(const QModelIndex &index) const;
- void dropEvent(QDropEvent *event);
+ void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
private:
- void setModel(QAbstractItemModel *model);
+ void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
Q_DECLARE_PRIVATE(QTableWidget)
Q_DISABLE_COPY(QTableWidget)
diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h
index 50b5a66eb5..92a8f5f305 100644
--- a/src/widgets/itemviews/qtablewidget_p.h
+++ b/src/widgets/itemviews/qtablewidget_p.h
@@ -82,6 +82,8 @@ public:
class QTableModel : public QAbstractTableModel
{
Q_OBJECT
+ friend class QTableWidget;
+
public:
enum ItemFlagsExtension {
ItemIsHeaderItem = 128
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 2c5f4b7c72..71bf92f321 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -3094,8 +3094,6 @@ void QTreeViewPrivate::expand(int item, bool emitSignal)
void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem &viewItem)
{
- Q_Q(QTreeView);
- Q_UNUSED(q)
viewItems.insert(pos, count, viewItem);
QTreeViewItem *items = viewItems.data();
for (int i = pos + count; i < viewItems.count(); i++)
@@ -3105,8 +3103,6 @@ void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem &
void QTreeViewPrivate::removeViewItems(int pos, int count)
{
- Q_Q(QTreeView);
- Q_UNUSED(q)
viewItems.remove(pos, count);
QTreeViewItem *items = viewItems.data();
for (int i = pos; i < viewItems.count(); i++)
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index afdb94d770..2d7aaee69d 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -63,9 +63,9 @@ public:
explicit QTreeView(QWidget *parent = 0);
~QTreeView();
- void setModel(QAbstractItemModel *model);
- void setRootIndex(const QModelIndex &index);
- void setSelectionModel(QItemSelectionModel *selectionModel);
+ void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
+ void setRootIndex(const QModelIndex &index) Q_DECL_OVERRIDE;
+ void setSelectionModel(QItemSelectionModel *selectionModel) Q_DECL_OVERRIDE;
QHeaderView *header() const;
void setHeader(QHeaderView *header);
@@ -124,21 +124,21 @@ public:
void setTreePosition(int logicalIndex);
int treePosition() const;
- void keyboardSearch(const QString &search);
+ void keyboardSearch(const QString &search) Q_DECL_OVERRIDE;
- QRect visualRect(const QModelIndex &index) const;
- void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible);
- QModelIndex indexAt(const QPoint &p) const;
+ QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
+ QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
QModelIndex indexAbove(const QModelIndex &index) const;
QModelIndex indexBelow(const QModelIndex &index) const;
- void doItemsLayout();
- void reset();
+ void doItemsLayout() Q_DECL_OVERRIDE;
+ void reset() Q_DECL_OVERRIDE;
void sortByColumn(int column, Qt::SortOrder order);
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
- void selectAll();
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) Q_DECL_OVERRIDE;
+ void selectAll() Q_DECL_OVERRIDE;
Q_SIGNALS:
void expanded(const QModelIndex &index);
@@ -164,20 +164,20 @@ protected Q_SLOTS:
protected:
QTreeView(QTreeViewPrivate &dd, QWidget *parent = 0);
- void scrollContentsBy(int dx, int dy);
- void rowsInserted(const QModelIndex &parent, int start, int end);
- void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+ void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
+ void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
- int horizontalOffset() const;
- int verticalOffset() const;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
+ int horizontalOffset() const Q_DECL_OVERRIDE;
+ int verticalOffset() const Q_DECL_OVERRIDE;
- void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command);
- QRegion visualRegionForSelection(const QItemSelection &selection) const;
- QModelIndexList selectedIndexes() const;
+ void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
+ QModelIndexList selectedIndexes() const Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event);
- void paintEvent(QPaintEvent *event);
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void drawTree(QPainter *painter, const QRegion &region) const;
virtual void drawRow(QPainter *painter,
@@ -187,30 +187,30 @@ protected:
const QRect &rect,
const QModelIndex &index) const;
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void keyPressEvent(QKeyEvent *event);
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
- void dragMoveEvent(QDragMoveEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
#endif
- bool viewportEvent(QEvent *event);
+ bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
- void updateGeometries();
+ void updateGeometries() Q_DECL_OVERRIDE;
QSize viewportSizeHint() const Q_DECL_OVERRIDE;
- int sizeHintForColumn(int column) const;
+ int sizeHintForColumn(int column) const Q_DECL_OVERRIDE;
int indexRowSizeHint(const QModelIndex &index) const;
int rowHeight(const QModelIndex &index) const;
- void horizontalScrollbarAction(int action);
+ void horizontalScrollbarAction(int action) Q_DECL_OVERRIDE;
- bool isIndexHidden(const QModelIndex &index) const;
+ bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
void selectionChanged(const QItemSelection &selected,
- const QItemSelection &deselected);
- void currentChanged(const QModelIndex &current, const QModelIndex &previous);
+ const QItemSelection &deselected) Q_DECL_OVERRIDE;
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE;
private:
friend class QAccessibleTable;
diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h
index bc444eb37f..72cb897353 100644
--- a/src/widgets/itemviews/qtreeview_p.h
+++ b/src/widgets/itemviews/qtreeview_p.h
@@ -210,6 +210,8 @@ public:
QSet<QPersistentModelIndex> hiddenIndexes;
inline bool isRowHidden(const QModelIndex &idx) const {
+ if (hiddenIndexes.isEmpty())
+ return false;
//We first check if the idx is a QPersistentModelIndex, because creating QPersistentModelIndex is slow
return isPersistent(idx) && hiddenIndexes.contains(idx);
}
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 0a4e57812a..704f8975b9 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -2153,10 +2153,11 @@ QVariant QTreeWidgetItem::childrenCheckState(int column) const
default:
return Qt::PartiallyChecked;
}
+
+ if (uncheckedChildren && checkedChildren)
+ return Qt::PartiallyChecked;
}
- if (uncheckedChildren && checkedChildren)
- return Qt::PartiallyChecked;
if (uncheckedChildren)
return Qt::Unchecked;
else if (checkedChildren)
diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h
index b2b477289d..8ebfdd1b2a 100644
--- a/src/widgets/itemviews/qtreewidget.h
+++ b/src/widgets/itemviews/qtreewidget.h
@@ -316,7 +316,7 @@ public:
QTreeWidgetItem *itemAbove(const QTreeWidgetItem *item) const;
QTreeWidgetItem *itemBelow(const QTreeWidgetItem *item) const;
- void setSelectionModel(QItemSelectionModel *selectionModel);
+ void setSelectionModel(QItemSelectionModel *selectionModel) Q_DECL_OVERRIDE;
public Q_SLOTS:
void scrollToItem(const QTreeWidgetItem *item,
@@ -338,7 +338,7 @@ Q_SIGNALS:
void itemSelectionChanged();
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
virtual QStringList mimeTypes() const;
virtual QMimeData *mimeData(const QList<QTreeWidgetItem*> items) const;
virtual bool dropMimeData(QTreeWidgetItem *parent, int index,
@@ -348,10 +348,10 @@ protected:
QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const;
QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const;
- void dropEvent(QDropEvent *event);
+ void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
private:
- void setModel(QAbstractItemModel *model);
+ void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
Q_DECLARE_PRIVATE(QTreeWidget)
Q_DISABLE_COPY(QTreeWidget)
diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h
index ec1395b9fb..3f7997d49b 100644
--- a/src/widgets/itemviews/qtreewidget_p.h
+++ b/src/widgets/itemviews/qtreewidget_p.h
@@ -84,24 +84,24 @@ public:
void itemChanged(QTreeWidgetItem *item);
QModelIndex index(const QTreeWidgetItem *item, int column) const;
- QModelIndex index(int row, int column, const QModelIndex &parent) const;
- QModelIndex parent(const QModelIndex &child) const;
- int rowCount(const QModelIndex &parent) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- bool hasChildren(const QModelIndex &parent) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE;
+ QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ bool hasChildren(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role);
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE;
- QMap<int, QVariant> itemData(const QModelIndex &index) const;
+ QMap<int, QVariant> itemData(const QModelIndex &index) const Q_DECL_OVERRIDE;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value,
- int role);
+ int role) Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void sort(int column, Qt::SortOrder order);
+ void sort(int column, Qt::SortOrder order) Q_DECL_OVERRIDE;
void ensureSorted(int column, Qt::SortOrder order,
int start, int end, const QModelIndex &parent);
static bool itemLessThan(const QPair<QTreeWidgetItem*,int> &left,
@@ -113,17 +113,17 @@ public:
const QList<QTreeWidgetItem*>::iterator &end,
Qt::SortOrder order, QTreeWidgetItem *item);
- bool insertRows(int row, int count, const QModelIndex &);
- bool insertColumns(int column, int count, const QModelIndex &);
+ bool insertRows(int row, int count, const QModelIndex &) Q_DECL_OVERRIDE;
+ bool insertColumns(int column, int count, const QModelIndex &) Q_DECL_OVERRIDE;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
// dnd
- QStringList mimeTypes() const;
- QMimeData *mimeData(const QModelIndexList &indexes) const;
+ QStringList mimeTypes() const Q_DECL_OVERRIDE;
+ QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent);
- Qt::DropActions supportedDropActions() const;
+ int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
+ Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
QMimeData *internalMimeData() const;
@@ -138,7 +138,7 @@ protected:
void beginRemoveItems(QTreeWidgetItem *parent, int row, int count);
void endRemoveItems();
void sortItems(QList<QTreeWidgetItem*> *items, int column, Qt::SortOrder order);
- void timerEvent(QTimerEvent *);
+ void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
private:
QTreeWidgetItem *rootItem;
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index 15364b4785..4fc4b424f6 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -170,7 +170,7 @@ public:
#endif
protected:
- bool event(QEvent *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
QAction(QActionPrivate &dd, QObject *parent);
public Q_SLOTS:
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index b7d0869289..943abd1f1a 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -64,6 +64,7 @@
#include <QtWidgets/qgraphicsproxywidget.h>
#include <QtGui/qstylehints.h>
#include <QtGui/qinputmethod.h>
+#include <QtGui/private/qwindow_p.h>
#include <qpa/qplatformtheme.h>
#ifndef QT_NO_WHATSTHIS
#include <QtWidgets/QWhatsThis>
@@ -636,7 +637,7 @@ void QApplicationPrivate::initialize()
qRegisterGuiStateMachine();
#endif
- if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0)
+ if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0)
QCoreApplication::setAttribute(Qt::AA_NativeWindows);
#ifdef Q_OS_WINCE
@@ -658,8 +659,12 @@ void QApplicationPrivate::initialize()
initializeMultitouch();
if (QApplication::desktopSettingsAware())
- if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt();
+#ifndef QT_NO_WHEELEVENT
+ QApplicationPrivate::wheel_scroll_lines = theme->themeHint(QPlatformTheme::WheelScrollLines).toInt();
+#endif
+ }
is_app_running = true; // no longer starting up
}
@@ -2485,7 +2490,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
}
QWidget *popupWidget = QApplication::activePopupWidget();
QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : 0;
- if (popupWindow == window) {
+ if (popupWindow == window || (!popupWindow && QWindowPrivate::get(window)->isPopup())) {
*blockingWindow = 0;
return false;
}
@@ -3122,39 +3127,15 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
switch (e->type()) {
- case QEvent::KeyPress:
- {
- bool isWidget = receiver->isWidgetType();
- bool isWindow = receiver->isWindowType();
- bool isGraphicsWidget = false;
-#ifndef QT_NO_GRAPHICSVIEW
- isGraphicsWidget = !isWidget && !isWindow && qobject_cast<QGraphicsWidget *>(receiver);
-#endif
- if (!isWidget && !isGraphicsWidget && !isWindow) {
- return d->notify_helper(receiver, e);
- }
-
- QKeyEvent* key = static_cast<QKeyEvent*>(e);
-#ifndef QT_NO_SHORTCUT
- // Try looking for a Shortcut before sending key events
- QObject *shortcutReceiver = receiver;
- if (!isWidget && isWindow) {
- QWindow *w = qobject_cast<QWindow *>(receiver);
- QObject *focus = w ? w->focusObject() : 0;
- if (focus)
- shortcutReceiver = focus;
- }
- if (qApp->d_func()->shortcutMap.tryShortcutEvent(shortcutReceiver, key))
- return true;
-#endif
- qt_in_tab_key_event = (key->key() == Qt::Key_Backtab
- || key->key() == Qt::Key_Tab
- || key->key() == Qt::Key_Left
- || key->key() == Qt::Key_Up
- || key->key() == Qt::Key_Right
- || key->key() == Qt::Key_Down);
-
- }
+ case QEvent::KeyPress: {
+ int key = static_cast<QKeyEvent*>(e)->key();
+ qt_in_tab_key_event = (key == Qt::Key_Backtab
+ || key == Qt::Key_Tab
+ || key == Qt::Key_Left
+ || key == Qt::Key_Up
+ || key == Qt::Key_Right
+ || key == Qt::Key_Down);
+ }
default:
break;
}
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index ceba0c96c4..6762889b73 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -42,9 +42,6 @@
#ifdef QT_INCLUDE_COMPAT
# include <QtWidgets/qdesktopwidget.h>
#endif
-#ifdef Q_NO_USING_KEYWORD
-#include <QtGui/qpalette.h>
-#endif
#include <QtGui/qguiapplication.h>
QT_BEGIN_NAMESPACE
@@ -104,11 +101,7 @@ public:
QT_DEPRECATED static inline void setGraphicsSystem(const QString &) {}
#endif
-#if defined(Q_NO_USING_KEYWORD) && !defined(Q_QDOC)
- static QPalette palette() { return QGuiApplication::palette(); }
-#else
using QGuiApplication::palette;
-#endif
static QPalette palette(const QWidget *);
static QPalette palette(const char *className);
static void setPalette(const QPalette &, const char* className = 0);
@@ -178,7 +171,7 @@ public:
#endif
static int exec();
- bool notify(QObject *, QEvent *);
+ bool notify(QObject *, QEvent *) Q_DECL_OVERRIDE;
#ifdef QT_KEYPAD_NAVIGATION
static Q_DECL_DEPRECATED void setKeypadNavigationEnabled(bool);
@@ -206,8 +199,8 @@ public Q_SLOTS:
static void aboutQt();
protected:
- bool event(QEvent *);
- bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QApplication)
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 7d97235c66..10f81a403a 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -108,10 +108,10 @@ public:
QApplicationPrivate(int &argc, char **argv, int flags);
~QApplicationPrivate();
- virtual void notifyLayoutDirectionChange();
- virtual void notifyActiveWindowChange(QWindow *);
+ virtual void notifyLayoutDirectionChange() Q_DECL_OVERRIDE;
+ virtual void notifyActiveWindowChange(QWindow *) Q_DECL_OVERRIDE;
- virtual bool shouldQuit();
+ virtual bool shouldQuit() Q_DECL_OVERRIDE;
bool tryCloseAllWindows() Q_DECL_OVERRIDE;
#if defined(Q_WS_X11)
@@ -127,7 +127,7 @@ public:
static QString desktopStyleKey();
- void createEventDispatcher();
+ void createEventDispatcher() Q_DECL_OVERRIDE;
static void dispatchEnterLeave(QWidget *enter, QWidget *leave, const QPointF &globalPosF);
void notifyWindowIconChanged() Q_DECL_OVERRIDE;
@@ -188,9 +188,9 @@ public:
static QPalette *set_pal;
protected:
- void notifyThemeChanged();
+ void notifyThemeChanged() Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
- void notifyDragStarted(const QDrag *);
+ void notifyDragStarted(const QDrag *) Q_DECL_OVERRIDE;
#endif // QT_NO_DRAGANDDROP
public:
@@ -289,7 +289,7 @@ public:
ulong timestamp);
static void translateTouchCancel(QTouchDevice *device, ulong timestamp);
- QPixmap applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const;
+ QPixmap applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const Q_DECL_OVERRIDE;
private:
static QApplicationPrivate *self;
static bool tryCloseAllWidgetWindows(QWindowList *processedWindows);
diff --git a/src/widgets/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h
index c2da23f34c..9c83248773 100644
--- a/src/widgets/kernel/qboxlayout.h
+++ b/src/widgets/kernel/qboxlayout.h
@@ -67,7 +67,7 @@ public:
void addWidget(QWidget *, int stretch = 0, Qt::Alignment alignment = 0);
void addLayout(QLayout *layout, int stretch = 0);
void addStrut(int);
- void addItem(QLayoutItem *);
+ void addItem(QLayoutItem *) Q_DECL_OVERRIDE;
void insertSpacing(int index, int size);
void insertStretch(int index, int stretch = 0);
@@ -84,20 +84,20 @@ public:
void setStretch(int index, int stretch);
int stretch(int index) const;
- QSize sizeHint() const;
- QSize minimumSize() const;
- QSize maximumSize() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSize() const Q_DECL_OVERRIDE;
+ QSize maximumSize() const Q_DECL_OVERRIDE;
- bool hasHeightForWidth() const;
- int heightForWidth(int) const;
- int minimumHeightForWidth(int) const;
+ bool hasHeightForWidth() const Q_DECL_OVERRIDE;
+ int heightForWidth(int) const Q_DECL_OVERRIDE;
+ int minimumHeightForWidth(int) const Q_DECL_OVERRIDE;
- Qt::Orientations expandingDirections() const;
- void invalidate();
- QLayoutItem *itemAt(int) const;
- QLayoutItem *takeAt(int);
- int count() const;
- void setGeometry(const QRect&);
+ Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
+ void invalidate() Q_DECL_OVERRIDE;
+ QLayoutItem *itemAt(int) const Q_DECL_OVERRIDE;
+ QLayoutItem *takeAt(int) Q_DECL_OVERRIDE;
+ int count() const Q_DECL_OVERRIDE;
+ void setGeometry(const QRect&) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QBoxLayout)
diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h
index e8ce49503b..322510aff4 100644
--- a/src/widgets/kernel/qdesktopwidget.h
+++ b/src/widgets/kernel/qdesktopwidget.h
@@ -79,7 +79,7 @@ Q_SIGNALS:
void screenCountChanged(int);
protected:
- void resizeEvent(QResizeEvent *e);
+ void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QDesktopWidget)
diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h
index 62f4d8ed6f..0f3083cbb5 100644
--- a/src/widgets/kernel/qdesktopwidget_p.h
+++ b/src/widgets/kernel/qdesktopwidget_p.h
@@ -48,6 +48,8 @@
#include "QDesktopWidget"
#include "private/qwidget_p.h"
+#include <QtCore/qalgorithms.h>
+
QT_BEGIN_NAMESPACE
class QDesktopScreenWidget : public QWidget {
@@ -65,7 +67,7 @@ class QDesktopWidgetPrivate : public QWidgetPrivate {
Q_DECLARE_PUBLIC(QDesktopWidget)
public:
- ~QDesktopWidgetPrivate() {foreach(QDesktopScreenWidget *s, screens) delete s; }
+ ~QDesktopWidgetPrivate() { qDeleteAll(screens); }
void _q_updateScreens();
void _q_availableGeometryChanged();
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h
index 06100f858f..e06f1f7375 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -118,19 +118,19 @@ public:
QWidget *labelForField(QLayout *field) const;
// reimplemented from QLayout
- void addItem(QLayoutItem *item);
- QLayoutItem *itemAt(int index) const;
- QLayoutItem *takeAt(int index);
-
- void setGeometry(const QRect &rect);
- QSize minimumSize() const;
- QSize sizeHint() const;
- void invalidate();
-
- bool hasHeightForWidth() const;
- int heightForWidth(int width) const;
- Qt::Orientations expandingDirections() const;
- int count() const;
+ void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
+ QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
+ QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
+
+ void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
+ QSize minimumSize() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ void invalidate() Q_DECL_OVERRIDE;
+
+ bool hasHeightForWidth() const Q_DECL_OVERRIDE;
+ int heightForWidth(int width) const Q_DECL_OVERRIDE;
+ Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
+ int count() const Q_DECL_OVERRIDE;
int rowCount() const;
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index 2b8f04ccdf..902f1fbcb1 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -36,6 +36,7 @@
#include "private/qstandardgestures_p.h"
#include "qgraphicsview.h"
+#include <QtCore/QDebug>
#ifndef QT_NO_GESTURES
QT_BEGIN_NAMESPACE
@@ -1086,46 +1087,79 @@ QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const
}
#endif //QT_NO_GRAPHICSVIEW
-#ifdef Q_NO_USING_KEYWORD
-/*!
- \fn void QGestureEvent::setAccepted(bool accepted)
-
- Sets or clears the event's internal flag that determines whether it should
- be delivered to other objects.
-
- Calling this function with a value of true for \a accepted indicates that the
- caller has accepted the event and that it should not be propagated further.
- Calling this function with a value of false indicates that the caller has
- ignored the event and that it should be delivered to other objects.
-
- For convenience, the accept flag can also be set with accept(), and cleared
- with ignore().
-
- \sa QEvent::accepted
-*/
-/*!
- \fn bool QGestureEvent::isAccepted() const
+#ifndef QT_NO_DEBUG_STREAM
- Returns \c true is the event has been accepted; otherwise returns \c false.
-
- \sa QEvent::accepted
-*/
-/*!
- \fn void QGestureEvent::accept()
-
- Accepts the event, the equivalent of calling setAccepted(true).
-
- \sa QEvent::accept()
-*/
-/*!
- \fn void QGestureEvent::ignore()
+static void formatGestureHeader(QDebug d, const char *className, const QGesture *gesture)
+{
+ d << className << "(state=" << gesture->state();
+ if (gesture->hasHotSpot())
+ d << ",hotSpot=" << gesture->hotSpot();
+}
- Ignores the event, the equivalent of calling setAccepted(false).
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QGesture *gesture)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ switch (gesture->gestureType()) {
+ case Qt::TapGesture:
+ formatGestureHeader(d, "QTapGesture", gesture);
+ d << ",position=" << static_cast<const QTapGesture*>(gesture)->position() << ')';
+ break;
+ case Qt::TapAndHoldGesture: {
+ const QTapAndHoldGesture *tap = static_cast<const QTapAndHoldGesture*>(gesture);
+ formatGestureHeader(d, "QTapAndHoldGesture", tap);
+ d << ",position=" << tap->position() << ",timeout=" << tap->timeout() << ')';
+ }
+ break;
+ case Qt::PanGesture: {
+ const QPanGesture *pan = static_cast<const QPanGesture*>(gesture);
+ formatGestureHeader(d, "QPanGesture", pan);
+ d << ",lastOffset=" << pan->lastOffset() << ",offset=" << pan->offset()
+ << ",acceleration=" << pan->acceleration()
+ << ",delta=" << pan->delta() << ')';
+ }
+ break;
+ case Qt::PinchGesture: {
+ const QPinchGesture *pinch = static_cast<const QPinchGesture*>(gesture);
+ formatGestureHeader(d, "QPinchGesture", pinch);
+ d << ",totalChangeFlags=" << pinch->totalChangeFlags()
+ << ",changeFlags=" << pinch->changeFlags()
+ << ",startCenterPoint=" << pinch->startCenterPoint()
+ << ",lastCenterPoint=" << pinch->lastCenterPoint()
+ << ",centerPoint=" << pinch->centerPoint()
+ << ",totalScaleFactor=" << pinch->totalScaleFactor()
+ << ",lastScaleFactor=" << pinch->lastScaleFactor()
+ << ",scaleFactor=" << pinch->scaleFactor()
+ << ",totalRotationAngle=" << pinch->totalRotationAngle()
+ << ",lastRotationAngle=" << pinch->lastRotationAngle()
+ << ",rotationAngle=" << pinch->rotationAngle() << ')';
+ }
+ break;
+ case Qt::SwipeGesture: {
+ const QSwipeGesture *swipe = static_cast<const QSwipeGesture*>(gesture);
+ formatGestureHeader(d, "QSwipeGesture", swipe);
+ d << ",horizontalDirection=" << swipe->horizontalDirection()
+ << ",verticalDirection=" << swipe->verticalDirection()
+ << ",swipeAngle=" << swipe->swipeAngle() << ')';
+ }
+ break;
+ default:
+ formatGestureHeader(d, "Custom gesture", gesture);
+ d << ",type=" << gesture->gestureType() << ')';
+ break;
+ }
+ return d;
+}
- \sa QEvent::ignore()
-*/
-#endif
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QGestureEvent *gestureEvent)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "QGestureEvent(" << gestureEvent->gestures() << ')';
+ return d;
+}
+#endif // !QT_NO_DEBUG_STREAM
QT_END_NAMESPACE
#include <moc_qgesture.cpp>
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 9e3ee64c87..a66132566b 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -275,18 +275,10 @@ public:
QList<QGesture *> activeGestures() const;
QList<QGesture *> canceledGestures() const;
-#ifdef Q_NO_USING_KEYWORD
- inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); }
- inline bool isAccepted() const { return QEvent::isAccepted(); }
-
- inline void accept() { QEvent::accept(); }
- inline void ignore() { QEvent::ignore(); }
-#else
using QEvent::setAccepted;
using QEvent::isAccepted;
using QEvent::accept;
using QEvent::ignore;
-#endif
void setAccepted(QGesture *, bool);
void accept(QGesture *);
@@ -315,6 +307,11 @@ private:
friend class QGestureManager;
};
+# ifndef QT_NO_DEBUG_STREAM
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGesture *);
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGestureEvent *);
+# endif
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy)
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index f0aceaacf7..0dcb88fb39 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -51,18 +51,14 @@
#endif
#include "qdebug.h"
-
-// #define GESTURE_DEBUG
-#ifndef GESTURE_DEBUG
-# define DEBUG if (0) qDebug
-#else
-# define DEBUG qDebug
-#endif
+#include <QtCore/QLoggingCategory>
#ifndef QT_NO_GESTURES
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcGestureManager, "qt.widgets.gestures")
+
#if !defined(Q_OS_OSX)
static inline int panTouchPoints()
{
@@ -231,9 +227,8 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
// if the recognizer didn't fill in the gesture type, then this
// is a custom gesture with autogenerated id and we fill it.
state->d_func()->gestureType = type;
-#if defined(GESTURE_DEBUG)
- state->setObjectName(QString::number((int)type));
-#endif
+ if (lcGestureManager().isDebugEnabled())
+ state->setObjectName(QString::number((int)type));
}
m_objectGestures[QGestureManager::ObjectGesture(object, type)].append(state);
m_gestureToRecognizer[state] = recognizer;
@@ -275,26 +270,26 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
QGestureRecognizer::Result recognizerState = recognizerResult & QGestureRecognizer::ResultState_Mask;
QGestureRecognizer::Result resultHint = recognizerResult & QGestureRecognizer::ResultHint_Mask;
if (recognizerState == QGestureRecognizer::TriggerGesture) {
- DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state;
+ qCDebug(lcGestureManager) << "QGestureManager:Recognizer: gesture triggered: " << state << event;
triggeredGestures << state;
} else if (recognizerState == QGestureRecognizer::FinishGesture) {
- DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state;
+ qCDebug(lcGestureManager) << "QGestureManager:Recognizer: gesture finished: " << state << event;
finishedGestures << state;
} else if (recognizerState == QGestureRecognizer::MayBeGesture) {
- DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state;
+ qCDebug(lcGestureManager) << "QGestureManager:Recognizer: maybe gesture: " << state << event;
newMaybeGestures << state;
} else if (recognizerState == QGestureRecognizer::CancelGesture) {
- DEBUG() << "QGestureManager:Recognizer: not gesture: " << state;
+ qCDebug(lcGestureManager) << "QGestureManager:Recognizer: not gesture: " << state << event;
notGestures << state;
} else if (recognizerState == QGestureRecognizer::Ignore) {
- DEBUG() << "QGestureManager:Recognizer: ignored the event: " << state;
+ qCDebug(lcGestureManager) << "QGestureManager:Recognizer: ignored the event: " << state << event;
} else {
- DEBUG() << "QGestureManager:Recognizer: hm, lets assume the recognizer"
- << "ignored the event: " << state;
+ qCDebug(lcGestureManager) << "QGestureManager:Recognizer: hm, lets assume the recognizer"
+ << "ignored the event: " << state << event;
}
if (resultHint & QGestureRecognizer::ConsumeEventHint) {
- DEBUG() << "QGestureManager: we were asked to consume the event: "
- << state;
+ qCDebug(lcGestureManager) << "QGestureManager: we were asked to consume the event: "
+ << state << event;
consumeEventHint = true;
}
}
@@ -363,7 +358,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
if (!m_activeGestures.isEmpty() || !m_maybeGestures.isEmpty() ||
!startedGestures.isEmpty() || !triggeredGestures.isEmpty() ||
!finishedGestures.isEmpty() || !canceledGestures.isEmpty()) {
- DEBUG() << "QGestureManager::filterEventThroughContexts:"
+ qCDebug(lcGestureManager) << "QGestureManager::filterEventThroughContexts:"
<< "\n\tactiveGestures:" << m_activeGestures
<< "\n\tmaybeGestures:" << m_maybeGestures
<< "\n\tstarted:" << startedGestures
@@ -381,7 +376,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
if (undeliveredGestures.contains(g))
continue;
if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) {
- DEBUG() << "lets try to cancel some";
+ qCDebug(lcGestureManager) << "lets try to cancel some";
// find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them
cancelGesturesForChildren(g);
}
@@ -421,7 +416,7 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original)
QWidget *widget = m_gestureTargets.value(*iter);
// note that we don't touch the gestures for our originatingWidget
if (widget != originatingWidget && originatingWidget->isAncestorOf(widget)) {
- DEBUG() << " found a gesture to cancel" << (*iter);
+ qCDebug(lcGestureManager) << " found a gesture to cancel" << (*iter);
(*iter)->d_func()->state = Qt::GestureCanceled;
cancelledGestures << *iter;
iter = m_activeGestures.erase(iter);
@@ -648,7 +643,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
normalStartedGestures[target].append(gesture);
}
} else {
- DEBUG() << "QGestureManager::deliverEvent: could not find the target for gesture"
+ qCDebug(lcGestureManager) << "QGestureManager::deliverEvent: could not find the target for gesture"
<< gesture->gestureType();
qWarning("QGestureManager::deliverEvent: could not find the target for gesture");
undeliveredGestures->insert(gesture);
@@ -656,7 +651,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
}
getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures);
- DEBUG() << "QGestureManager::deliverEvents:"
+ qCDebug(lcGestureManager) << "QGestureManager::deliverEvents:"
<< "\nstarted: " << startedGestures
<< "\nconflicted: " << conflictedGestures
<< "\nnormal: " << normalStartedGestures
@@ -667,7 +662,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
e = conflictedGestures.constEnd(); it != e; ++it) {
QWidget *receiver = it.key();
QList<QGesture *> gestures = it.value();
- DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to"
+ qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending GestureOverride to"
<< receiver
<< "gestures:" << gestures;
QGestureEvent event(gestures);
@@ -683,13 +678,13 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
if (eventAccepted || event.isAccepted(gesture)) {
QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
Q_ASSERT(w);
- DEBUG() << "override event: gesture was accepted:" << gesture << w;
+ qCDebug(lcGestureManager) << "override event: gesture was accepted:" << gesture << w;
QList<QGesture *> &gestures = normalStartedGestures[w];
gestures.append(gesture);
// override the target
m_gestureTargets[gesture] = w;
} else {
- DEBUG() << "override event: gesture wasn't accepted. putting back:" << gesture;
+ qCDebug(lcGestureManager) << "override event: gesture wasn't accepted. putting back:" << gesture;
QList<QGesture *> &gestures = normalStartedGestures[receiver];
gestures.append(gesture);
}
@@ -700,7 +695,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(),
e = normalStartedGestures.constEnd(); it != e; ++it) {
if (!it.value().isEmpty()) {
- DEBUG() << "QGestureManager::deliverEvents: sending to" << it.key()
+ qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending to" << it.key()
<< "gestures:" << it.value();
QGestureEvent event(it.value());
QApplication::sendEvent(it.key(), &event);
@@ -710,7 +705,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
(eventAccepted || event.isAccepted(gesture))) {
QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
Q_ASSERT(w);
- DEBUG() << "started gesture was delivered and accepted by" << w;
+ qCDebug(lcGestureManager) << "started gesture was delivered and accepted by" << w;
m_gestureTargets[gesture] = w;
}
}
diff --git a/src/widgets/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h
index 95d8a0a445..89ece8f080 100644
--- a/src/widgets/kernel/qgridlayout.h
+++ b/src/widgets/kernel/qgridlayout.h
@@ -59,9 +59,9 @@ public:
~QGridLayout();
- QSize sizeHint() const;
- QSize minimumSize() const;
- QSize maximumSize() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSize() const Q_DECL_OVERRIDE;
+ QSize maximumSize() const Q_DECL_OVERRIDE;
void setHorizontalSpacing(int spacing);
int horizontalSpacing() const;
@@ -85,12 +85,12 @@ public:
QRect cellRect(int row, int column) const;
- bool hasHeightForWidth() const;
- int heightForWidth(int) const;
- int minimumHeightForWidth(int) const;
+ bool hasHeightForWidth() const Q_DECL_OVERRIDE;
+ int heightForWidth(int) const Q_DECL_OVERRIDE;
+ int minimumHeightForWidth(int) const Q_DECL_OVERRIDE;
- Qt::Orientations expandingDirections() const;
- void invalidate();
+ Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
+ void invalidate() Q_DECL_OVERRIDE;
inline void addWidget(QWidget *w) { QLayout::addWidget(w); }
void addWidget(QWidget *, int row, int column, Qt::Alignment = 0);
@@ -101,11 +101,11 @@ public:
void setOriginCorner(Qt::Corner);
Qt::Corner originCorner() const;
- QLayoutItem *itemAt(int index) const;
+ QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
QLayoutItem *itemAtPosition(int row, int column) const;
- QLayoutItem *takeAt(int index);
- int count() const;
- void setGeometry(const QRect&);
+ QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
+ int count() const Q_DECL_OVERRIDE;
+ void setGeometry(const QRect&) Q_DECL_OVERRIDE;
void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = 0);
@@ -113,7 +113,7 @@ public:
void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan) const;
protected:
- void addItem(QLayoutItem *);
+ void addItem(QLayoutItem *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QGridLayout)
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index f124f1ed8e..d2bc8f8347 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -268,14 +268,6 @@ bool QLayout::setAlignment(QLayout *l, Qt::Alignment alignment)
}
/*!
- \fn void QLayout::setAlignment(Qt::Alignment alignment)
-
- Sets the alignment of this item to \a alignment.
-
- \sa QLayoutItem::setAlignment()
-*/
-
-/*!
\property QLayout::margin
\brief the width of the outside border of the layout
\obsolete
diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h
index 38568e434c..8bcbb700f4 100644
--- a/src/widgets/kernel/qlayout.h
+++ b/src/widgets/kernel/qlayout.h
@@ -88,11 +88,7 @@ public:
bool setAlignment(QWidget *w, Qt::Alignment alignment);
bool setAlignment(QLayout *l, Qt::Alignment alignment);
-#ifdef Q_NO_USING_KEYWORD
- inline void setAlignment(Qt::Alignment alignment) { QLayoutItem::setAlignment(alignment); }
-#else
using QLayoutItem::setAlignment;
-#endif
void setSizeConstraint(SizeConstraint);
SizeConstraint sizeConstraint() const;
@@ -101,8 +97,8 @@ public:
QWidget *parentWidget() const;
- void invalidate();
- QRect geometry() const;
+ void invalidate() Q_DECL_OVERRIDE;
+ QRect geometry() const Q_DECL_OVERRIDE;
bool activate();
void update();
@@ -112,16 +108,16 @@ public:
void removeWidget(QWidget *w);
void removeItem(QLayoutItem *);
- Qt::Orientations expandingDirections() const;
- QSize minimumSize() const;
- QSize maximumSize() const;
- virtual void setGeometry(const QRect&);
+ Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
+ QSize minimumSize() const Q_DECL_OVERRIDE;
+ QSize maximumSize() const Q_DECL_OVERRIDE;
+ virtual void setGeometry(const QRect&) Q_DECL_OVERRIDE;
virtual QLayoutItem *itemAt(int index) const = 0;
virtual QLayoutItem *takeAt(int index) = 0;
virtual int indexOf(QWidget *) const;
virtual int count() const = 0;
- bool isEmpty() const;
- QSizePolicy::ControlTypes controlTypes() const;
+ bool isEmpty() const Q_DECL_OVERRIDE;
+ QSizePolicy::ControlTypes controlTypes() const Q_DECL_OVERRIDE;
// ### Qt 6 make this function virtual
QLayoutItem *replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOptions options = Qt::FindChildrenRecursively);
@@ -130,7 +126,7 @@ public:
QSize totalMinimumSize() const;
QSize totalMaximumSize() const;
QSize totalSizeHint() const;
- QLayout *layout();
+ QLayout *layout() Q_DECL_OVERRIDE;
void setEnabled(bool);
bool isEnabled() const;
@@ -140,7 +136,7 @@ public:
protected:
void widgetEvent(QEvent *);
- void childEvent(QChildEvent *e);
+ void childEvent(QChildEvent *e) Q_DECL_OVERRIDE;
void addChildLayout(QLayout *l);
void addChildWidget(QWidget *w);
bool adoptLayout(QLayout *layout);
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index db116b070c..63ef4d6cc6 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -420,10 +420,25 @@ QT_BEGIN_NAMESPACE
the intention is to have a semi-transparent window. In that case the
traditional approach of setting Qt::WA_TranslucentBackground is sufficient.
+ QOpenGLWidget supports multiple update behaviors, just like QOpenGLWindow. In
+ preserved mode the rendered content from the previous paintGL() call is
+ available in the next one, allowing incremental rendering. In non-preserved
+ mode the content is lost and paintGL() implementations are expected to redraw
+ everything in the view.
+
+ Before Qt 5.5 the default behavior of QOpenGLWidget was to preserve the
+ rendered contents between paintGL() calls. Since Qt 5.5 the default behavior
+ is non-preserved because this provides better performance and the majority of
+ applications have no need for the previous content. This also resembles the
+ semantics of an OpenGL-based QWindow and matches the default behavior of
+ QOpenGLWindow in that the color and ancillary buffers are invalidated for
+ each frame. To restore the preserved behavior, call setUpdateBehavior() with
+ \c PartialUpdate.
+
\e{OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other
countries.}
- \sa QOpenGLFunctions, QOpenGLWindow, Qt::AA_ShareOpenGLContexts
+ \sa QOpenGLFunctions, QOpenGLWindow, Qt::AA_ShareOpenGLContexts, UpdateBehavior
*/
/*!
@@ -455,6 +470,30 @@ QT_BEGIN_NAMESPACE
due to resizing the widget.
*/
+/*!
+ \enum QOpenGLWidget::UpdateBehavior
+ \since 5.5
+
+ This enum describes the update semantics of QOpenGLWidget.
+
+ \value NoPartialUpdate QOpenGLWidget will discard the
+ contents of the color buffer and the ancillary buffers after the
+ QOpenGLWidget is rendered to screen. This is the same behavior that can be
+ expected by calling QOpenGLContext::swapBuffers with a default opengl
+ enabled QWindow as the argument. NoPartialUpdate can have some performance
+ benefits on certain hardware architectures common in the mobile and
+ embedded space when a framebuffer object is used as the rendering target.
+ The framebuffer object is invalidated between frames with
+ glDiscardFramebufferEXT if supported or a glClear. Please see the
+ documentation of EXT_discard_framebuffer for more information:
+ https://www.khronos.org/registry/gles/extensions/EXT/EXT_discard_framebuffer.txt
+
+ \value PartialUpdate The framebuffer objects color buffer and ancillary
+ buffers are not invalidated between frames.
+
+ \sa updateBehavior(), setUpdateBehavior()
+*/
+
class QOpenGLWidgetPaintDevicePrivate : public QOpenGLPaintDevicePrivate
{
public:
@@ -486,9 +525,11 @@ public:
surface(0),
initialized(false),
fakeHidden(false),
- paintDevice(0),
inBackingStorePaint(false),
- flushPending(false)
+ hasBeenComposed(false),
+ flushPending(false),
+ paintDevice(0),
+ updateBehavior(QOpenGLWidget::NoPartialUpdate)
{
requestedFormat = QSurfaceFormat::defaultFormat();
}
@@ -507,6 +548,8 @@ public:
void invokeUserPaint();
void render();
+ void invalidateFbo();
+
QImage grabFramebuffer() Q_DECL_OVERRIDE;
void beginBackingStorePainting() Q_DECL_OVERRIDE { inBackingStorePaint = true; }
void endBackingStorePainting() Q_DECL_OVERRIDE { inBackingStorePaint = false; }
@@ -522,10 +565,12 @@ public:
QOffscreenSurface *surface;
bool initialized;
bool fakeHidden;
- QOpenGLPaintDevice *paintDevice;
bool inBackingStorePaint;
- QSurfaceFormat requestedFormat;
+ bool hasBeenComposed;
bool flushPending;
+ QOpenGLPaintDevice *paintDevice;
+ QSurfaceFormat requestedFormat;
+ QOpenGLWidget::UpdateBehavior updateBehavior;
};
void QOpenGLWidgetPaintDevicePrivate::beginPaint()
@@ -648,6 +693,7 @@ void QOpenGLWidgetPrivate::beginCompose()
q->makeCurrent();
context->functions()->glFlush();
}
+ hasBeenComposed = true;
emit q->aboutToCompose();
}
@@ -743,9 +789,31 @@ void QOpenGLWidgetPrivate::render()
return;
q->makeCurrent();
+
+ if (updateBehavior == QOpenGLWidget::NoPartialUpdate && hasBeenComposed) {
+ invalidateFbo();
+ hasBeenComposed = false;
+ }
+
invokeUserPaint();
}
+void QOpenGLWidgetPrivate::invalidateFbo()
+{
+ QOpenGLExtensions *f = static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions());
+ if (f->hasOpenGLExtension(QOpenGLExtensions::DiscardFramebuffer)) {
+ const int gl_color_attachment0 = 0x8CE0; // GL_COLOR_ATTACHMENT0
+ const int gl_depth_attachment = 0x8D00; // GL_DEPTH_ATTACHMENT
+ const int gl_stencil_attachment = 0x8D20; // GL_STENCIL_ATTACHMENT
+ const GLenum attachments[] = {
+ gl_color_attachment0, gl_depth_attachment, gl_stencil_attachment
+ };
+ f->glDiscardFramebufferEXT(GL_FRAMEBUFFER, sizeof attachments / sizeof *attachments, attachments);
+ } else {
+ f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ }
+}
+
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
QImage QOpenGLWidgetPrivate::grabFramebuffer()
@@ -801,6 +869,26 @@ QOpenGLWidget::~QOpenGLWidget()
}
/*!
+ Sets this widget's update behavior to \a updateBehavior.
+ \since 5.5
+*/
+void QOpenGLWidget::setUpdateBehavior(UpdateBehavior updateBehavior)
+{
+ Q_D(QOpenGLWidget);
+ d->updateBehavior = updateBehavior;
+}
+
+/*!
+ \return the update behavior of the widget.
+ \since 5.5
+*/
+QOpenGLWidget::UpdateBehavior QOpenGLWidget::updateBehavior() const
+{
+ Q_D(const QOpenGLWidget);
+ return d->updateBehavior;
+}
+
+/*!
Sets the requested surface \a format.
When the format is not explicitly set via this function, the format returned by
diff --git a/src/widgets/kernel/qopenglwidget.h b/src/widgets/kernel/qopenglwidget.h
index 2439fe65ce..3a4c1780dd 100644
--- a/src/widgets/kernel/qopenglwidget.h
+++ b/src/widgets/kernel/qopenglwidget.h
@@ -52,9 +52,17 @@ class Q_WIDGETS_EXPORT QOpenGLWidget : public QWidget
Q_DECLARE_PRIVATE(QOpenGLWidget)
public:
+ enum UpdateBehavior {
+ NoPartialUpdate,
+ PartialUpdate
+ };
+
explicit QOpenGLWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
~QOpenGLWidget();
+ void setUpdateBehavior(UpdateBehavior updateBehavior);
+ UpdateBehavior updateBehavior() const;
+
void setFormat(const QSurfaceFormat &format);
QSurfaceFormat format() const;
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index 86db4bcdab..0edaab7175 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -84,7 +84,7 @@ Q_SIGNALS:
void activatedAmbiguously();
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
};
#endif // QT_NO_SHORTCUT
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 41adf5c58a..5b236d6e44 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -45,6 +45,7 @@ class Q_WIDGETS_EXPORT QSizePolicy
{
Q_GADGET
Q_ENUMS(Policy)
+ Q_FLAGS(ControlTypes)
public:
enum PolicyFlag {
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index d9a7745686..94ac97e1f8 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -140,11 +140,6 @@ QLayoutItem* QStackedLayoutPrivate::replaceAt(int idx, QLayoutItem *newitem)
*/
/*!
- \fn QWidget *QStackedLayout::widget()
- \internal
-*/
-
-/*!
Constructs a QStackedLayout with no parent.
This QStackedLayout must be installed on a widget later on to
diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h
index b715f02069..afa45afc68 100644
--- a/src/widgets/kernel/qstackedlayout.h
+++ b/src/widgets/kernel/qstackedlayout.h
@@ -66,26 +66,22 @@ public:
QWidget *currentWidget() const;
int currentIndex() const;
-#ifdef Q_NO_USING_KEYWORD
- inline QWidget *widget() { return QLayout::widget(); }
-#else
using QLayout::widget;
-#endif
QWidget *widget(int) const;
- int count() const;
+ int count() const Q_DECL_OVERRIDE;
StackingMode stackingMode() const;
void setStackingMode(StackingMode stackingMode);
// abstract virtual functions:
- void addItem(QLayoutItem *item);
- QSize sizeHint() const;
- QSize minimumSize() const;
- QLayoutItem *itemAt(int) const;
- QLayoutItem *takeAt(int);
- void setGeometry(const QRect &rect);
- bool hasHeightForWidth() const;
- int heightForWidth(int width) const;
+ void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSize() const Q_DECL_OVERRIDE;
+ QLayoutItem *itemAt(int) const Q_DECL_OVERRIDE;
+ QLayoutItem *takeAt(int) Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
+ bool hasHeightForWidth() const Q_DECL_OVERRIDE;
+ int heightForWidth(int width) const Q_DECL_OVERRIDE;
Q_SIGNALS:
void widgetRemoved(int index);
diff --git a/src/widgets/kernel/qstandardgestures_p.h b/src/widgets/kernel/qstandardgestures_p.h
index 15ba31f26a..2f2aac45c1 100644
--- a/src/widgets/kernel/qstandardgestures_p.h
+++ b/src/widgets/kernel/qstandardgestures_p.h
@@ -57,9 +57,9 @@ class QPanGestureRecognizer : public QGestureRecognizer
public:
explicit QPanGestureRecognizer(int pointCount = 2) : m_pointCount(pointCount) {}
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
- void reset(QGesture *state);
+ QGesture *create(QObject *target) Q_DECL_OVERRIDE;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+ void reset(QGesture *state) Q_DECL_OVERRIDE;
private:
const int m_pointCount;
@@ -70,9 +70,9 @@ class QPinchGestureRecognizer : public QGestureRecognizer
public:
QPinchGestureRecognizer();
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
- void reset(QGesture *state);
+ QGesture *create(QObject *target) Q_DECL_OVERRIDE;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+ void reset(QGesture *state) Q_DECL_OVERRIDE;
};
class QSwipeGestureRecognizer : public QGestureRecognizer
@@ -80,9 +80,9 @@ class QSwipeGestureRecognizer : public QGestureRecognizer
public:
QSwipeGestureRecognizer();
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
- void reset(QGesture *state);
+ QGesture *create(QObject *target) Q_DECL_OVERRIDE;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+ void reset(QGesture *state) Q_DECL_OVERRIDE;
};
class QTapGestureRecognizer : public QGestureRecognizer
@@ -90,9 +90,9 @@ class QTapGestureRecognizer : public QGestureRecognizer
public:
QTapGestureRecognizer();
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
- void reset(QGesture *state);
+ QGesture *create(QObject *target) Q_DECL_OVERRIDE;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+ void reset(QGesture *state) Q_DECL_OVERRIDE;
};
class QTapAndHoldGestureRecognizer : public QGestureRecognizer
@@ -100,9 +100,9 @@ class QTapAndHoldGestureRecognizer : public QGestureRecognizer
public:
QTapAndHoldGestureRecognizer();
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
- void reset(QGesture *state);
+ QGesture *create(QObject *target) Q_DECL_OVERRIDE;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+ void reset(QGesture *state) Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 7fcc5d3bc6..bb095e2ee0 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -116,7 +116,7 @@ public:
~QTipLabel();
static QTipLabel *instance;
- bool eventFilter(QObject *, QEvent *);
+ bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
QBasicTimer hideTimer, expireTimer;
@@ -132,10 +132,10 @@ public:
static int getTipScreen(const QPoint &pos, QWidget *w);
protected:
- void timerEvent(QTimerEvent *e);
- void paintEvent(QPaintEvent *e);
- void mouseMoveEvent(QMouseEvent *e);
- void resizeEvent(QResizeEvent *e);
+ void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
#ifndef QT_NO_STYLE_STYLESHEET
public slots:
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 632cb242dc..b4d18844a9 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -141,12 +141,12 @@ public:
static QWhatsThat *instance;
protected:
- void showEvent(QShowEvent *e);
- void mousePressEvent(QMouseEvent*);
- void mouseReleaseEvent(QMouseEvent*);
- void mouseMoveEvent(QMouseEvent*);
- void keyPressEvent(QKeyEvent*);
- void paintEvent(QPaintEvent*);
+ void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent*) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent*) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent*) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent*) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
private:
QPointer<QWidget>widget;
@@ -361,7 +361,7 @@ class QWhatsThisPrivate : public QObject
QWhatsThisPrivate();
~QWhatsThisPrivate();
static QWhatsThisPrivate *instance;
- bool eventFilter(QObject *, QEvent *);
+ bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
QPointer<QAction> action;
static void say(QWidget *, const QString &, int x = 0, int y = 0);
static void notifyToplevels(QEvent *e);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index c362530264..7b7600fdc3 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1283,10 +1283,8 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
}
- static int paintOnScreenEnv = -1;
- if (paintOnScreenEnv == -1)
- paintOnScreenEnv = qgetenv("QT_ONSCREEN_PAINT").toInt() > 0 ? 1 : 0;
- if (paintOnScreenEnv == 1)
+ static const bool paintOnScreenEnv = qEnvironmentVariableIntValue("QT_ONSCREEN_PAINT") > 0;
+ if (paintOnScreenEnv)
setAttribute(Qt::WA_PaintOnScreen);
if (QApplicationPrivate::testAttribute(Qt::AA_NativeWindows))
@@ -2112,7 +2110,7 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt
bool alsoNonOpaque) const
{
Q_Q(const QWidget);
- static int disableSubtractOpaqueSiblings = qgetenv("QT_NO_SUBTRACTOPAQUESIBLINGS").toInt();
+ static int disableSubtractOpaqueSiblings = qEnvironmentVariableIntValue("QT_NO_SUBTRACTOPAQUESIBLINGS");
if (disableSubtractOpaqueSiblings || q->isWindow())
return;
@@ -10917,9 +10915,9 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
return;
Q_D(QWidget);
- Q_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8),
- "QWidget::setAttribute(WidgetAttribute, bool)",
- "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute");
+ Q_STATIC_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8),
+ "QWidget::setAttribute(WidgetAttribute, bool): "
+ "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute");
#ifdef Q_OS_WIN
// ### Don't use PaintOnScreen+paintEngine() to do native painting in some future release
if (attribute == Qt::WA_PaintOnScreen && on && windowType() != Qt::Desktop && !inherits("QGLWidget")) {
@@ -12579,13 +12577,10 @@ int QWidget::metric(PaintDeviceMetric m) const
QWindow *topLevelWindow = 0;
QScreen *screen = 0;
- if (QWidget *topLevel = window())
+ if (QWidget *topLevel = window()) {
topLevelWindow = topLevel->windowHandle();
-
- if (topLevelWindow) {
- QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(topLevelWindow);
- if (platformScreen)
- screen = platformScreen->screen();
+ if (topLevelWindow)
+ screen = topLevelWindow->screen();
}
if (!screen && QGuiApplication::primaryScreen())
screen = QGuiApplication::primaryScreen();
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index ad1e276567..52c12d3730 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -203,7 +203,7 @@ public:
explicit QWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
~QWidget();
- int devType() const;
+ int devType() const Q_DECL_OVERRIDE;
WId winId() const;
void createWinId(); // internal, going away
@@ -568,7 +568,7 @@ public:
void setAttribute(Qt::WidgetAttribute, bool on = true);
inline bool testAttribute(Qt::WidgetAttribute) const;
- QPaintEngine *paintEngine() const;
+ QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
void ensurePolished() const;
@@ -598,7 +598,7 @@ Q_SIGNALS:
protected:
// Event handlers
- bool event(QEvent *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
virtual void mousePressEvent(QMouseEvent *);
virtual void mouseReleaseEvent(QMouseEvent *);
virtual void mouseDoubleClickEvent(QMouseEvent *);
@@ -640,10 +640,10 @@ protected:
// Misc. protected functions
virtual void changeEvent(QEvent *);
- int metric(PaintDeviceMetric) const;
- void initPainter(QPainter *painter) const;
- QPaintDevice *redirected(QPoint *offset) const;
- QPainter *sharedPainter() const;
+ int metric(PaintDeviceMetric) const Q_DECL_OVERRIDE;
+ void initPainter(QPainter *painter) const Q_DECL_OVERRIDE;
+ QPaintDevice *redirected(QPoint *offset) const Q_DECL_OVERRIDE;
+ QPainter *sharedPainter() const Q_DECL_OVERRIDE;
virtual void inputMethodEvent(QInputMethodEvent *);
public:
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index b3552cba68..50a8066a41 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -612,10 +612,10 @@ public:
{ return p + data.wrect.topLeft(); }
inline QRect mapToWS(const QRect &r) const
- { QRect rr(r); rr.translate(-data.wrect.topLeft()); return rr; }
+ { return r.translated(-data.wrect.topLeft()); }
inline QRect mapFromWS(const QRect &r) const
- { QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; }
+ { return r.translated(data.wrect.topLeft()); }
QOpenGLContext *shareContext() const;
@@ -909,10 +909,10 @@ public:
inline QRect deviceRect() const
{ return m_widget->window()->rect(); }
- QRectF boundingRect(Qt::CoordinateSystem system) const;
- void draw(QPainter *p);
+ QRectF boundingRect(Qt::CoordinateSystem system) const Q_DECL_OVERRIDE;
+ void draw(QPainter *p) Q_DECL_OVERRIDE;
QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset,
- QGraphicsEffect::PixmapPadMode mode) const;
+ QGraphicsEffect::PixmapPadMode mode) const Q_DECL_OVERRIDE;
QWidget *m_widget;
QWidgetPaintContext *context;
diff --git a/src/widgets/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h
index afea8454d9..896fc1ffe4 100644
--- a/src/widgets/kernel/qwidgetaction.h
+++ b/src/widgets/kernel/qwidgetaction.h
@@ -59,8 +59,8 @@ public:
void releaseWidget(QWidget *widget);
protected:
- virtual bool event(QEvent *);
- virtual bool eventFilter(QObject *, QEvent *);
+ virtual bool event(QEvent *) Q_DECL_OVERRIDE;
+ virtual bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
virtual QWidget *createWidget(QWidget *parent);
virtual void deleteWidget(QWidget *widget);
QList<QWidget *> createdWidgets() const;
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index cd01869af2..68beb9afca 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -81,14 +81,14 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
Q_ASSERT(tlw);
#if !defined(QT_NO_PAINT_DEBUG)
- static int flushUpdate = qgetenv("QT_FLUSH_UPDATE").toInt();
+ static int flushUpdate = qEnvironmentVariableIntValue("QT_FLUSH_UPDATE");
if (flushUpdate > 0)
QWidgetBackingStore::showYellowThing(widget, region, flushUpdate * 10, false);
#endif
if (tlw->testAttribute(Qt::WA_DontShowOnScreen) || widget->testAttribute(Qt::WA_DontShowOnScreen))
return;
- static bool fpsDebug = qgetenv("QT_DEBUG_FPS").toInt();
+ static bool fpsDebug = qEnvironmentVariableIntValue("QT_DEBUG_FPS");
if (fpsDebug) {
if (!widgetBackingStore->perfFrames++)
widgetBackingStore->perfTime.start();
@@ -239,12 +239,12 @@ bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn)
int delay = 0;
if (widget->testAttribute(Qt::WA_WState_InPaintEvent)) {
- static int flushPaintEvent = qgetenv("QT_FLUSH_PAINT_EVENT").toInt();
+ static int flushPaintEvent = qEnvironmentVariableIntValue("QT_FLUSH_PAINT_EVENT");
if (!flushPaintEvent)
return false;
delay = flushPaintEvent;
} else {
- static int flushPaint = qgetenv("QT_FLUSH_PAINT").toInt();
+ static int flushPaint = qEnvironmentVariableIntValue("QT_FLUSH_PAINT");
if (!flushPaint)
return false;
delay = flushPaint;
@@ -780,10 +780,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy)
if (x->inTopLevelResize)
return;
- static int accelEnv = -1;
- if (accelEnv == -1) {
- accelEnv = qgetenv("QT_NO_FAST_MOVE").toInt() == 0;
- }
+ static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_MOVE") == 0;
QWidget *pw = q->parentWidget();
QPoint toplevelOffset = pw->mapTo(tlw, QPoint());
@@ -862,10 +859,7 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy)
if (!wbs)
return;
- static int accelEnv = -1;
- if (accelEnv == -1) {
- accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0;
- }
+ static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_SCROLL") == 0;
QRect scrollRect = rect & clipRect();
bool overlapped = false;
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index b31f9a51dd..f543086969 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -63,7 +63,7 @@ class QWidgetWindowPrivate : public QWindowPrivate
{
Q_DECLARE_PUBLIC(QWidgetWindow)
public:
- QWindow *eventReceiver() {
+ QWindow *eventReceiver() Q_DECL_OVERRIDE {
Q_Q(QWidgetWindow);
QWindow *w = q;
while (w->parent() && qobject_cast<QWidgetWindow *>(w) && qobject_cast<QWidgetWindow *>(w->parent())) {
@@ -72,7 +72,7 @@ public:
return w;
}
- void clearFocusObject()
+ void clearFocusObject() Q_DECL_OVERRIDE
{
Q_Q(QWidgetWindow);
QWidget *widget = q->widget();
@@ -440,6 +440,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
QGuiApplicationPrivate::setMouseEventSource(&e, QGuiApplicationPrivate::mouseEventSource(event));
e.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver);
+ qt_last_mouse_receiver = receiver;
} else {
// close disabled popups when a mouse button is pressed or released
switch (event->type()) {
diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h
index 0632a5c364..3bacb0c8e4 100644
--- a/src/widgets/kernel/qwidgetwindow_p.h
+++ b/src/widgets/kernel/qwidgetwindow_p.h
@@ -65,12 +65,12 @@ public:
QWidget *widget() const { return m_widget; }
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleInterface *accessibleRoot() const;
+ QAccessibleInterface *accessibleRoot() const Q_DECL_OVERRIDE;
#endif
- QObject *focusObject() const;
+ QObject *focusObject() const Q_DECL_OVERRIDE;
protected:
- bool event(QEvent *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
void handleCloseEvent(QCloseEvent *);
void handleEnterLeaveEvent(QEvent *);
@@ -91,7 +91,7 @@ protected:
#endif
void handleExposeEvent(QExposeEvent *);
void handleWindowStateChangedEvent(QWindowStateChangeEvent *event);
- bool nativeEvent(const QByteArray &eventType, void *message, long *result);
+ bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
#ifndef QT_NO_TABLETEVENT
void handleTabletEvent(QTabletEvent *);
#endif
diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h
index 6ba1ab544e..751c932ef0 100644
--- a/src/widgets/kernel/qwindowcontainer_p.h
+++ b/src/widgets/kernel/qwindowcontainer_p.h
@@ -68,7 +68,7 @@ public:
static void parentWasLowered(QWidget *parent);
protected:
- bool event(QEvent *ev);
+ bool event(QEvent *ev) Q_DECL_OVERRIDE;
private slots:
void focusWindowChanged(QWindow *focusWindow);
diff --git a/src/widgets/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h
index cae7342b2e..4a856be57c 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition_p.h
+++ b/src/widgets/statemachine/qbasickeyeventtransition_p.h
@@ -75,8 +75,8 @@ public:
void setModifierMask(Qt::KeyboardModifiers modifiers);
protected:
- bool eventTest(QEvent *event);
- void onTransition(QEvent *);
+ bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
+ void onTransition(QEvent *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QBasicKeyEventTransition)
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
index 5adb8702cc..beedec2201 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
@@ -78,8 +78,8 @@ public:
void setHitTestPath(const QPainterPath &path);
protected:
- bool eventTest(QEvent *event);
- void onTransition(QEvent *);
+ bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
+ void onTransition(QEvent *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QBasicMouseEventTransition)
diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h
index 816770c04a..571040a748 100644
--- a/src/widgets/statemachine/qkeyeventtransition.h
+++ b/src/widgets/statemachine/qkeyeventtransition.h
@@ -60,8 +60,8 @@ public:
void setModifierMask(Qt::KeyboardModifiers modifiers);
protected:
- void onTransition(QEvent *event);
- bool eventTest(QEvent *event);
+ void onTransition(QEvent *event) Q_DECL_OVERRIDE;
+ bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QKeyEventTransition)
diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h
index 2bad8b13bd..d2caf8d5fe 100644
--- a/src/widgets/statemachine/qmouseeventtransition.h
+++ b/src/widgets/statemachine/qmouseeventtransition.h
@@ -64,8 +64,8 @@ public:
void setHitTestPath(const QPainterPath &path);
protected:
- void onTransition(QEvent *event);
- bool eventTest(QEvent *event);
+ void onTransition(QEvent *event) Q_DECL_OVERRIDE;
+ bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QMouseEventTransition)
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index c688462794..29df1c6387 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -4592,6 +4592,12 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_HeaderGripMargin:
ret = int(QStyleHelper::dpiScaled(4.));
break;
+ case PM_HeaderDefaultSectionSizeHorizontal:
+ ret = int(QStyleHelper::dpiScaled(100.));
+ break;
+ case PM_HeaderDefaultSectionSizeVertical:
+ ret = int(QStyleHelper::dpiScaled(30.));
+ break;
case PM_TabBarScrollButtonWidth:
ret = int(QStyleHelper::dpiScaled(16.));
break;
@@ -4926,6 +4932,25 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = true;
break;
+ case SH_Menu_SubMenuUniDirection:
+ ret = false;
+ break;
+ case SH_Menu_SubMenuUniDirectionFailCount:
+ ret = 1;
+ break;
+ case SH_Menu_SubMenuSloppySelectOtherActions:
+ ret = true;
+ break;
+ case SH_Menu_SubMenuSloppyCloseTimeout:
+ ret = 1000;
+ break;
+ case SH_Menu_SubMenuResetWhenReenteringParent:
+ ret = false;
+ break;
+ case SH_Menu_SubMenuDontStartSloppyOnLeave:
+ ret = false;
+ break;
+
case SH_ProgressDialog_TextLabelAlignment:
ret = Qt::AlignCenter;
break;
diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h
index 7e885d0b77..465d0f17aa 100644
--- a/src/widgets/styles/qcommonstyle.h
+++ b/src/widgets/styles/qcommonstyle.h
@@ -49,40 +49,40 @@ public:
~QCommonStyle();
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
- QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *w = 0) const;
+ const QPoint &pt, const QWidget *w = 0) const Q_DECL_OVERRIDE;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc,
- const QWidget *w = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &contentsSize, const QWidget *widget = 0) const;
+ const QSize &contentsSize, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
- int pixelMetric(PixelMetric m, const QStyleOption *opt = 0, const QWidget *widget = 0) const;
+ int pixelMetric(PixelMetric m, const QStyleOption *opt = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0,
- QStyleHintReturn *shret = 0) const;
+ QStyleHintReturn *shret = 0) const Q_DECL_OVERRIDE;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt = 0,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt = 0,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
- const QStyleOption *opt) const;
+ const QStyleOption *opt) const Q_DECL_OVERRIDE;
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
Qt::Orientation orientation, const QStyleOption *option = 0,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
- void polish(QPalette &);
- void polish(QApplication *app);
- void polish(QWidget *widget);
- void unpolish(QWidget *widget);
- void unpolish(QApplication *application);
+ void polish(QPalette &) Q_DECL_OVERRIDE;
+ void polish(QApplication *app) Q_DECL_OVERRIDE;
+ void polish(QWidget *widget) Q_DECL_OVERRIDE;
+ void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
+ void unpolish(QApplication *application) Q_DECL_OVERRIDE;
protected:
QCommonStyle(QCommonStylePrivate &dd);
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index ed7b4ab3b6..c4f78b9998 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1541,7 +1541,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
bool ignoreCheckMark = false;
int checkcol = qMax(menuItem->maxIconWidth, 20);
- if (qobject_cast<const QComboBox*>(widget))
+ if (qobject_cast<const QComboBox*>(widget) ||
+ (option->styleObject && option->styleObject->property("_q_isComboBoxPopupItem").toBool()))
ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate
if (!ignoreCheckMark) {
@@ -1610,7 +1611,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
QRect pmr(0, 0, pixw, pixh);
pmr.moveCenter(vCheckRect.center());
painter->setPen(menuItem->palette.text().color());
- if (checkable && checked) {
+ if (!ignoreCheckMark && checkable && checked) {
QStyleOption opt = *option;
if (act) {
QColor activeColor = mergedColors(option->palette.background().color(),
diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h
index 7d0326d0a1..e7ba66f818 100644
--- a/src/widgets/styles/qfusionstyle_p.h
+++ b/src/widgets/styles/qfusionstyle_p.h
@@ -62,41 +62,41 @@ public:
QFusionStyle();
~QFusionStyle();
- QPalette standardPalette () const;
+ QPalette standardPalette () const Q_DECL_OVERRIDE;
void drawPrimitive(PrimitiveElement elem,
const QStyleOption *option,
- QPainter *painter, const QWidget *widget = 0) const;
+ QPainter *painter, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
void drawControl(ControlElement ce, const QStyleOption *option, QPainter *painter,
- const QWidget *widget) const;
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
+ const QWidget *widget) const Q_DECL_OVERRIDE;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget) const;
- QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const;
+ QPainter *painter, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
QSize sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const;
+ const QSize &size, const QWidget *widget) const Q_DECL_OVERRIDE;
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *w = 0) const;
+ const QPoint &pt, const QWidget *w = 0) const Q_DECL_OVERRIDE;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
- SubControl sc, const QWidget *widget) const;
+ SubControl sc, const QWidget *widget) const Q_DECL_OVERRIDE;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
- const QStyleOption *opt) const;
+ const QStyleOption *opt) const Q_DECL_OVERRIDE;
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0,
- QStyleHintReturn *returnData = 0) const;
- QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
+ QStyleHintReturn *returnData = 0) const Q_DECL_OVERRIDE;
+ QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
void drawItemPixmap(QPainter *painter, const QRect &rect,
- int alignment, const QPixmap &pixmap) const;
+ int alignment, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
void drawItemText(QPainter *painter, const QRect &rect,
int flags, const QPalette &pal, bool enabled,
- const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
- void polish(QWidget *widget);
- void polish(QApplication *app);
- void polish(QPalette &pal);
- void unpolish(QWidget *widget);
- void unpolish(QApplication *app);
+ const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const Q_DECL_OVERRIDE;
+ void polish(QWidget *widget) Q_DECL_OVERRIDE;
+ void polish(QApplication *app) Q_DECL_OVERRIDE;
+ void polish(QPalette &pal) Q_DECL_OVERRIDE;
+ void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
+ void unpolish(QApplication *app) Q_DECL_OVERRIDE;
protected:
QFusionStyle(QFusionStylePrivate &dd);
diff --git a/src/widgets/styles/qgtk2painter_p.h b/src/widgets/styles/qgtk2painter_p.h
index 432daaca29..6204e11fa9 100644
--- a/src/widgets/styles/qgtk2painter_p.h
+++ b/src/widgets/styles/qgtk2painter_p.h
@@ -59,33 +59,33 @@ public:
void paintBoxGap(GtkWidget *gtkWidget, const gchar* part, const QRect &rect,
GtkStateType state, GtkShadowType shadow, GtkPositionType gap_side, gint x,
- gint width, GtkStyle *style);
+ gint width, GtkStyle *style) Q_DECL_OVERRIDE;
void paintBox(GtkWidget *gtkWidget, const gchar* part,
const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style,
- const QString &pmKey = QString());
+ const QString &pmKey = QString()) Q_DECL_OVERRIDE;
void paintHline(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkStyle *style,
- int x1, int x2, int y, const QString &pmKey = QString());
+ int x1, int x2, int y, const QString &pmKey = QString()) Q_DECL_OVERRIDE;
void paintVline(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkStyle *style,
- int y1, int y2, int x, const QString &pmKey = QString());
+ int y1, int y2, int x, const QString &pmKey = QString()) Q_DECL_OVERRIDE;
void paintExpander(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state,
- GtkExpanderStyle expander_state, GtkStyle *style, const QString &pmKey = QString());
+ GtkExpanderStyle expander_state, GtkStyle *style, const QString &pmKey = QString()) Q_DECL_OVERRIDE;
void paintFocus(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkStyle *style,
- const QString &pmKey = QString());
+ const QString &pmKey = QString()) Q_DECL_OVERRIDE;
void paintResizeGrip(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
- GdkWindowEdge edge, GtkStyle *style, const QString &pmKey = QString());
+ GdkWindowEdge edge, GtkStyle *style, const QString &pmKey = QString()) Q_DECL_OVERRIDE;
void paintArrow(GtkWidget *gtkWidget, const gchar* part, const QRect &arrowrect, GtkArrowType arrow_type, GtkStateType state, GtkShadowType shadow,
- gboolean fill, GtkStyle *style, const QString &pmKey = QString());
+ gboolean fill, GtkStyle *style, const QString &pmKey = QString()) Q_DECL_OVERRIDE;
void paintHandle(GtkWidget *gtkWidget, const gchar* part, const QRect &rect,
- GtkStateType state, GtkShadowType shadow, GtkOrientation orientation, GtkStyle *style);
+ GtkStateType state, GtkShadowType shadow, GtkOrientation orientation, GtkStyle *style) Q_DECL_OVERRIDE;
void paintSlider(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
- GtkStyle *style, GtkOrientation orientation, const QString &pmKey = QString());
+ GtkStyle *style, GtkOrientation orientation, const QString &pmKey = QString()) Q_DECL_OVERRIDE;
void paintShadow(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
- GtkStyle *style, const QString &pmKey = QString());
- void paintFlatBox(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString & = QString());
+ GtkStyle *style, const QString &pmKey = QString()) Q_DECL_OVERRIDE;
+ void paintFlatBox(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString & = QString()) Q_DECL_OVERRIDE;
void paintExtention(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
- GtkPositionType gap_pos, GtkStyle *style);
- void paintOption(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail);
- void paintCheckbox(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail);
+ GtkPositionType gap_pos, GtkStyle *style) Q_DECL_OVERRIDE;
+ void paintOption(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail) Q_DECL_OVERRIDE;
+ void paintCheckbox(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail) Q_DECL_OVERRIDE;
private:
QPixmap renderTheme(uchar *bdata, uchar *wdata, const QRect &rect) const;
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp
index 61d1cd796e..beb52c01a7 100644
--- a/src/widgets/styles/qgtkstyle_p.cpp
+++ b/src/widgets/styles/qgtkstyle_p.cpp
@@ -57,6 +57,7 @@
#include <private/qgtk2painter_p.h>
#include <private/qapplication_p.h>
#include <private/qiconloader_p.h>
+#include <qpa/qplatformfontdatabase.h>
#include <QtWidgets/QMenu>
#include <QtWidgets/QStyle>
@@ -823,17 +824,8 @@ QFont QGtkStylePrivate::getThemeFont()
if (!family.isEmpty())
font.setFamily(family);
- int weight = pango_font_description_get_weight(gtk_font);
- if (weight >= PANGO_WEIGHT_HEAVY)
- font.setWeight(QFont::Black);
- else if (weight >= PANGO_WEIGHT_BOLD)
- font.setWeight(QFont::Bold);
- else if (weight >= PANGO_WEIGHT_SEMIBOLD)
- font.setWeight(QFont::DemiBold);
- else if (weight >= PANGO_WEIGHT_NORMAL)
- font.setWeight(QFont::Normal);
- else
- font.setWeight(QFont::Light);
+ const int weight = pango_font_description_get_weight(gtk_font);
+ font.setWeight(QPlatformFontDatabase::weightFromInteger(weight));
PangoStyle fontstyle = pango_font_description_get_style(gtk_font);
if (fontstyle == PANGO_STYLE_ITALIC)
diff --git a/src/widgets/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h
index d8a4fb093d..5aecf66152 100644
--- a/src/widgets/styles/qgtkstyle_p.h
+++ b/src/widgets/styles/qgtkstyle_p.h
@@ -69,48 +69,48 @@ public:
~QGtkStyle();
- QPalette standardPalette() const;
+ QPalette standardPalette() const Q_DECL_OVERRIDE;
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const;
+ QPainter *painter, const QWidget *widget) const Q_DECL_OVERRIDE;
void drawControl(ControlElement control, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const;
+ QPainter *painter, const QWidget *widget) const Q_DECL_OVERRIDE;
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget) const;
+ QPainter *painter, const QWidget *widget) const Q_DECL_OVERRIDE;
void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
- const QPixmap &pixmap) const;
+ const QPixmap &pixmap) const Q_DECL_OVERRIDE;
void drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,
- bool enabled, const QString& text, QPalette::ColorRole textRole) const;
+ bool enabled, const QString& text, QPalette::ColorRole textRole) const Q_DECL_OVERRIDE;
int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
int styleHint(StyleHint hint, const QStyleOption *option,
- const QWidget *widget, QStyleHintReturn *returnData) const;
+ const QWidget *widget, QStyleHintReturn *returnData) const Q_DECL_OVERRIDE;
QStyle::SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *w) const;
+ const QPoint &pt, const QWidget *w) const Q_DECL_OVERRIDE;
QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option,
- SubControl subControl, const QWidget *widget) const;
- QRect subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const;
- QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
+ SubControl subControl, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QRect subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const Q_DECL_OVERRIDE;
+ QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
QSize sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const;
+ const QSize &size, const QWidget *widget) const Q_DECL_OVERRIDE;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *option,
- const QWidget *widget) const;
+ const QWidget *widget) const Q_DECL_OVERRIDE;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
- const QStyleOption *opt) const;
+ const QStyleOption *opt) const Q_DECL_OVERRIDE;
- void polish(QWidget *widget);
- void polish(QApplication *app);
- void polish(QPalette &palette);
+ void polish(QWidget *widget) Q_DECL_OVERRIDE;
+ void polish(QApplication *app) Q_DECL_OVERRIDE;
+ void polish(QPalette &palette) Q_DECL_OVERRIDE;
- void unpolish(QWidget *widget);
- void unpolish(QApplication *app);
+ void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
+ void unpolish(QApplication *app) Q_DECL_OVERRIDE;
static bool getGConfBool(const QString &key, bool fallback = 0);
static QString getGConfString(const QString &key, const QString &fallback = QString());
diff --git a/src/widgets/styles/qgtkstyle_p_p.h b/src/widgets/styles/qgtkstyle_p_p.h
index 0076f14ba3..02b375bc54 100644
--- a/src/widgets/styles/qgtkstyle_p_p.h
+++ b/src/widgets/styles/qgtkstyle_p_p.h
@@ -228,7 +228,7 @@ public:
{}
private:
QGtkStylePrivate* stylePrivate;
- bool eventFilter(QObject *obj, QEvent *e);
+ bool eventFilter(QObject *obj, QEvent *e) Q_DECL_OVERRIDE;
};
typedef enum {
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index c166b1b26e..6f573ab809 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -2798,6 +2798,19 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_Menu_SubMenuPopupDelay:
ret = 100;
break;
+ case SH_Menu_SubMenuUniDirection:
+ ret = true;
+ break;
+ case SH_Menu_SubMenuSloppySelectOtherActions:
+ ret = false;
+ break;
+ case SH_Menu_SubMenuResetWhenReenteringParent:
+ ret = true;
+ break;
+ case SH_Menu_SubMenuDontStartSloppyOnLeave:
+ ret = true;
+ break;
+
case SH_ScrollBar_LeftClickAbsolutePosition: {
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
bool result = [defaults boolForKey:@"AppleScrollerPagingBehavior"];
@@ -3044,8 +3057,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
break;
case SH_ScrollBar_Transient:
if ((qobject_cast<const QScrollBar *>(w) && w->parent() &&
- qobject_cast<QAbstractScrollArea*>(w->parent()->parent())) ||
- (opt && QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ScrollBar))) {
+ qobject_cast<QAbstractScrollArea*>(w->parent()->parent()))
+#ifndef QT_NO_ACCESSIBILITY
+ || (opt && QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ScrollBar))
+#endif
+ ) {
ret = [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay;
}
break;
@@ -3687,6 +3703,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
QStyleOptionToolButton myTb = *tb;
myTb.state &= ~State_AutoRaise;
+#ifndef QT_NO_ACCESSIBILITY
if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
QRect cr = tb->rect;
int shiftX = 0;
@@ -3776,6 +3793,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} else {
QCommonStyle::drawControl(ce, &myTb, p, w);
}
+#else
+ Q_UNUSED(tb)
+#endif
}
break;
case CE_ToolBoxTabShape:
@@ -5914,7 +5934,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
case CC_ToolButton:
if (const QStyleOptionToolButton *tb
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
-
+#ifndef QT_NO_ACCESSIBILITY
if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
if (tb->subControls & SC_ToolButtonMenu) {
QStyleOption arrowOpt(0);
@@ -6040,6 +6060,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
label.rect = buttonRect.adjusted(fw, fw, -fw, -fw);
proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
}
+#endif
}
break;
case CC_Dial:
@@ -6518,7 +6539,11 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
break;
case CC_ToolButton:
ret = QCommonStyle::subControlRect(cc, opt, sc, widget);
- if (sc == SC_ToolButtonMenu && !QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
+ if (sc == SC_ToolButtonMenu
+#ifndef QT_NO_ACCESSIBILITY
+ && !QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)
+#endif
+ ) {
ret.adjust(-1, 0, 0, 0);
}
break;
diff --git a/src/widgets/styles/qproxystyle.h b/src/widgets/styles/qproxystyle.h
index 24779925a5..f2ddf6bda1 100644
--- a/src/widgets/styles/qproxystyle.h
+++ b/src/widgets/styles/qproxystyle.h
@@ -54,40 +54,40 @@ public:
QStyle *baseStyle() const;
void setBaseStyle(QStyle *style);
- void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
- void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
- void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const;
+ void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled,
- const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
- virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const;
+ const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const Q_DECL_OVERRIDE;
+ virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
- QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const;
+ QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const Q_DECL_OVERRIDE;
- QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const;
- QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const;
- QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const;
- QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
+ QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const Q_DECL_OVERRIDE;
+ QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
- SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = 0) const;
- int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const;
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
+ SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const Q_DECL_OVERRIDE;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
- Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const;
+ Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
- QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0, const QWidget *widget = 0) const;
- QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const;
- QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const;
- QPalette standardPalette() const;
+ QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const Q_DECL_OVERRIDE;
+ QPalette standardPalette() const Q_DECL_OVERRIDE;
- void polish(QWidget *widget);
- void polish(QPalette &pal);
- void polish(QApplication *app);
+ void polish(QWidget *widget) Q_DECL_OVERRIDE;
+ void polish(QPalette &pal) Q_DECL_OVERRIDE;
+ void polish(QApplication *app) Q_DECL_OVERRIDE;
- void unpolish(QWidget *widget);
- void unpolish(QApplication *app);
+ void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
+ void unpolish(QApplication *app) Q_DECL_OVERRIDE;
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QProxyStyle)
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 6072842fc9..8df68d25a5 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -1472,6 +1472,11 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PM_TreeViewIndentation The indentation of items in a tree view.
This enum value has been introduced in Qt 5.4.
+ \value PM_HeaderDefaultSectionSizeHorizontal The default size of sections
+ in a horizontal header. This enum value has been introduced in Qt 5.5.
+ \value PM_HeaderDefaultSectionSizeVertical The default size of sections
+ in a vertical header. This enum value has been introduced in Qt 5.5.
+
\value PM_CustomBase Base value for custom pixel metrics. Custom
values must be greater than this value.
@@ -1708,6 +1713,32 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
other items of the menu. This is supported on most modern
desktop platforms.
+ \value SH_Menu_SubMenuUniDirection Since Qt 5.5. If the cursor has
+ to move towards the submenu (like it is on OS X), or if the
+ cursor can move in any direction as long as it reaches the
+ submenu before the sloppy timeout.
+
+ \value SH_Menu_SubMenuUniDirectionFailCount Since Qt 5.5. When
+ SH_Menu_SubMenuUniDirection is defined this enum defines the
+ number of failed mouse moves before the sloppy submenu is
+ discarded. This can be used to control the "strictness" of the
+ uni direction algorithm.
+
+ \value SH_Menu_SubMenuSloppySelectOtherActions Since Qt 5.5. Should
+ other action items be selected when the mouse moves towards a
+ sloppy submenu.
+
+ \value SH_Menu_SubMenuSloppyCloseTimeout Since Qt 5.5. The timeout
+ used to close sloppy submenus.
+
+ \value SH_Menu_SubMenuResetWhenReenteringParent Since Qt 5.5. When
+ entering parent from child submenu, should the sloppy state be
+ reset, effectively closing the child and making the current
+ submenu active.
+
+ \value SH_Menu_SubMenuDontStartSloppyOnLeave Since Qt 5.5. Do not
+ start sloppy timers when the mouse leaves a sub-menu.
+
\value SH_ScrollView_FrameOnlyAroundContents Whether scrollviews
draw their frame only around contents (like Motif), or around
contents, scroll bars and corner widgets (like Windows).
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index 43a49e3746..225146c5bb 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -550,6 +550,9 @@ public:
PM_SubMenuOverlap,
PM_TreeViewIndentation,
+ PM_HeaderDefaultSectionSizeHorizontal,
+ PM_HeaderDefaultSectionSizeVertical,
+
// do not add any values below/greater than this
PM_CustomBase = 0xf0000000
};
@@ -703,6 +706,12 @@ public:
SH_ComboBox_UseNativePopup,
SH_LineEdit_PasswordMaskDelay,
SH_TabBar_ChangeCurrentDelay,
+ SH_Menu_SubMenuUniDirection,
+ SH_Menu_SubMenuUniDirectionFailCount,
+ SH_Menu_SubMenuSloppySelectOtherActions,
+ SH_Menu_SubMenuSloppyCloseTimeout,
+ SH_Menu_SubMenuResetWhenReenteringParent,
+ SH_Menu_SubMenuDontStartSloppyOnLeave,
// Add new style hint values here
SH_CustomBase = 0xf0000000
diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index a9f9325826..7bfdb34e5e 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -63,7 +63,7 @@ public:
QObject *target() const;
- int duration() const;
+ int duration() const Q_DECL_OVERRIDE;
void setDuration(int duration);
int delay() const;
@@ -89,7 +89,7 @@ public Q_SLOTS:
protected:
virtual bool isUpdateNeeded() const;
- virtual void updateCurrentTime(int time);
+ virtual void updateCurrentTime(int time) Q_DECL_OVERRIDE;
private:
int _delay;
@@ -113,7 +113,7 @@ public:
void setSpeed(int speed);
protected:
- bool isUpdateNeeded() const;
+ bool isUpdateNeeded() const Q_DECL_OVERRIDE;
private:
int _speed;
@@ -136,7 +136,7 @@ public:
qreal currentValue() const;
protected:
- bool isUpdateNeeded() const;
+ bool isUpdateNeeded() const Q_DECL_OVERRIDE;
private:
qreal _start;
@@ -162,7 +162,7 @@ public:
QImage currentImage() const;
protected:
- virtual void updateCurrentTime(int time);
+ virtual void updateCurrentTime(int time) Q_DECL_OVERRIDE;
private:
Type _type;
@@ -186,7 +186,7 @@ public:
void setActive(bool active);
private slots:
- void updateCurrentTime(int time);
+ void updateCurrentTime(int time) Q_DECL_OVERRIDE;
private:
Mode _mode;
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 1d98a56063..027e36387a 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1626,6 +1626,9 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
\brief the progress bar's orientation (horizontal or vertical);
the default orentation is Qt::Horizontal
+ \deprecated
+ Use the QStyle::State_Horizontal flag instead (in the the QStyleOption::state member).
+
\sa QProgressBar::orientation
*/
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index a475f485df..4b55cf3faf 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -317,7 +317,7 @@ public:
QString text;
Qt::Alignment textAlignment;
bool textVisible;
- Qt::Orientation orientation;
+ Qt::Orientation orientation; // ### Qt 6: remove
bool invertedAppearance;
bool bottomToTop;
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index e9f20de842..21464ef090 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -1413,7 +1413,7 @@ class QStyleSheetStyleSelector : public StyleSelector
public:
QStyleSheetStyleSelector() { }
- QStringList nodeNames(NodePtr node) const
+ QStringList nodeNames(NodePtr node) const Q_DECL_OVERRIDE
{
if (isNullNode(node))
return QStringList();
@@ -1429,7 +1429,7 @@ public:
} while (metaObject != 0);
return result;
}
- QString attribute(NodePtr node, const QString& name) const
+ QString attribute(NodePtr node, const QString& name) const Q_DECL_OVERRIDE
{
if (isNullNode(node))
return QString();
@@ -1466,7 +1466,7 @@ public:
cache[name] = valueStr;
return valueStr;
}
- bool nodeNameEquals(NodePtr node, const QString& nodeName) const
+ bool nodeNameEquals(NodePtr node, const QString& nodeName) const Q_DECL_OVERRIDE
{
if (isNullNode(node))
return false;
@@ -1489,19 +1489,19 @@ public:
} while (metaObject != 0);
return false;
}
- bool hasAttributes(NodePtr) const
+ bool hasAttributes(NodePtr) const Q_DECL_OVERRIDE
{ return true; }
- QStringList nodeIds(NodePtr node) const
+ QStringList nodeIds(NodePtr node) const Q_DECL_OVERRIDE
{ return isNullNode(node) ? QStringList() : QStringList(OBJECT_PTR(node)->objectName()); }
- bool isNullNode(NodePtr node) const
+ bool isNullNode(NodePtr node) const Q_DECL_OVERRIDE
{ return node.ptr == 0; }
- NodePtr parentNode(NodePtr node) const
+ NodePtr parentNode(NodePtr node) const Q_DECL_OVERRIDE
{ NodePtr n; n.ptr = isNullNode(node) ? 0 : parentObject(OBJECT_PTR(node)); return n; }
- NodePtr previousSiblingNode(NodePtr) const
+ NodePtr previousSiblingNode(NodePtr) const Q_DECL_OVERRIDE
{ NodePtr n; n.ptr = 0; return n; }
- NodePtr duplicateNode(NodePtr node) const
+ NodePtr duplicateNode(NodePtr node) const Q_DECL_OVERRIDE
{ return node; }
- void freeNode(NodePtr) const
+ void freeNode(NodePtr) const Q_DECL_OVERRIDE
{ }
private:
diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h
index c4e81787b5..212be5f530 100644
--- a/src/widgets/styles/qstylesheetstyle_p.h
+++ b/src/widgets/styles/qstylesheetstyle_p.h
@@ -74,48 +74,48 @@ public:
~QStyleSheetStyle();
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
- void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
void drawItemText(QPainter *painter, const QRect& rect, int alignment, const QPalette &pal,
- bool enabled, const QString& text, QPalette::ColorRole textRole = QPalette::NoRole) const;
+ bool enabled, const QString& text, QPalette::ColorRole textRole = QPalette::NoRole) const Q_DECL_OVERRIDE;
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
- const QStyleOption *option) const;
+ const QStyleOption *option) const Q_DECL_OVERRIDE;
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *w = 0) const;
- QRect itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pixmap) const;
+ const QPoint &pt, const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ QRect itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
QRect itemTextRect(const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled,
- const QString &text) const;
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
- void polish(QWidget *widget);
- void polish(QApplication *app);
- void polish(QPalette &pal);
+ const QString &text) const Q_DECL_OVERRIDE;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ void polish(QWidget *widget) Q_DECL_OVERRIDE;
+ void polish(QApplication *app) Q_DECL_OVERRIDE;
+ void polish(QPalette &pal) Q_DECL_OVERRIDE;
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &contentsSize, const QWidget *widget = 0) const;
- QPalette standardPalette() const;
+ const QSize &contentsSize, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ QPalette standardPalette() const Q_DECL_OVERRIDE;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt = 0,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option = 0,
- const QWidget *w = 0 ) const;
+ const QWidget *w = 0 ) const Q_DECL_OVERRIDE;
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
Qt::Orientation orientation, const QStyleOption *option = 0,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0,
- QStyleHintReturn *shret = 0) const;
- QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const;
+ QStyleHintReturn *shret = 0) const Q_DECL_OVERRIDE;
+ QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc,
- const QWidget *w = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
// These functions are called from QApplication/QWidget. Be careful.
QStyle *baseStyle() const;
void repolish(QWidget *widget);
void repolish(QApplication *app);
- void unpolish(QWidget *widget);
- void unpolish(QApplication *app);
+ void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
+ void unpolish(QApplication *app) Q_DECL_OVERRIDE;
QStyle *base;
void ref() { ++refcount; }
@@ -128,7 +128,7 @@ public:
bool styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal);
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
private:
int refcount;
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index a10bdc67e1..9deeb725f9 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -586,6 +586,17 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
break;
}
#endif // Q_OS_WIN && !Q_OS_WINRT
+ case SH_Menu_SubMenuSloppyCloseTimeout:
+ case SH_Menu_SubMenuPopupDelay: {
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+ DWORD delay;
+ if (SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0))
+ ret = delay;
+ else
+#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
+ ret = 400;
+ break;
+ }
#ifndef QT_NO_RUBBERBAND
case SH_RubberBand_Mask:
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index b3c6f831d8..9b3efc6f1f 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -61,37 +61,37 @@ public:
QWindowsStyle();
~QWindowsStyle();
- void polish(QApplication*);
- void unpolish(QApplication*);
+ void polish(QApplication*) Q_DECL_OVERRIDE;
+ void unpolish(QApplication*) Q_DECL_OVERRIDE;
- void polish(QWidget*);
- void unpolish(QWidget*);
+ void polish(QWidget*) Q_DECL_OVERRIDE;
+ void unpolish(QWidget*) Q_DECL_OVERRIDE;
- void polish(QPalette &);
+ void polish(QPalette &) Q_DECL_OVERRIDE;
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
- QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = 0) const Q_DECL_OVERRIDE;
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &contentsSize, const QWidget *widget = 0) const;
+ const QSize &contentsSize, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
- int pixelMetric(PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const;
+ int pixelMetric(PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
- QStyleHintReturn *returnData = 0) const;
+ QStyleHintReturn *returnData = 0) const Q_DECL_OVERRIDE;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
- const QWidget *widget = 0) const;
+ const QWidget *widget = 0) const Q_DECL_OVERRIDE;
protected:
- bool eventFilter(QObject *o, QEvent *e);
+ bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
QWindowsStyle(QWindowsStylePrivate &dd);
private:
diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h
index 3bee280719..c252284b85 100644
--- a/src/widgets/util/qcompleter.h
+++ b/src/widgets/util/qcompleter.h
@@ -136,8 +136,8 @@ public:
virtual QStringList splitPath(const QString &path) const;
protected:
- bool eventFilter(QObject *o, QEvent *e);
- bool event(QEvent *);
+ bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *) Q_DECL_OVERRIDE;
Q_SIGNALS:
void activated(const QString &text);
diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h
index 50f7cdacdb..b4ead17cab 100644
--- a/src/widgets/util/qcompleter_p.h
+++ b/src/widgets/util/qcompleter_p.h
@@ -167,7 +167,7 @@ class QSortedModelEngine : public QCompletionEngine
{
public:
QSortedModelEngine(QCompleterPrivate *c) : QCompletionEngine(c) { }
- QMatchData filter(const QString&, const QModelIndex&, int);
+ QMatchData filter(const QString&, const QModelIndex&, int) Q_DECL_OVERRIDE;
QIndexMapper indexHint(QString, const QModelIndex&, Qt::SortOrder);
Qt::SortOrder sortOrder(const QModelIndex&) const;
};
@@ -177,8 +177,8 @@ class QUnsortedModelEngine : public QCompletionEngine
public:
QUnsortedModelEngine(QCompleterPrivate *c) : QCompletionEngine(c) { }
- void filterOnDemand(int);
- QMatchData filter(const QString&, const QModelIndex&, int);
+ void filterOnDemand(int) Q_DECL_OVERRIDE;
+ QMatchData filter(const QString&, const QModelIndex&, int) Q_DECL_OVERRIDE;
private:
int buildIndices(const QString& str, const QModelIndex& parent, int n,
const QIndexMapper& iv, QMatchData* m);
@@ -189,7 +189,7 @@ class QCompleterItemDelegate : public QItemDelegate
public:
QCompleterItemDelegate(QAbstractItemView *view)
: QItemDelegate(view), view(view) { }
- void paint(QPainter *p, const QStyleOptionViewItem& opt, const QModelIndex& idx) const {
+ void paint(QPainter *p, const QStyleOptionViewItem& opt, const QModelIndex& idx) const Q_DECL_OVERRIDE {
QStyleOptionViewItem optCopy = opt;
optCopy.showDecorationSelected = true;
if (view->currentIndex() == idx)
@@ -218,16 +218,16 @@ public:
bool setCurrentRow(int row);
QModelIndex currentIndex(bool) const;
- QModelIndex index(int row, int column, const QModelIndex & = QModelIndex()) const;
- int rowCount(const QModelIndex &index = QModelIndex()) const;
- int columnCount(const QModelIndex &index = QModelIndex()) const;
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex & = QModelIndex()) const { return QModelIndex(); }
- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+ QModelIndex index(int row, int column, const QModelIndex & = QModelIndex()) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &index = QModelIndex()) const Q_DECL_OVERRIDE;
+ int columnCount(const QModelIndex &index = QModelIndex()) const Q_DECL_OVERRIDE;
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ QModelIndex parent(const QModelIndex & = QModelIndex()) const Q_DECL_OVERRIDE { return QModelIndex(); }
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- void setSourceModel(QAbstractItemModel *sourceModel);
- QModelIndex mapToSource(const QModelIndex& proxyIndex) const;
- QModelIndex mapFromSource(const QModelIndex& sourceIndex) const;
+ void setSourceModel(QAbstractItemModel *sourceModel) Q_DECL_OVERRIDE;
+ QModelIndex mapToSource(const QModelIndex& proxyIndex) const Q_DECL_OVERRIDE;
+ QModelIndex mapFromSource(const QModelIndex& sourceIndex) const Q_DECL_OVERRIDE;
QCompleterPrivate *c;
QScopedPointer<QCompletionEngine> engine;
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 42ead263f8..f7abd008b7 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -248,7 +248,7 @@ public:
}
protected:
- void timerEvent(QTimerEvent *e)
+ void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE
{
if (e->timerId() == pressDelayTimer) {
if (pressDelayEvent && mouseTarget) {
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index 8cd7b97e30..5235511b6d 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -190,7 +190,7 @@ public:
: d(_d), ignoreUpdate(false), skip(0)
{ }
- int duration() const
+ int duration() const Q_DECL_OVERRIDE
{
return -1;
}
@@ -206,7 +206,7 @@ public:
}
protected:
- void updateCurrentTime(int /*currentTime*/)
+ void updateCurrentTime(int /*currentTime*/) Q_DECL_OVERRIDE
{
if (!ignoreUpdate) {
if (++skip >= d->frameRateSkip()) {
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 7d04cab05e..30ef7e82e5 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -718,8 +718,8 @@ void QSystemTrayIconPrivate::updateToolTip_sys_qpa()
qpa_sys->updateToolTip(toolTip);
}
-void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &message,
- const QString &title,
+void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &title,
+ const QString &message,
QSystemTrayIcon::MessageIcon icon,
int msecs)
{
@@ -737,7 +737,7 @@ void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &message,
default:
break;
}
- qpa_sys->showMessage(message, title, notificationIcon,
+ qpa_sys->showMessage(title, message, notificationIcon,
static_cast<QPlatformSystemTrayIcon::MessageIcon>(icon), msecs);
}
diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h
index 4d92d811ed..29a9f849b4 100644
--- a/src/widgets/util/qsystemtrayicon.h
+++ b/src/widgets/util/qsystemtrayicon.h
@@ -102,7 +102,7 @@ Q_SIGNALS:
void messageClicked();
protected:
- bool event(QEvent *event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QSystemTrayIcon)
diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
index 0dda689c51..fdf91d4c43 100644
--- a/src/widgets/util/qsystemtrayicon_p.h
+++ b/src/widgets/util/qsystemtrayicon_p.h
@@ -77,7 +77,7 @@ public:
void updateToolTip_sys();
void updateMenu_sys();
QRect geometry_sys() const;
- void showMessage_sys(const QString &msg, const QString &title, QSystemTrayIcon::MessageIcon icon, int secs);
+ void showMessage_sys(const QString &title, const QString &msg, QSystemTrayIcon::MessageIcon icon, int secs);
static bool isSystemTrayAvailable_sys();
static bool supportsMessages_sys();
@@ -98,7 +98,7 @@ private:
void updateToolTip_sys_qpa();
void updateMenu_sys_qpa();
QRect geometry_sys_qpa() const;
- void showMessage_sys_qpa(const QString &msg, const QString &title, QSystemTrayIcon::MessageIcon icon, int secs);
+ void showMessage_sys_qpa(const QString &title, const QString &msg, QSystemTrayIcon::MessageIcon icon, int secs);
};
class QBalloonTip : public QWidget
@@ -119,10 +119,10 @@ private:
void balloon(const QPoint&, int, bool);
protected:
- void paintEvent(QPaintEvent *);
- void resizeEvent(QResizeEvent *);
- void mousePressEvent(QMouseEvent *e);
- void timerEvent(QTimerEvent *e);
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
private:
QSystemTrayIcon *trayIcon;
diff --git a/src/widgets/util/qsystemtrayicon_qpa.cpp b/src/widgets/util/qsystemtrayicon_qpa.cpp
index 08764b405d..7dc848d3ab 100644
--- a/src/widgets/util/qsystemtrayicon_qpa.cpp
+++ b/src/widgets/util/qsystemtrayicon_qpa.cpp
@@ -111,13 +111,11 @@ bool QSystemTrayIconPrivate::supportsMessages_sys()
return false;
}
-void QSystemTrayIconPrivate::showMessage_sys(const QString &message,
- const QString &title,
- QSystemTrayIcon::MessageIcon icon,
- int msecs)
+void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message,
+ QSystemTrayIcon::MessageIcon icon, int msecs)
{
if (qpa_sys)
- showMessage_sys_qpa(message, title, icon, msecs);
+ showMessage_sys_qpa(title, message, icon, msecs);
}
QT_END_NAMESPACE
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index 09f2d6266c..ba80734876 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -74,12 +74,12 @@ public:
QRect globalGeometry() const;
protected:
- virtual void mousePressEvent(QMouseEvent *ev);
- virtual void mouseDoubleClickEvent(QMouseEvent *ev);
- virtual bool event(QEvent *);
- virtual void paintEvent(QPaintEvent *);
- virtual void resizeEvent(QResizeEvent *);
- virtual void moveEvent(QMoveEvent *);
+ virtual void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ virtual void mouseDoubleClickEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ virtual bool event(QEvent *) Q_DECL_OVERRIDE;
+ virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ virtual void moveEvent(QMoveEvent *) Q_DECL_OVERRIDE;
private slots:
void systemTrayWindowChanged(QScreen *screen);
@@ -107,13 +107,29 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn)
// If we have a visual that has an alpha channel, we can paint this widget with a transparent
// background and it will work.
// However, if there's no alpha channel visual, in order for transparent tray icons to work,
- // we do not have a transparent background on the widget, but call xcb_clear_region before
- // painting the icon
+ // we do not have a transparent background on the widget, but set the BackPixmap property of our
+ // window to ParentRelative (so that it inherits the background of its X11 parent window), call
+ // xcb_clear_region before painting (so that the inherited background is visible) and then grab
+ // the just-drawn background from the X11 server.
bool hasAlphaChannel = false;
QMetaObject::invokeMethod(QGuiApplication::platformNativeInterface(),
"systrayVisualHasAlphaChannel", Qt::DirectConnection,
Q_RETURN_ARG(bool, hasAlphaChannel));
setAttribute(Qt::WA_TranslucentBackground, hasAlphaChannel);
+ if (!hasAlphaChannel) {
+ createWinId();
+ QMetaObject::invokeMethod(QGuiApplication::platformNativeInterface(),
+ "setParentRelativeBackPixmap", Qt::DirectConnection,
+ Q_ARG(const QWindow *, windowHandle())
+ );
+
+ // XXX: This is actually required, but breaks things ("QWidget::paintEngine: Should no
+ // longer be called"). Why is this needed? When the widget is drawn, we use tricks to grab
+ // the tray icon's background from the server. If the tray icon isn't visible (because
+ // another window is on top of it), the trick fails and instead uses the content of that
+ // other window as the background.
+ // setAttribute(Qt::WA_PaintOnScreen);
+ }
addToTray();
}
@@ -214,11 +230,18 @@ void QSystemTrayIconSys::paintEvent(QPaintEvent *)
painter.setCompositionMode(QPainter::CompositionMode_Source);
painter.fillRect(rect, Qt::transparent);
} else {
+ // Without Qt::WA_TranslucentBackground, we use a ParentRelative BackPixmap and jump through
+ // some hops to draw this background below our icon. This clears the whole tray icon to its
+ // background color and thus causes flickering (you can see that the icon is being
+ // repainted). However, we can't really do much about this.
QMetaObject::invokeMethod(QGuiApplication::platformNativeInterface(),
"clearRegion", Qt::DirectConnection,
Q_ARG(const QWindow *, windowHandle()),
Q_ARG(const QRect&, rect)
);
+ painter.drawPixmap(QPoint(0, 0),
+ QGuiApplication::primaryScreen()->grabWindow(winId(),
+ 0, 0, rect.size().width(), rect.size().height()));
}
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
q->icon().paint(&painter, rect);
@@ -341,11 +364,11 @@ bool QSystemTrayIconPrivate::supportsMessages_sys()
return true;
}
-void QSystemTrayIconPrivate::showMessage_sys(const QString &message, const QString &title,
+void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message,
QSystemTrayIcon::MessageIcon icon, int msecs)
{
if (qpa_sys) {
- showMessage_sys_qpa(message, title, icon, msecs);
+ showMessage_sys_qpa(title, message, icon, msecs);
return;
}
if (!sys)
diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp
index 970541cf73..4ead2910a2 100644
--- a/src/widgets/util/qundoview.cpp
+++ b/src/widgets/util/qundoview.cpp
@@ -53,11 +53,11 @@ public:
QUndoStack *stack() const;
virtual QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ virtual QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
QModelIndex selectedIndex() const;
QItemSelectionModel *selectionModel() const;
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index 7fa50f4c0b..c80e2e9d5d 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -122,16 +122,16 @@ protected:
virtual void checkStateSet();
virtual void nextCheckState();
- bool event(QEvent *e);
- void keyPressEvent(QKeyEvent *e);
- void keyReleaseEvent(QKeyEvent *e);
- void mousePressEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
- void mouseMoveEvent(QMouseEvent *e);
- void focusInEvent(QFocusEvent *e);
- void focusOutEvent(QFocusEvent *e);
- void changeEvent(QEvent *e);
- void timerEvent(QTimerEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
protected:
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 4cafeafcec..bcf0bbe1fc 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -923,7 +923,7 @@ QWidgetList QAbstractScrollArea::scrollBarWidgets(Qt::Alignment alignment)
they should not call this function.
By default all margins are zero.
-
+ \sa viewportMargins()
*/
void QAbstractScrollArea::setViewportMargins(int left, int top, int right, int bottom)
{
@@ -943,7 +943,7 @@ void QAbstractScrollArea::setViewportMargins(int left, int top, int right, int b
area.
By default all margins are zero.
-
+ \sa viewportMargins()
*/
void QAbstractScrollArea::setViewportMargins(const QMargins &margins)
{
@@ -951,6 +951,19 @@ void QAbstractScrollArea::setViewportMargins(const QMargins &margins)
margins.right(), margins.bottom());
}
+/*!
+ \since 5.5
+ Returns the margins around the scrolling area.
+ By default all the margins are zero.
+
+ \sa setViewportMargins()
+*/
+QMargins QAbstractScrollArea::viewportMargins() const
+{
+ Q_D(const QAbstractScrollArea);
+ return QMargins(d->left, d->top, d->right, d->bottom);
+}
+
/*! \internal */
bool QAbstractScrollArea::eventFilter(QObject *o, QEvent *e)
{
diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h
index a3f6c3e2d4..6a9a86b07f 100644
--- a/src/widgets/widgets/qabstractscrollarea.h
+++ b/src/widgets/widgets/qabstractscrollarea.h
@@ -84,9 +84,9 @@ public:
void setViewport(QWidget *widget);
QSize maximumViewportSize() const;
- QSize minimumSizeHint() const;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
virtual void setupViewport(QWidget *viewport);
@@ -97,31 +97,32 @@ protected:
QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget *parent = 0);
void setViewportMargins(int left, int top, int right, int bottom);
void setViewportMargins(const QMargins &margins);
+ QMargins viewportMargins() const;
- bool eventFilter(QObject *, QEvent *);
- bool event(QEvent *);
+ bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) Q_DECL_OVERRIDE;
virtual bool viewportEvent(QEvent *);
- void resizeEvent(QResizeEvent *);
- void paintEvent(QPaintEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
- void mouseDoubleClickEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *);
+ void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
#endif
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *);
+ void contextMenuEvent(QContextMenuEvent *) Q_DECL_OVERRIDE;
#endif
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *);
- void dragMoveEvent(QDragMoveEvent *);
- void dragLeaveEvent(QDragLeaveEvent *);
- void dropEvent(QDropEvent *);
+ void dragEnterEvent(QDragEnterEvent *) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent *) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *) Q_DECL_OVERRIDE;
#endif
- void keyPressEvent(QKeyEvent *);
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
virtual void scrollContentsBy(int dx, int dy);
diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h
index aaf93a3352..a70b4df5eb 100644
--- a/src/widgets/widgets/qabstractscrollarea_p.h
+++ b/src/widgets/widgets/qabstractscrollarea_p.h
@@ -114,7 +114,7 @@ class QAbstractScrollAreaFilter : public QObject
public:
QAbstractScrollAreaFilter(QAbstractScrollAreaPrivate *p) : d(p)
{ setObjectName(QLatin1String("qt_abstractscrollarea_filter")); }
- bool eventFilter(QObject *o, QEvent *e)
+ bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE
{ return (o == d->viewport ? d->viewportEvent(e) : false); }
private:
QAbstractScrollAreaPrivate *d;
diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h
index 99312a0ef7..3b107d5502 100644
--- a/src/widgets/widgets/qabstractslider.h
+++ b/src/widgets/widgets/qabstractslider.h
@@ -122,7 +122,7 @@ Q_SIGNALS:
void actionTriggered(int action);
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
void setRepeatAction(SliderAction action, int thresholdTime = 500, int repeatTime = 50);
SliderAction repeatAction() const;
@@ -135,12 +135,12 @@ protected:
};
virtual void sliderChange(SliderChange change);
- void keyPressEvent(QKeyEvent *ev);
- void timerEvent(QTimerEvent *);
+ void keyPressEvent(QKeyEvent *ev) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *e);
+ void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
#endif
- void changeEvent(QEvent *e);
+ void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
protected:
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index fa3dbc1f32..0071143958 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -104,11 +104,11 @@ class QCalendarDayValidator : public QCalendarDateSectionValidator
public:
QCalendarDayValidator();
- virtual Section handleKey(int key);
- virtual QDate applyToDate(const QDate &date) const;
- virtual void setDate(const QDate &date);
- virtual QString text() const;
- virtual QString text(const QDate &date, int repeat) const;
+ virtual Section handleKey(int key) Q_DECL_OVERRIDE;
+ virtual QDate applyToDate(const QDate &date) const Q_DECL_OVERRIDE;
+ virtual void setDate(const QDate &date) Q_DECL_OVERRIDE;
+ virtual QString text() const Q_DECL_OVERRIDE;
+ virtual QString text(const QDate &date, int repeat) const Q_DECL_OVERRIDE;
private:
int m_pos;
int m_day;
@@ -220,11 +220,11 @@ class QCalendarMonthValidator : public QCalendarDateSectionValidator
public:
QCalendarMonthValidator();
- virtual Section handleKey(int key);
- virtual QDate applyToDate(const QDate &date) const;
- virtual void setDate(const QDate &date);
- virtual QString text() const;
- virtual QString text(const QDate &date, int repeat) const;
+ virtual Section handleKey(int key) Q_DECL_OVERRIDE;
+ virtual QDate applyToDate(const QDate &date) const Q_DECL_OVERRIDE;
+ virtual void setDate(const QDate &date) Q_DECL_OVERRIDE;
+ virtual QString text() const Q_DECL_OVERRIDE;
+ virtual QString text(const QDate &date, int repeat) const Q_DECL_OVERRIDE;
private:
int m_pos;
int m_month;
@@ -337,11 +337,11 @@ class QCalendarYearValidator : public QCalendarDateSectionValidator
public:
QCalendarYearValidator();
- virtual Section handleKey(int key);
- virtual QDate applyToDate(const QDate &date) const;
- virtual void setDate(const QDate &date);
- virtual QString text() const;
- virtual QString text(const QDate &date, int repeat) const;
+ virtual Section handleKey(int key) Q_DECL_OVERRIDE;
+ virtual QDate applyToDate(const QDate &date) const Q_DECL_OVERRIDE;
+ virtual void setDate(const QDate &date) Q_DECL_OVERRIDE;
+ virtual QString text() const Q_DECL_OVERRIDE;
+ virtual QString text(const QDate &date, int repeat) const Q_DECL_OVERRIDE;
private:
int pow10(int n);
int m_pos;
@@ -683,8 +683,8 @@ public:
QDate date() const;
void setDate(const QDate &date);
- bool eventFilter(QObject *o, QEvent *e);
- void timerEvent(QTimerEvent *e);
+ bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
signals:
void dateChanged(const QDate &date);
@@ -853,32 +853,32 @@ class QCalendarModel : public QAbstractTableModel
public:
QCalendarModel(QObject *parent = 0);
- int rowCount(const QModelIndex &) const
+ int rowCount(const QModelIndex &) const Q_DECL_OVERRIDE
{ return RowCount + m_firstRow; }
- int columnCount(const QModelIndex &) const
+ int columnCount(const QModelIndex &) const Q_DECL_OVERRIDE
{ return ColumnCount + m_firstColumn; }
- QVariant data(const QModelIndex &index, int role) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
+ QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
- bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex())
+ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE
{
beginInsertRows(parent, row, row + count - 1);
endInsertRows();
return true;
}
- bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex())
+ bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE
{
beginInsertColumns(parent, column, column + count - 1);
endInsertColumns();
return true;
}
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex())
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE
{
beginRemoveRows(parent, row, row + count - 1);
endRemoveRows();
return true;
}
- bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex())
+ bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE
{
beginRemoveColumns(parent, column, column + count - 1);
endRemoveColumns();
@@ -939,7 +939,7 @@ public:
void internalUpdate() { updateGeometries(); }
void setReadOnly(bool enable);
- virtual void keyboardSearch(const QString & search) { Q_UNUSED(search) }
+ virtual void keyboardSearch(const QString & search) Q_DECL_OVERRIDE { Q_UNUSED(search) }
signals:
void showDate(const QDate &date);
@@ -947,16 +947,16 @@ signals:
void clicked(const QDate &date);
void editingFinished();
protected:
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
- void mouseDoubleClickEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *event);
+ void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
#endif
- void keyPressEvent(QKeyEvent *event);
- bool event(QEvent *event);
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
QDate handleMouseEvent(QMouseEvent *event);
public:
@@ -1555,7 +1555,7 @@ public:
: QItemDelegate(parent), calendarWidgetPrivate(w)
{ }
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
void paintCell(QPainter *painter, const QRect &rect, const QDate &date) const;
private:
@@ -1571,7 +1571,7 @@ public:
: QToolButton(parent)
{ }
protected:
- void paintEvent(QPaintEvent *e)
+ void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE
{
Q_UNUSED(e)
@@ -1599,7 +1599,7 @@ class QPrevNextCalButton : public QToolButton
public:
QPrevNextCalButton(QWidget *parent) : QToolButton(parent) {}
protected:
- void paintEvent(QPaintEvent *) {
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE {
QStylePainter painter(this);
QStyleOptionToolButton opt;
initStyleOption(&opt);
diff --git a/src/widgets/widgets/qcalendarwidget.h b/src/widgets/widgets/qcalendarwidget.h
index e838098e53..f039fdf6c9 100644
--- a/src/widgets/widgets/qcalendarwidget.h
+++ b/src/widgets/widgets/qcalendarwidget.h
@@ -86,8 +86,8 @@ public:
explicit QCalendarWidget(QWidget *parent = 0);
~QCalendarWidget();
- virtual QSize sizeHint() const;
- virtual QSize minimumSizeHint() const;
+ virtual QSize sizeHint() const Q_DECL_OVERRIDE;
+ virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QDate selectedDate() const;
@@ -132,11 +132,11 @@ public:
void setDateEditAcceptDelay(int delay);
protected:
- bool event(QEvent *event);
- bool eventFilter(QObject *watched, QEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void resizeEvent(QResizeEvent * event);
- void keyPressEvent(QKeyEvent * event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent * event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
virtual void paintCell(QPainter *painter, const QRect &rect, const QDate &date) const;
void updateCell(const QDate &date);
diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h
index fe954571aa..6586793db2 100644
--- a/src/widgets/widgets/qcheckbox.h
+++ b/src/widgets/widgets/qcheckbox.h
@@ -53,8 +53,8 @@ public:
explicit QCheckBox(const QString &text, QWidget *parent=0);
~QCheckBox();
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
void setTristate(bool y = true);
bool isTristate() const;
@@ -66,12 +66,12 @@ Q_SIGNALS:
void stateChanged(int);
protected:
- bool event(QEvent *e);
- bool hitButton(const QPoint &pos) const;
- void checkStateSet();
- void nextCheckState();
- void paintEvent(QPaintEvent *);
- void mouseMoveEvent(QMouseEvent *);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool hitButton(const QPoint &pos) const Q_DECL_OVERRIDE;
+ void checkStateSet() Q_DECL_OVERRIDE;
+ void nextCheckState() Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionButton *option) const;
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 40cf2f0f95..a83aecf52c 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -1931,6 +1931,9 @@ void QComboBox::setModel(QAbstractItemModel *model)
return;
}
+ if (model == d->model)
+ return;
+
#ifndef QT_NO_COMPLETER
if (d->lineEdit && d->lineEdit->completer()
&& d->lineEdit->completer() == d->completer)
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 806653d2d8..7e399ec1f5 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -188,14 +188,14 @@ public:
QAbstractItemView *view() const;
void setView(QAbstractItemView *itemView);
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
virtual void showPopup();
virtual void hidePopup();
- bool event(QEvent *event);
- QVariant inputMethodQuery(Qt::InputMethodQuery) const;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ QVariant inputMethodQuery(Qt::InputMethodQuery) const Q_DECL_OVERRIDE;
public Q_SLOTS:
void clear();
@@ -215,22 +215,22 @@ Q_SIGNALS:
void currentTextChanged(const QString &);
protected:
- void focusInEvent(QFocusEvent *e);
- void focusOutEvent(QFocusEvent *e);
- void changeEvent(QEvent *e);
- void resizeEvent(QResizeEvent *e);
- void paintEvent(QPaintEvent *e);
- void showEvent(QShowEvent *e);
- void hideEvent(QHideEvent *e);
- void mousePressEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
- void keyPressEvent(QKeyEvent *e);
- void keyReleaseEvent(QKeyEvent *e);
+ void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
+ void hideEvent(QHideEvent *e) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *e);
+ void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
#endif
- void contextMenuEvent(QContextMenuEvent *e);
- void inputMethodEvent(QInputMethodEvent *);
+ void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
+ void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionComboBox *option) const;
diff --git a/src/widgets/widgets/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h
index bfef2e300d..582f666e83 100644
--- a/src/widgets/widgets/qcommandlinkbutton.h
+++ b/src/widgets/widgets/qcommandlinkbutton.h
@@ -58,11 +58,11 @@ public:
void setDescription(const QString &description);
protected:
- QSize sizeHint() const;
- int heightForWidth(int) const;
- QSize minimumSizeHint() const;
- bool event(QEvent *e);
- void paintEvent(QPaintEvent *);
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ int heightForWidth(int) const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QCommandLinkButton)
diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp
index 0dd6515f5b..a9de9a7154 100644
--- a/src/widgets/widgets/qdial.cpp
+++ b/src/widgets/widgets/qdial.cpp
@@ -75,7 +75,7 @@ public:
int valueFromPoint(const QPoint &) const;
double angle(const QPoint &, const QPoint &) const;
void init();
- virtual int bound(int val) const;
+ virtual int bound(int val) const Q_DECL_OVERRIDE;
};
void QDialPrivate::init()
diff --git a/src/widgets/widgets/qdial.h b/src/widgets/widgets/qdial.h
index de233b09b7..acaf6c8c9e 100644
--- a/src/widgets/widgets/qdial.h
+++ b/src/widgets/widgets/qdial.h
@@ -66,23 +66,23 @@ public:
qreal notchTarget() const;
bool notchesVisible() const;
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
public Q_SLOTS:
void setNotchesVisible(bool visible);
void setWrapping(bool on);
protected:
- bool event(QEvent *e);
- void resizeEvent(QResizeEvent *re);
- void paintEvent(QPaintEvent *pe);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *re) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *pe) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *me);
- void mouseReleaseEvent(QMouseEvent *me);
- void mouseMoveEvent(QMouseEvent *me);
+ void mousePressEvent(QMouseEvent *me) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *me) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *me) Q_DECL_OVERRIDE;
- void sliderChange(SliderChange change);
+ void sliderChange(SliderChange change) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionSlider *option) const;
diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h
index e20a166d29..7bf497e3e5 100644
--- a/src/widgets/widgets/qdialogbuttonbox.h
+++ b/src/widgets/widgets/qdialogbuttonbox.h
@@ -140,8 +140,8 @@ Q_SIGNALS:
void rejected();
protected:
- void changeEvent(QEvent *event);
- bool event(QEvent *event);
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QDialogButtonBox)
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 93e6131ab9..121fb2da49 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -109,13 +109,13 @@ class QDockWidgetTitleButton : public QAbstractButton
public:
QDockWidgetTitleButton(QDockWidget *dockWidget);
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
inline QSize minimumSizeHint() const
{ return sizeHint(); }
- void enterEvent(QEvent *event);
- void leaveEvent(QEvent *event);
- void paintEvent(QPaintEvent *event);
+ void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
};
diff --git a/src/widgets/widgets/qdockwidget.h b/src/widgets/widgets/qdockwidget.h
index 70ee2a4dcb..fb5c2c375a 100644
--- a/src/widgets/widgets/qdockwidget.h
+++ b/src/widgets/widgets/qdockwidget.h
@@ -106,10 +106,10 @@ Q_SIGNALS:
void dockLocationChanged(Qt::DockWidgetArea area);
protected:
- void changeEvent(QEvent *event);
- void closeEvent(QCloseEvent *event);
- void paintEvent(QPaintEvent *event);
- bool event(QEvent *event);
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionDockWidget *option) const;
private:
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h
index 7d75b4859c..e8c4720a98 100644
--- a/src/widgets/widgets/qdockwidget_p.h
+++ b/src/widgets/widgets/qdockwidget_p.h
@@ -128,18 +128,18 @@ class Q_WIDGETS_EXPORT QDockWidgetLayout : public QLayout
public:
QDockWidgetLayout(QWidget *parent = 0);
~QDockWidgetLayout();
- void addItem(QLayoutItem *item);
- QLayoutItem *itemAt(int index) const;
- QLayoutItem *takeAt(int index);
- int count() const;
+ void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
+ QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
+ QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
+ int count() const Q_DECL_OVERRIDE;
- QSize maximumSize() const;
- QSize minimumSize() const;
- QSize sizeHint() const;
+ QSize maximumSize() const Q_DECL_OVERRIDE;
+ QSize minimumSize() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
QSize sizeFromContent(const QSize &content, bool floating) const;
- void setGeometry(const QRect &r);
+ void setGeometry(const QRect &r) Q_DECL_OVERRIDE;
enum Role { Content, CloseButton, FloatButton, TitleBar, RoleCount };
QWidget *widgetForRole(Role r) const;
@@ -170,9 +170,9 @@ class QDockWidgetItem : public QWidgetItem
{
public:
QDockWidgetItem(QDockWidget *dockWidget);
- QSize minimumSize() const;
- QSize maximumSize() const;
- QSize sizeHint() const;
+ QSize minimumSize() const Q_DECL_OVERRIDE;
+ QSize maximumSize() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
private:
inline QLayoutItem *dockWidgetChildItem() const;
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index 33fa772d83..79e9c0669a 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -64,10 +64,10 @@ public:
void run(int time);
protected:
- void paintEvent(QPaintEvent* e);
- void closeEvent(QCloseEvent*);
+ void paintEvent(QPaintEvent* e) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent*) Q_DECL_OVERRIDE;
void alphaBlend();
- bool eventFilter(QObject *, QEvent *);
+ bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
protected slots:
void render();
@@ -341,8 +341,8 @@ public:
void run(int time);
protected:
- void paintEvent(QPaintEvent*);
- void closeEvent(QCloseEvent*);
+ void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent*) Q_DECL_OVERRIDE;
private slots:
void scroll();
diff --git a/src/widgets/widgets/qfocusframe.h b/src/widgets/widgets/qfocusframe.h
index d84f286bb6..08eb2a570d 100644
--- a/src/widgets/widgets/qfocusframe.h
+++ b/src/widgets/widgets/qfocusframe.h
@@ -53,10 +53,10 @@ public:
QWidget *widget() const;
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
- bool eventFilter(QObject *, QEvent *);
- void paintEvent(QPaintEvent *);
+ bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOption *option) const;
private:
diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp
index 4e3b57bd02..b040d9ba0d 100644
--- a/src/widgets/widgets/qfontcombobox.cpp
+++ b/src/widgets/widgets/qfontcombobox.cpp
@@ -188,10 +188,10 @@ public:
// painting
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
QIcon truetype;
QIcon bitmap;
diff --git a/src/widgets/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h
index 95bedc7009..c2e5332c50 100644
--- a/src/widgets/widgets/qfontcombobox.h
+++ b/src/widgets/widgets/qfontcombobox.h
@@ -72,7 +72,7 @@ public:
FontFilters fontFilters() const;
QFont currentFont() const;
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
public Q_SLOTS:
void setCurrentFont(const QFont &f);
@@ -81,7 +81,7 @@ Q_SIGNALS:
void currentFontChanged(const QFont &f);
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QFontComboBox)
diff --git a/src/widgets/widgets/qframe.cpp b/src/widgets/widgets/qframe.cpp
index 57cd51396c..b914a80f1d 100644
--- a/src/widgets/widgets/qframe.cpp
+++ b/src/widgets/widgets/qframe.cpp
@@ -202,6 +202,49 @@ QFrame::QFrame(QFramePrivate &dd, QWidget* parent, Qt::WindowFlags f)
d->init();
}
+/*!
+ \since 5.5
+
+ Initializes \a option with the values from this QFrame. This method is
+ useful for subclasses when they need a QStyleOptionFrame but don't want to
+ fill in all the information themselves.
+
+ \sa QStyleOption::initFrom()
+*/
+void QFrame::initStyleOption(QStyleOptionFrame *option) const
+{
+ if (!option)
+ return;
+
+ Q_D(const QFrame);
+ option->initFrom(this);
+
+ int frameShape = d->frameStyle & QFrame::Shape_Mask;
+ int frameShadow = d->frameStyle & QFrame::Shadow_Mask;
+ option->frameShape = Shape(int(option->frameShape) | frameShape);
+ option->rect = frameRect();
+ switch (frameShape) {
+ case QFrame::Box:
+ case QFrame::HLine:
+ case QFrame::VLine:
+ case QFrame::StyledPanel:
+ case QFrame::Panel:
+ option->lineWidth = d->lineWidth;
+ option->midLineWidth = d->midLineWidth;
+ break;
+ default:
+ // most frame styles do not handle customized line and midline widths
+ // (see updateFrameWidth()).
+ option->lineWidth = d->frameWidth;
+ break;
+ }
+
+ if (frameShadow == Sunken)
+ option->state |= QStyle::State_Sunken;
+ else if (frameShadow == Raised)
+ option->state |= QStyle::State_Raised;
+}
+
/*!
Destroys the frame.
@@ -362,10 +405,7 @@ void QFramePrivate::updateStyledFrameWidths()
{
Q_Q(const QFrame);
QStyleOptionFrame opt;
- opt.initFrom(q);
- opt.lineWidth = lineWidth;
- opt.midLineWidth = midLineWidth;
- opt.frameShape = QFrame::Shape(frameStyle & QFrame::Shape_Mask);
+ q->initStyleOption(&opt);
QRect cr = q->style()->subElementRect(QStyle::SE_ShapedFrameContents, &opt, q);
leftFrameWidth = cr.left() - opt.rect.left();
@@ -472,34 +512,8 @@ void QFrame::paintEvent(QPaintEvent *)
*/
void QFrame::drawFrame(QPainter *p)
{
- Q_D(QFrame);
QStyleOptionFrame opt;
- opt.init(this);
- int frameShape = d->frameStyle & QFrame::Shape_Mask;
- int frameShadow = d->frameStyle & QFrame::Shadow_Mask;
- opt.frameShape = Shape(int(opt.frameShape) | frameShape);
- opt.rect = frameRect();
- switch (frameShape) {
- case QFrame::Box:
- case QFrame::HLine:
- case QFrame::VLine:
- case QFrame::StyledPanel:
- case QFrame::Panel:
- opt.lineWidth = d->lineWidth;
- opt.midLineWidth = d->midLineWidth;
- break;
- default:
- // most frame styles do not handle customized line and midline widths
- // (see updateFrameWidth()).
- opt.lineWidth = d->frameWidth;
- break;
- }
-
- if (frameShadow == Sunken)
- opt.state |= QStyle::State_Sunken;
- else if (frameShadow == Raised)
- opt.state |= QStyle::State_Raised;
-
+ initStyleOption(&opt);
style()->drawControl(QStyle::CE_ShapedFrame, &opt, p, this);
}
diff --git a/src/widgets/widgets/qframe.h b/src/widgets/widgets/qframe.h
index ff04d70afc..90e434722e 100644
--- a/src/widgets/widgets/qframe.h
+++ b/src/widgets/widgets/qframe.h
@@ -40,6 +40,7 @@ QT_BEGIN_NAMESPACE
class QFramePrivate;
+class QStyleOptionFrame;
class Q_WIDGETS_EXPORT QFrame : public QWidget
{
@@ -62,7 +63,7 @@ public:
int frameWidth() const;
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
enum Shape {
NoFrame = 0, // no frame
@@ -99,14 +100,15 @@ public:
void setFrameRect(const QRect &);
protected:
- bool event(QEvent *e);
- void paintEvent(QPaintEvent *);
- void changeEvent(QEvent *);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
void drawFrame(QPainter *);
protected:
QFrame(QFramePrivate &dd, QWidget* parent = 0, Qt::WindowFlags f = 0);
+ void initStyleOption(QStyleOptionFrame *option) const;
private:
Q_DISABLE_COPY(QFrame)
diff --git a/src/widgets/widgets/qgroupbox.h b/src/widgets/widgets/qgroupbox.h
index ca5a95e79e..da0f4680d6 100644
--- a/src/widgets/widgets/qgroupbox.h
+++ b/src/widgets/widgets/qgroupbox.h
@@ -63,7 +63,7 @@ public:
Qt::Alignment alignment() const;
void setAlignment(int alignment);
- QSize minimumSizeHint() const;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
bool isFlat() const;
void setFlat(bool flat);
@@ -79,15 +79,15 @@ Q_SIGNALS:
void toggled(bool);
protected:
- bool event(QEvent *event);
- void childEvent(QChildEvent *event);
- void resizeEvent(QResizeEvent *event);
- void paintEvent(QPaintEvent *event);
- void focusInEvent(QFocusEvent *event);
- void changeEvent(QEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void childEvent(QChildEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionGroupBox *option) const;
diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h
index a1e9543187..be56d3bf0f 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -88,13 +88,13 @@ public:
bool hasScaledContents() const;
void setScaledContents(bool);
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
#ifndef QT_NO_SHORTCUT
void setBuddy(QWidget *);
QWidget *buddy() const;
#endif
- int heightForWidth(int) const;
+ int heightForWidth(int) const Q_DECL_OVERRIDE;
bool openExternalLinks() const;
void setOpenExternalLinks(bool open);
@@ -125,17 +125,17 @@ Q_SIGNALS:
void linkHovered(const QString& link);
protected:
- bool event(QEvent *e);
- void keyPressEvent(QKeyEvent *ev);
- void paintEvent(QPaintEvent *);
- void changeEvent(QEvent *);
- void mousePressEvent(QMouseEvent *ev);
- void mouseMoveEvent(QMouseEvent *ev);
- void mouseReleaseEvent(QMouseEvent *ev);
- void contextMenuEvent(QContextMenuEvent *ev);
- void focusInEvent(QFocusEvent *ev);
- void focusOutEvent(QFocusEvent *ev);
- bool focusNextPrevChild(bool next);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *ev) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *ev) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
+ bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
private:
diff --git a/src/widgets/widgets/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h
index 0c3a4d6cf5..6acba3f7c1 100644
--- a/src/widgets/widgets/qlcdnumber.h
+++ b/src/widgets/widgets/qlcdnumber.h
@@ -81,7 +81,7 @@ public:
double value() const;
int intValue() const;
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
public Q_SLOTS:
void display(const QString &str);
@@ -97,8 +97,8 @@ Q_SIGNALS:
void overflow();
protected:
- bool event(QEvent *e);
- void paintEvent(QPaintEvent *);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
public:
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index bd8dd783ff..f10608a8be 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -434,12 +434,6 @@ bool QLineEdit::hasFrame() const
*/
/*!
- \fn void QLineEdit::addAction(QAction *action)
- \overload
- \internal
-*/
-
-/*!
\overload
Adds the \a action to the list of actions at the \a position.
@@ -1405,7 +1399,7 @@ bool QLineEdit::event(QEvent * e)
{
Q_D(QLineEdit);
if (e->type() == QEvent::Timer) {
- // should be timerEvent, is here for binary compatibility
+ // ### Qt6: move to timerEvent, is here for binary compatibility
int timerId = ((QTimerEvent*)e)->timerId();
if (false) {
#ifndef QT_NO_DRAGANDDROP
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index 3997ed16fd..bfbf9fe670 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -121,8 +121,8 @@ public:
QCompleter *completer() const;
#endif
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
int cursorPosition() const;
void setCursorPosition(int);
@@ -166,13 +166,7 @@ public:
void getTextMargins(int *left, int *top, int *right, int *bottom) const;
QMargins textMargins() const;
-#ifdef Q_NO_USING_KEYWORD
- inline void addAction(QAction *action)
- { QWidget::addAction(action); }
-#else
using QWidget::addAction;
-#endif
-
void addAction(QAction *action, ActionPosition position);
QAction *addAction(const QIcon &icon, ActionPosition position);
@@ -204,30 +198,30 @@ Q_SIGNALS:
void selectionChanged();
protected:
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
- void mouseDoubleClickEvent(QMouseEvent *);
- void keyPressEvent(QKeyEvent *);
- void focusInEvent(QFocusEvent *);
- void focusOutEvent(QFocusEvent *);
- void paintEvent(QPaintEvent *);
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *);
- void dragMoveEvent(QDragMoveEvent *e);
- void dragLeaveEvent(QDragLeaveEvent *e);
- void dropEvent(QDropEvent *);
+ void dragEnterEvent(QDragEnterEvent *) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *) Q_DECL_OVERRIDE;
#endif
- void changeEvent(QEvent *);
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *);
+ void contextMenuEvent(QContextMenuEvent *) Q_DECL_OVERRIDE;
#endif
- void inputMethodEvent(QInputMethodEvent *);
+ void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionFrame *option) const;
public:
- QVariant inputMethodQuery(Qt::InputMethodQuery) const;
- bool event(QEvent *);
+ QVariant inputMethodQuery(Qt::InputMethodQuery) const Q_DECL_OVERRIDE;
+ bool event(QEvent *) Q_DECL_OVERRIDE;
protected:
QRect cursorRect() const;
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 6426329de6..95fc7551fc 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -81,7 +81,7 @@ public:
#endif
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private slots:
void updateCursor();
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index 4478c47449..717bc32739 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -188,9 +188,9 @@ Q_SIGNALS:
protected:
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *event);
+ void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
#endif
- bool event(QEvent *event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QMainWindow)
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 827e2ed2ba..9e8e0aee27 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -1243,7 +1243,7 @@ class QMainWindowTabBar : public QTabBar
public:
QMainWindowTabBar(QWidget *parent);
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
};
QMainWindowTabBar::QMainWindowTabBar(QWidget *parent)
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index d9e18b03f4..4e10aef891 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -151,7 +151,7 @@ public:
void setDockOptions(QMainWindow::DockOptions opts);
bool usesHIToolBar(QToolBar *toolbar) const;
- void timerEvent(QTimerEvent *e);
+ void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
// status bar
@@ -249,17 +249,17 @@ public:
// QLayout interface
- void addItem(QLayoutItem *item);
- void setGeometry(const QRect &r);
- QLayoutItem *itemAt(int index) const;
- QLayoutItem *takeAt(int index);
- int count() const;
+ void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &r) Q_DECL_OVERRIDE;
+ QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
+ QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
+ int count() const Q_DECL_OVERRIDE;
- QSize sizeHint() const;
- QSize minimumSize() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSize() const Q_DECL_OVERRIDE;
mutable QSize szHint;
mutable QSize minSize;
- void invalidate();
+ void invalidate() Q_DECL_OVERRIDE;
// animations
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 3553baf68a..e104a3511b 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -567,9 +567,9 @@ public:
QMdiAreaTabBar(QWidget *parent) : QTabBar(parent) {}
protected:
- void mousePressEvent(QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *event);
+ void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
#endif
private:
diff --git a/src/widgets/widgets/qmdiarea.h b/src/widgets/widgets/qmdiarea.h
index 18d559e21b..b824cfb4ae 100644
--- a/src/widgets/widgets/qmdiarea.h
+++ b/src/widgets/widgets/qmdiarea.h
@@ -82,8 +82,8 @@ public:
QMdiArea(QWidget *parent = 0);
~QMdiArea();
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QMdiSubWindow *currentSubWindow() const;
QMdiSubWindow *activeSubWindow() const;
@@ -135,18 +135,18 @@ public Q_SLOTS:
void activatePreviousSubWindow();
protected Q_SLOTS:
- void setupViewport(QWidget *viewport);
+ void setupViewport(QWidget *viewport) Q_DECL_OVERRIDE;
protected:
- bool event(QEvent *event);
- bool eventFilter(QObject *object, QEvent *event);
- void paintEvent(QPaintEvent *paintEvent);
- void childEvent(QChildEvent *childEvent);
- void resizeEvent(QResizeEvent *resizeEvent);
- void timerEvent(QTimerEvent *timerEvent);
- void showEvent(QShowEvent *showEvent);
- bool viewportEvent(QEvent *event);
- void scrollContentsBy(int dx, int dy);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *paintEvent) Q_DECL_OVERRIDE;
+ void childEvent(QChildEvent *childEvent) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *resizeEvent) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *timerEvent) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *showEvent) Q_DECL_OVERRIDE;
+ bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QMdiArea)
diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h
index ba531adaad..d1341d5837 100644
--- a/src/widgets/widgets/qmdiarea_p.h
+++ b/src/widgets/widgets/qmdiarea_p.h
@@ -81,7 +81,7 @@ class RegularTiler : public Rearranger
// Rearranges widgets according to a regular tiling pattern
// covering the entire domain.
// Both positions and sizes may change.
- void rearrange(QList<QWidget *> &widgets, const QRect &domain) const;
+ void rearrange(QList<QWidget *> &widgets, const QRect &domain) const Q_DECL_OVERRIDE;
inline Type type() const { return Rearranger::RegularTiler; }
};
@@ -90,7 +90,7 @@ class SimpleCascader : public Rearranger
// Rearranges widgets according to a simple, regular cascading pattern.
// Widgets are resized to minimumSize.
// Both positions and sizes may change.
- void rearrange(QList<QWidget *> &widgets, const QRect &domain) const;
+ void rearrange(QList<QWidget *> &widgets, const QRect &domain) const Q_DECL_OVERRIDE;
inline Type type() const { return Rearranger::SimpleCascader; }
};
@@ -99,7 +99,7 @@ class IconTiler : public Rearranger
// Rearranges icons (assumed to be the same size) according to a regular
// tiling pattern filling up the domain from the bottom.
// Only positions may change.
- void rearrange(QList<QWidget *> &widgets, const QRect &domain) const;
+ void rearrange(QList<QWidget *> &widgets, const QRect &domain) const Q_DECL_OVERRIDE;
inline Type type() const { return Rearranger::IconTiler; }
};
@@ -115,7 +115,7 @@ public:
class MinOverlapPlacer : public Placer
{
- QPoint place(const QSize &size, const QVector<QRect> &rects, const QRect &domain) const;
+ QPoint place(const QSize &size, const QVector<QRect> &rects, const QRect &domain) const Q_DECL_OVERRIDE;
static int accumulatedOverlap(const QRect &source, const QVector<QRect> &rects);
static QRect findMinOverlapRect(const QVector<QRect> &source, const QVector<QRect> &rects);
static QVector<QRect> getCandidatePlacements(const QSize &size, const QVector<QRect> &rects, const QRect &domain);
@@ -199,7 +199,7 @@ public:
bool lastWindowAboutToBeDestroyed() const;
void setChildActivationEnabled(bool enable = true, bool onlyNextActivationEvent = false) const;
QRect resizeToMinimumTileSize(const QSize &minSubWindowSize, int subWindowCount);
- void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy); // reimp
+ void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy) Q_DECL_OVERRIDE; // reimp
QMdiSubWindow *nextVisibleSubWindow(int increaseFactor, QMdiArea::WindowOrder,
int removed = -1, int fromIndex = -1) const;
void highlightNextSubWindow(int increaseFactor);
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 2340c8fe4b..d656c0abb7 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -362,18 +362,18 @@ class ControlLabel : public QWidget
public:
ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = 0);
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
signals:
void _q_clicked();
void _q_doubleClicked();
protected:
- bool event(QEvent *event);
- void paintEvent(QPaintEvent *paintEvent);
- void mousePressEvent(QMouseEvent *mouseEvent);
- void mouseDoubleClickEvent(QMouseEvent *mouseEvent);
- void mouseReleaseEvent(QMouseEvent *mouseEvent);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *paintEvent) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
private:
QPixmap label;
@@ -488,7 +488,7 @@ class ControllerWidget : public QWidget
Q_OBJECT
public:
ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent = 0);
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
void setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible);
inline bool hasVisibleControls() const
{
@@ -503,12 +503,12 @@ signals:
void _q_close();
protected:
- void paintEvent(QPaintEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void leaveEvent(QEvent *event);
- bool event(QEvent *event);
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
private:
QStyle::SubControl activeControl;
diff --git a/src/widgets/widgets/qmdisubwindow.h b/src/widgets/widgets/qmdisubwindow.h
index a94ecfb48e..6e4d0514ee 100644
--- a/src/widgets/widgets/qmdisubwindow.h
+++ b/src/widgets/widgets/qmdisubwindow.h
@@ -63,8 +63,8 @@ public:
QMdiSubWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
~QMdiSubWindow();
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
void setWidget(QWidget *widget);
QWidget *widget() const;
@@ -101,28 +101,28 @@ public Q_SLOTS:
void showShaded();
protected:
- bool eventFilter(QObject *object, QEvent *event);
- bool event(QEvent *event);
- void showEvent(QShowEvent *showEvent);
- void hideEvent(QHideEvent *hideEvent);
- void changeEvent(QEvent *changeEvent);
- void closeEvent(QCloseEvent *closeEvent);
- void leaveEvent(QEvent *leaveEvent);
- void resizeEvent(QResizeEvent *resizeEvent);
- void timerEvent(QTimerEvent *timerEvent);
- void moveEvent(QMoveEvent *moveEvent);
- void paintEvent(QPaintEvent *paintEvent);
- void mousePressEvent(QMouseEvent *mouseEvent);
- void mouseDoubleClickEvent(QMouseEvent *mouseEvent);
- void mouseReleaseEvent(QMouseEvent *mouseEvent);
- void mouseMoveEvent(QMouseEvent *mouseEvent);
- void keyPressEvent(QKeyEvent *keyEvent);
+ bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *showEvent) Q_DECL_OVERRIDE;
+ void hideEvent(QHideEvent *hideEvent) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *changeEvent) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *closeEvent) Q_DECL_OVERRIDE;
+ void leaveEvent(QEvent *leaveEvent) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *resizeEvent) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *timerEvent) Q_DECL_OVERRIDE;
+ void moveEvent(QMoveEvent *moveEvent) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *paintEvent) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *keyEvent) Q_DECL_OVERRIDE;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *contextMenuEvent);
+ void contextMenuEvent(QContextMenuEvent *contextMenuEvent) Q_DECL_OVERRIDE;
#endif
- void focusInEvent(QFocusEvent *focusInEvent);
- void focusOutEvent(QFocusEvent *focusOutEvent);
- void childEvent(QChildEvent *childEvent);
+ void focusInEvent(QFocusEvent *focusInEvent) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *focusOutEvent) Q_DECL_OVERRIDE;
+ void childEvent(QChildEvent *childEvent) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QMdiSubWindow)
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index 763f6ba039..f5cb94faea 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -260,7 +260,7 @@ public:
void setFocusWidget();
bool restoreFocus();
void storeFocusWidget();
- void setWindowFlags(Qt::WindowFlags windowFlags);
+ void setWindowFlags(Qt::WindowFlags windowFlags) Q_DECL_OVERRIDE;
void setVisible(WindowStateAction, bool visible = true);
#ifndef QT_NO_ACTION
void setEnabled(WindowStateAction, bool enable = true);
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 5e5126e1e8..7e446fd087 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -70,6 +70,22 @@
QT_BEGIN_NAMESPACE
QMenu *QMenuPrivate::mouseDown = 0;
+QPointer<QMenu> QMenuPrivate::previousMouseMenu(Q_NULLPTR);
+static void handleEnterLeaveEvents(QPointer<QMenu> *previous_ptr, QMenu *next)
+{
+ QWidget *previous = previous_ptr->data();
+ if (previous != next) {
+ if (previous) {
+ QEvent leaveEvent(QEvent::Leave);
+ QApplication::sendEvent(previous, &leaveEvent);
+ }
+ if (next) {
+ QEvent enterEvent(QEvent::Enter);
+ QApplication::sendEvent(next, &enterEvent);
+ }
+ }
+ *previous_ptr = next;
+}
/* QMenu code */
// internal class used for the torn off popup
@@ -86,7 +102,7 @@ class QTornOffMenu : public QMenu
causedPopup.action = ((QTornOffMenu*)p)->d_func()->causedPopup.action;
causedStack = ((QTornOffMenu*)p)->d_func()->calcCausedStack();
}
- QList<QPointer<QWidget> > calcCausedStack() const { return causedStack; }
+ QList<QPointer<QWidget> > calcCausedStack() const Q_DECL_OVERRIDE { return causedStack; }
QPointer<QMenu> causedMenu;
QList<QPointer<QWidget> > causedStack;
};
@@ -119,7 +135,7 @@ public:
} else if (act->type() == QEvent::ActionRemoved)
removeAction(act->action());
}
- void actionEvent(QActionEvent *e)
+ void actionEvent(QActionEvent *e) Q_DECL_OVERRIDE
{
QMenu::actionEvent(e);
setFixedSize(sizeHint());
@@ -148,6 +164,9 @@ void QMenuPrivate::init()
}
setPlatformMenu(QGuiApplicationPrivate::platformTheme()->createPlatformMenu());
+ sloppyState.initialize(q);
+ delayState.initialize(q);
+ mousePopupDelay = q->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, q);
}
void QMenuPrivate::setPlatformMenu(QPlatformMenu *menu)
@@ -270,7 +289,6 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
maxIconWidth = 0;
hasCheckableItems = false;
ncols = 1;
- sloppyAction = 0;
for (int i = 0; i < actions.count(); ++i) {
QAction *action = actions.at(i);
@@ -482,21 +500,30 @@ void QMenuPrivate::hideMenu(QMenu *menu)
aboutToHide = false;
blocker.unblock();
#endif // QT_NO_EFFECTS
+ if (activeMenu == menu)
+ activeMenu = 0;
+ menu->d_func()->causedPopup.action = 0;
+ menu->d_func()->causedPopup.widget = 0;
menu->close();
+ if (previousMouseMenu.data() == menu)
+ handleEnterLeaveEvents(&previousMouseMenu, Q_NULLPTR);
}
void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)
{
Q_Q(QMenu);
- if (action && action->isEnabled()) {
- if (!delay)
- q->internalDelayedPopup();
- else if (!menuDelayTimer.isActive() && (!action->menu() || !action->menu()->isVisible()))
- menuDelayTimer.start(delay, q);
- if (activateFirst && action->menu())
- action->menu()->d_func()->setFirstActionActive();
+ if (action) {
+ if (action->isEnabled()) {
+ if (!delay)
+ q->internalDelayedPopup();
+ else if (action->menu() && !action->menu()->isVisible())
+ delayState.start(delay, action);
+ else if (!action->menu())
+ delayState.stop();
+ if (activateFirst && action->menu())
+ action->menu()->d_func()->setFirstActionActive();
+ }
} else if (QMenu *menu = activeMenu) { //hide the current item
- activeMenu = 0;
hideMenu(menu);
}
}
@@ -547,33 +574,32 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
{
Q_Q(QMenu);
tearoffHighlighted = 0;
+
+ if (action
+ && (action->isSeparator()
+ || (!action->isEnabled() && !q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q))))
+ action = Q_NULLPTR;
+
// Reselect the currently active action in case mouse moved over other menu items when
// moving from sub menu action to sub menu (QTBUG-20094).
- if (reason != SelectedFromKeyboard && action == currentAction && !(action && action->menu() && action->menu() != activeMenu)) {
+ if (reason != SelectedFromKeyboard) {
if (QMenu *menu = qobject_cast<QMenu*>(causedPopup.widget)) {
if (causedPopup.action && menu->d_func()->activeMenu == q)
menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false);
}
- return;
}
if (currentAction)
q->update(actionRect(currentAction));
- sloppyAction = 0;
- if (!sloppyRegion.isEmpty())
- sloppyRegion = QRegion();
QMenu *hideActiveMenu = activeMenu;
-#ifndef QT_NO_STATUSTIP
QAction *previousAction = currentAction;
-#endif
currentAction = action;
if (action) {
if (!action->isSeparator()) {
activateAction(action, QAction::Hover);
if (popup != -1) {
- hideActiveMenu = 0; //will be done "later"
// if the menu is visible then activate the required action,
// otherwise we just mark the action as currentAction
// and activate it when the menu will be popuped.
@@ -596,24 +622,122 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
}
}
}
- } else { //action is a separator
- if (popup != -1)
- hideActiveMenu = 0; //will be done "later"
}
#ifndef QT_NO_STATUSTIP
} else if (previousAction) {
previousAction->d_func()->showStatusText(topCausedWidget(), QString());
#endif
}
- if (hideActiveMenu) {
- activeMenu = 0;
+ if (hideActiveMenu && previousAction != currentAction) {
+ if (popup == -1) {
#ifndef QT_NO_EFFECTS
- // kill any running effect
- qFadeEffect(0);
- qScrollEffect(0);
+ // kill any running effect
+ qFadeEffect(0);
+ qScrollEffect(0);
#endif
- hideMenu(hideActiveMenu);
+ hideMenu(hideActiveMenu);
+ } else if (!currentAction || !currentAction->menu()) {
+ sloppyState.startTimerIfNotRunning();
+ }
+ }
+}
+
+void QMenuSloppyState::reset()
+{
+ m_enabled = false;
+ m_first_mouse = true;
+ m_init_guard = false;
+ m_uni_dir_discarded_count = 0;
+ m_time.stop();
+ m_reset_action = Q_NULLPTR;
+ m_origin_action = Q_NULLPTR;
+ m_action_rect = QRect();
+ m_previous_point = QPointF();
+ if (m_sub_menu) {
+ QMenuPrivate::get(m_sub_menu)->sloppyState.m_parent = Q_NULLPTR;
+ m_sub_menu = Q_NULLPTR;
+ }
+}
+void QMenuSloppyState::enter()
+{
+ QMenuPrivate *menuPriv = QMenuPrivate::get(m_menu);
+
+ if (m_discard_state_when_entering_parent && m_sub_menu == menuPriv->activeMenu) {
+ menuPriv->hideMenu(m_sub_menu);
+ reset();
+ }
+ if (m_parent)
+ m_parent->childEnter();
+}
+
+void QMenuSloppyState::childLeave()
+{
+ if (m_enabled && !QMenuPrivate::get(m_menu)->hasReceievedEnter) {
+ startTimer();
+ if (m_parent)
+ m_parent->childLeave();
+ }
+}
+
+void QMenuSloppyState::setSubMenuPopup(const QRect &actionRect, QAction *resetAction, QMenu *subMenu)
+{
+ m_enabled = true;
+ m_init_guard = true;
+ m_time.stop();
+ m_action_rect = actionRect;
+ m_sub_menu = subMenu;
+ QMenuPrivate::get(subMenu)->sloppyState.m_parent = this;
+ m_reset_action = resetAction;
+ m_origin_action = resetAction;
+}
+
+bool QMenuSloppyState::hasParentActiveDelayTimer() const
+{
+ return m_parent && m_parent->m_menu && QMenuPrivate::get(m_parent->m_menu)->delayState.timer.isActive();
+}
+
+class ResetOnDestroy
+{
+public:
+ ResetOnDestroy(QMenuSloppyState *sloppyState, bool *guard)
+ : toReset(sloppyState)
+ , guard(guard)
+ {
+ *guard = false;
+ }
+
+ ~ResetOnDestroy()
+ {
+ if (!*guard)
+ toReset->reset();
}
+
+ QMenuSloppyState *toReset;
+ bool *guard;
+};
+
+void QMenuSloppyState::timeout()
+{
+ QMenuPrivate *menu_priv = QMenuPrivate::get(m_menu);
+ if (menu_priv->currentAction == m_reset_action
+ && menu_priv->hasReceievedEnter
+ && (menu_priv->currentAction
+ && menu_priv->currentAction->menu() == menu_priv->activeMenu)) {
+ return;
+ }
+
+ ResetOnDestroy resetState(this, &m_init_guard);
+
+ if (hasParentActiveDelayTimer() || !m_menu || !m_menu->isVisible())
+ return;
+
+ if (m_sub_menu)
+ menu_priv->hideMenu(m_sub_menu);
+
+ if (menu_priv->hasReceievedEnter)
+ menu_priv->setCurrentAction(m_reset_action,0);
+ else
+ menu_priv->setCurrentAction(Q_NULLPTR, 0);
}
//return the top causedPopup.widget that is not a QMenu
@@ -964,8 +1088,10 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
tearoffHighlighted = 0;
}
- if (q->frameGeometry().contains(e->globalPos())) //otherwise if the event is in our rect we want it..
+ if (q->frameGeometry().contains(e->globalPos())) { //otherwise if the event is in our rect we want it..
+ handleEnterLeaveEvents(&previousMouseMenu, q);
return false;
+ }
for(QWidget *caused = causedPopup.widget; caused;) {
bool passOnEvent = false;
@@ -981,17 +1107,18 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
next_widget = m->d_func()->causedPopup.widget;
}
if (passOnEvent) {
+ handleEnterLeaveEvents(&previousMouseMenu,qobject_cast<QMenu *>(caused));
if(e->type() != QEvent::MouseButtonRelease || mouseDown == caused) {
QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->screenPos(),
e->button(), e->buttons(), e->modifiers());
QGuiApplicationPrivate::setMouseEventSource(&new_e, e->source());
QApplication::sendEvent(caused, &new_e);
return true;
+ }
}
- }
- if (!next_widget)
- break;
caused = next_widget;
+ if (!caused)
+ handleEnterLeaveEvents(&previousMouseMenu, Q_NULLPTR);
}
return false;
}
@@ -2236,6 +2363,8 @@ void QMenu::hideEvent(QHideEvent *)
#endif
d->mouseDown = 0;
d->hasHadMouse = false;
+ if (d->activeMenu)
+ d->hideMenu(d->activeMenu);
d->causedPopup.widget = 0;
d->causedPopup.action = 0;
if (d->scroll)
@@ -2402,7 +2531,7 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e)
#endif
d->activateAction(action, QAction::Trigger);
}
- } else if (d->hasMouseMoved(e->globalPos())) {
+ } else if ((!action || action->isEnabled()) && d->hasMouseMoved(e->globalPos())) {
d->hideUpToMenuBar();
}
}
@@ -2467,8 +2596,8 @@ QMenu::event(QEvent *e)
}
} break;
case QEvent::ContextMenu:
- if(d->menuDelayTimer.isActive()) {
- d->menuDelayTimer.stop();
+ if (d->delayState.timer.isActive()) {
+ d->delayState.stop();
internalDelayedPopup();
}
break;
@@ -2485,6 +2614,7 @@ QMenu::event(QEvent *e)
case QEvent::Show:
d->mouseDown = 0;
d->updateActionRects();
+ d->sloppyState.reset();
if (d->currentAction)
d->popupAction(d->currentAction, 0, false);
break;
@@ -2892,34 +3022,34 @@ void QMenu::mouseMoveEvent(QMouseEvent *e)
Q_D(QMenu);
if (!isVisible() || d->aboutToHide || d->mouseEventTaken(e))
return;
+
d->motions++;
- if (d->motions == 0) // ignore first mouse move event (see enterEvent())
+ if (d->motions == 0)
return;
+
d->hasHadMouse = d->hasHadMouse || rect().contains(e->pos());
QAction *action = d->actionAt(e->pos());
- if (!action || action->isSeparator()) {
+ if ((!action || action->isSeparator()) && !d->sloppyState.enabled()) {
if (d->hasHadMouse
- && d->sloppyDelayTimer == 0 // Keep things as they are while we're moving to the submenu
- && (!d->currentAction || (action && action->isSeparator())
- || !(d->currentAction->menu() && d->currentAction->menu()->isVisible())))
- d->setCurrentAction(0);
+ || (!d->currentAction || !d->currentAction->menu() || !d->currentAction->menu()->isVisible())) {
+ d->setCurrentAction(action);
+ }
return;
- } else if(e->buttons()) {
- d->mouseDown = this;
}
- if (d->sloppyRegion.contains(e->pos())) {
- // If the timer is already running then don't start a new one unless the action is the same
- if (d->sloppyAction != action && d->sloppyDelayTimer != 0) {
- killTimer(d->sloppyDelayTimer);
- d->sloppyDelayTimer = 0;
- }
- if (d->sloppyDelayTimer == 0) {
- d->sloppyAction = action;
- d->sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this) * 6);
- }
- } else if (action != d->currentAction) {
- d->setCurrentAction(action, style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this));
+
+ if (e->buttons())
+ d->mouseDown = this;
+
+ if (d->activeMenu)
+ d->activeMenu->d_func()->setCurrentAction(0);
+
+ QMenuSloppyState::MouseEventResult sloppyEventResult = d->sloppyState.processMouseEvent(e->localPos(), action, d->currentAction);
+ if (sloppyEventResult == QMenuSloppyState::EventShouldBePropogated) {
+ d->setCurrentAction(action, d->mousePopupDelay);
+ } else if (sloppyEventResult == QMenuSloppyState::EventDiscardsSloppyState) {
+ d->sloppyState.reset();
+ d->hideMenu(d->activeMenu);
}
}
@@ -2928,7 +3058,11 @@ void QMenu::mouseMoveEvent(QMouseEvent *e)
*/
void QMenu::enterEvent(QEvent *)
{
- d_func()->motions = -1; // force us to ignore the generate mouse move in mouseMoveEvent()
+ Q_D(QMenu);
+ d->hasReceievedEnter = true;
+ d->sloppyState.enter();
+ d->sloppyState.startTimer();
+ d->motions = -1; // force us to ignore the generate mouse move in mouseMoveEvent()
}
/*!
@@ -2937,9 +3071,8 @@ void QMenu::enterEvent(QEvent *)
void QMenu::leaveEvent(QEvent *)
{
Q_D(QMenu);
- d->sloppyAction = 0;
- if (!d->sloppyRegion.isEmpty())
- d->sloppyRegion = QRegion();
+ d->hasReceievedEnter = false;
+ d->sloppyState.leave();
if (!d->activeMenu && d->currentAction)
setActiveAction(0);
}
@@ -2955,13 +3088,14 @@ QMenu::timerEvent(QTimerEvent *e)
d->scrollMenu((QMenuPrivate::QMenuScroller::ScrollDirection)d->scroll->scrollDirection);
if (d->scroll->scrollFlags == QMenuPrivate::QMenuScroller::ScrollNone)
d->scroll->scrollTimer.stop();
- } else if(d->menuDelayTimer.timerId() == e->timerId()) {
- d->menuDelayTimer.stop();
+ } else if (d->delayState.timer.timerId() == e->timerId()) {
+ if (d->currentAction && !d->currentAction->menu())
+ return;
+ d->delayState.stop();
+ d->sloppyState.stopTimer();
internalDelayedPopup();
- } else if (d->sloppyDelayTimer == e->timerId()) {
- killTimer(d->sloppyDelayTimer);
- d->sloppyDelayTimer = 0;
- internalSetSloppyAction();
+ } else if (d->sloppyState.isTimerId(e->timerId())) {
+ d->sloppyState.timeout();
} else if(d->searchBufferTimer.timerId() == e->timerId()) {
d->searchBuffer.clear();
}
@@ -3086,23 +3220,13 @@ void QMenu::actionEvent(QActionEvent *e)
/*!
\internal
*/
-void QMenu::internalSetSloppyAction()
-{
- if (d_func()->sloppyAction)
- d_func()->setCurrentAction(d_func()->sloppyAction, 0);
-}
-
-/*!
- \internal
-*/
void QMenu::internalDelayedPopup()
{
Q_D(QMenu);
-
//hide the current item
if (QMenu *menu = d->activeMenu) {
- d->activeMenu = 0;
- d->hideMenu(menu);
+ if (d->activeMenu->menuAction() != d->currentAction)
+ d->hideMenu(menu);
}
if (!d->currentAction || !d->currentAction->isEnabled() || !d->currentAction->menu() ||
@@ -3116,46 +3240,15 @@ void QMenu::internalDelayedPopup()
int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this);
const QRect actionRect(d->actionRect(d->currentAction));
- const QSize menuSize(d->activeMenu->sizeHint());
const QPoint rightPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top())));
QPoint pos(rightPos);
- //calc sloppy focus buffer
- if (style()->styleHint(QStyle::SH_Menu_SloppySubMenus, 0, this)) {
- QPoint cur = QCursor::pos();
- if (actionRect.contains(mapFromGlobal(cur))) {
- QPoint pts[4];
- pts[0] = QPoint(cur.x(), cur.y() - 2);
- pts[3] = QPoint(cur.x(), cur.y() + 2);
- if (pos.x() >= cur.x()) {
- pts[1] = QPoint(geometry().right(), pos.y());
- pts[2] = QPoint(geometry().right(), pos.y() + menuSize.height());
- } else {
- pts[1] = QPoint(pos.x() + menuSize.width(), pos.y());
- pts[2] = QPoint(pos.x() + menuSize.width(), pos.y() + menuSize.height());
- }
- QPolygon points(4);
- for(int i = 0; i < 4; i++)
- points.setPoint(i, mapFromGlobal(pts[i]));
- d->sloppyRegion = QRegion(points);
- }
- }
-
- //do the popup
d->activeMenu->popup(pos);
+ d->sloppyState.setSubMenuPopup(actionRect, d->currentAction, d->activeMenu);
}
/*!
- \fn void QMenu::addAction(QAction *action)
- \overload
-
- Appends the action \a action to the menu's list of actions.
-
- \sa QMenuBar::addAction(), QWidget::addAction()
-*/
-
-/*!
\fn void QMenu::aboutToHide()
\since 4.2
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 937f6e3316..6bc14c7c78 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -72,11 +72,7 @@ public:
explicit QMenu(const QString &title, QWidget *parent = 0);
~QMenu();
-#ifdef Q_NO_USING_KEYWORD
- inline void addAction(QAction *action) { QWidget::addAction(action); }
-#else
using QWidget::addAction;
-#endif
QAction *addAction(const QString &text);
QAction *addAction(const QIcon &icon, const QString &text);
QAction *addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0);
@@ -117,7 +113,7 @@ public:
static QAction *exec(QList<QAction*> actions, const QPoint &pos, QAction *at=0, QWidget *parent=0);
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
QRect actionGeometry(QAction *) const;
QAction *actionAt(const QPoint &) const;
@@ -157,22 +153,22 @@ Q_SIGNALS:
protected:
int columnCount() const;
- void changeEvent(QEvent *);
- void keyPressEvent(QKeyEvent *);
- void mouseReleaseEvent(QMouseEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *);
+ void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
#endif
- void enterEvent(QEvent *);
- void leaveEvent(QEvent *);
- void hideEvent(QHideEvent *);
- void paintEvent(QPaintEvent *);
- void actionEvent(QActionEvent *);
- void timerEvent(QTimerEvent *);
- bool event(QEvent *);
- bool focusNextPrevChild(bool next);
+ void enterEvent(QEvent *) Q_DECL_OVERRIDE;
+ void leaveEvent(QEvent *) Q_DECL_OVERRIDE;
+ void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void actionEvent(QActionEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const;
#ifdef Q_OS_WINCE
@@ -180,7 +176,6 @@ protected:
#endif
private Q_SLOTS:
- void internalSetSloppyAction();
void internalDelayedPopup();
private:
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 4a4518671c..64a728eaba 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -71,20 +71,230 @@ struct QWceMenuAction {
};
#endif
+template <typename T>
+class QSetValueOnDestroy
+{
+public:
+ QSetValueOnDestroy(T &toSet, T value)
+ : toSet(toSet)
+ , value(value)
+ { }
+
+ ~QSetValueOnDestroy() { toSet = value; }
+private:
+ T &toSet;
+ T value;
+};
+
+class QMenuSloppyState
+{
+ Q_DISABLE_COPY(QMenuSloppyState)
+public:
+ QMenuSloppyState()
+ : m_menu(Q_NULLPTR)
+ , m_enabled(false)
+ , m_uni_directional(false)
+ , m_select_other_actions(false)
+ , m_first_mouse(true)
+ , m_init_guard(false)
+ , m_uni_dir_discarded_count(0)
+ , m_uni_dir_fail_at_count(0)
+ , m_timeout(0)
+ , m_reset_action(Q_NULLPTR)
+ , m_origin_action(Q_NULLPTR)
+ , m_parent(Q_NULLPTR)
+ { }
+
+ ~QMenuSloppyState() { reset(); }
+
+ void initialize(QMenu *menu)
+ {
+ m_menu = menu;
+ m_uni_directional = menu->style()->styleHint(QStyle::SH_Menu_SubMenuUniDirection, 0, menu);
+ m_uni_dir_fail_at_count = menu->style()->styleHint(QStyle::SH_Menu_SubMenuUniDirectionFailCount, 0, menu);
+ m_select_other_actions = menu->style()->styleHint(QStyle::SH_Menu_SubMenuSloppySelectOtherActions, 0 , menu);
+ m_timeout = menu->style()->styleHint(QStyle::SH_Menu_SubMenuSloppyCloseTimeout);
+ m_discard_state_when_entering_parent = menu->style()->styleHint(QStyle::SH_Menu_SubMenuResetWhenReenteringParent);
+ m_dont_start_time_on_leave = menu->style()->styleHint(QStyle::SH_Menu_SubMenuDontStartSloppyOnLeave);
+ reset();
+ }
+
+ void reset();
+ bool enabled() const { return m_enabled; }
+
+ void setResetAction(QAction *action) { m_reset_action = action; }
+
+ enum MouseEventResult {
+ EventIsProcessed,
+ EventShouldBePropogated,
+ EventDiscardsSloppyState
+ };
+
+ void startTimer()
+ {
+ if (m_enabled)
+ m_time.start(m_timeout, m_menu);
+ }
+
+ void startTimerIfNotRunning()
+ {
+ if (!m_time.isActive())
+ startTimer();
+ }
+
+ void stopTimer()
+ {
+ m_time.stop();
+ }
+
+ void enter();
+
+ void childEnter()
+ {
+ stopTimer();
+ if (m_parent)
+ m_parent->childEnter();
+ }
+
+ void leave()
+ {
+ if (m_dont_start_time_on_leave)
+ return;
+ if (m_parent)
+ m_parent->childLeave();
+ startTimer();
+ }
+ void childLeave();
+
+ static float slope(const QPointF &p1, const QPointF &p2)
+ {
+ const QPointF slope = p2 - p1;
+ if (slope.x()== 0)
+ return 9999;
+ return slope.y()/slope.x();
+ }
+
+ bool checkSlope(qreal oldS, qreal newS, bool wantSteeper)
+ {
+ if (wantSteeper)
+ return oldS <= newS;
+ return newS <= oldS;
+ }
+
+ MouseEventResult processMouseEvent(const QPointF &mousePos, QAction *resetAction, QAction *currentAction)
+ {
+ if (m_parent)
+ m_parent->stopTimer();
+
+ if (!m_enabled)
+ return EventShouldBePropogated;
+
+ if (!m_time.isActive())
+ startTimer();
+
+ if (!m_sub_menu) {
+ reset();
+ return EventShouldBePropogated;
+ }
+
+ QSetValueOnDestroy<bool> setFirstMouse(m_first_mouse, false);
+ QSetValueOnDestroy<QPointF> setPreviousPoint(m_previous_point, mousePos);
+
+ if (resetAction && resetAction->isSeparator())
+ m_reset_action = Q_NULLPTR;
+ else {
+ m_reset_action = resetAction;
+ }
+
+ if (m_action_rect.contains(mousePos)) {
+ startTimer();
+ return currentAction == m_menu->menuAction() ? EventIsProcessed : EventShouldBePropogated;
+ }
+
+ if (m_uni_directional && !m_first_mouse && resetAction != m_origin_action) {
+ bool left_to_right = m_menu->layoutDirection() == Qt::LeftToRight;
+ QRect sub_menu_rect = m_sub_menu->geometry();
+ QPoint sub_menu_top =
+ left_to_right? sub_menu_rect.topLeft() : sub_menu_rect.topRight();
+ QPoint sub_menu_bottom =
+ left_to_right? sub_menu_rect.bottomLeft() : sub_menu_rect.bottomRight();
+ qreal prev_slope_top = slope(m_previous_point, sub_menu_top);
+ qreal prev_slope_bottom = slope(m_previous_point, sub_menu_bottom);
+
+ qreal current_slope_top = slope(mousePos, sub_menu_top);
+ qreal current_slope_bottom = slope(mousePos, sub_menu_bottom);
+
+ bool slopeTop = checkSlope(prev_slope_top, current_slope_top, sub_menu_top.y() < mousePos.y());
+ bool slopeBottom = checkSlope(prev_slope_bottom, current_slope_bottom, sub_menu_bottom.y() > mousePos.y());
+ bool rightDirection = false;
+ int mouseDir = m_previous_point.y() - mousePos.y();
+ if (mouseDir >= 0) {
+ rightDirection = rightDirection || slopeTop;
+ }
+ if (mouseDir <= 0) {
+ rightDirection = rightDirection || slopeBottom;
+ }
+
+ if (m_uni_dir_discarded_count >= m_uni_dir_fail_at_count && !rightDirection) {
+ m_uni_dir_discarded_count = 0;
+ return EventDiscardsSloppyState;
+ }
+
+ if (!rightDirection)
+ m_uni_dir_discarded_count++;
+ else
+ m_uni_dir_discarded_count = 0;
+
+ }
+
+ return m_select_other_actions ? EventShouldBePropogated : EventIsProcessed;
+ }
+
+ void setSubMenuPopup(const QRect &actionRect, QAction *resetAction, QMenu *subMenu);
+ bool hasParentActiveDelayTimer() const;
+ void timeout();
+ int timeForTimeout() const { return m_timeout; }
+
+ bool isTimerId(int timerId) const { return m_time.timerId() == timerId; }
+ QMenu *subMenu() const { return m_sub_menu; }
+
+private:
+ QMenu *m_menu;
+ bool m_enabled;
+ bool m_uni_directional;
+ bool m_select_other_actions;
+ bool m_first_mouse;
+ bool m_init_guard;
+ bool m_discard_state_when_entering_parent;
+ bool m_dont_start_time_on_leave;
+ short m_uni_dir_discarded_count;
+ short m_uni_dir_fail_at_count;
+ short m_timeout;
+ QBasicTimer m_time;
+ QAction *m_reset_action;
+ QAction *m_origin_action;
+ QRectF m_action_rect;
+ QPointF m_previous_point;
+ QPointer<QMenu> m_sub_menu;
+ QMenuSloppyState *m_parent;
+};
+
class QMenuPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QMenu)
public:
QMenuPrivate() : itemsDirty(0), maxIconWidth(0), tabWidth(0), ncols(0),
collapsibleSeparators(true), toolTipsVisible(false),
- activationRecursionGuard(false), hasHadMouse(0), aboutToHide(0), motions(0),
+ activationRecursionGuard(false), delayedPopupGuard(false),
+ hasReceievedEnter(false),
+ hasHadMouse(0), aboutToHide(0), motions(0),
currentAction(0),
#ifdef QT_KEYPAD_NAVIGATION
selectAction(0),
cancelAction(0),
#endif
scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
- hasCheckableItems(0), sloppyDelayTimer(0), sloppyAction(0), doChildEffects(false), platformMenu(0)
+ hasCheckableItems(0), doChildEffects(false), platformMenu(0)
#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
,wce_menu(0)
@@ -127,6 +337,8 @@ public:
int getLastVisibleAction() const;
bool activationRecursionGuard;
+ bool delayedPopupGuard;
+ bool hasReceievedEnter;
//selection
static QMenu *mouseDown;
@@ -134,12 +346,39 @@ public:
uint hasHadMouse : 1;
uint aboutToHide : 1;
int motions;
+ int mousePopupDelay;
QAction *currentAction;
#ifdef QT_KEYPAD_NAVIGATION
QAction *selectAction;
QAction *cancelAction;
#endif
- QBasicTimer menuDelayTimer;
+ struct DelayState {
+ DelayState()
+ : parent(0)
+ , action(0)
+ { }
+ void initialize(QMenu *parent)
+ {
+ this->parent = parent;
+ }
+
+ void start(int timeout, QAction *toStartAction)
+ {
+ if (timer.isActive() && toStartAction == action)
+ return;
+ action = toStartAction;
+ timer.start(timeout,parent);
+ }
+ void stop()
+ {
+ action = 0;
+ timer.stop();
+ }
+
+ QMenu *parent;
+ QBasicTimer timer;
+ QAction *action;
+ } delayState;
enum SelectionReason {
SelectedFromKeyboard,
SelectedFromElsewhere
@@ -198,10 +437,7 @@ public:
mutable bool hasCheckableItems;
- //sloppy selection
- int sloppyDelayTimer;
- mutable QAction *sloppyAction;
- QRegion sloppyRegion;
+ QMenuSloppyState sloppyState;
//default action
QPointer<QAction> defaultAction;
@@ -257,6 +493,7 @@ public:
QAction* wceCommands(uint command);
#endif
QPointer<QWidget> noReplayFor;
+ static QPointer<QMenu> previousMouseMenu;
};
#endif // QT_NO_MENU
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 619cb64636..54d403fa21 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -69,8 +69,8 @@ class QMenuBarExtension : public QToolButton
public:
explicit QMenuBarExtension(QWidget *parent);
- QSize sizeHint() const;
- void paintEvent(QPaintEvent *);
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
};
QMenuBarExtension::QMenuBarExtension(QWidget *parent)
@@ -1922,15 +1922,6 @@ QAction *QMenuBar::defaultAction() const
\sa triggered(), QAction::hovered()
*/
-/*!
- \fn void QMenuBar::addAction(QAction *action)
- \overload
-
- Appends the action \a action to the menu bar's list of actions.
-
- \sa QMenu::addAction(), QWidget::addAction(), QWidget::actions()
-*/
-
// for private slots
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index cd2d2cd7aa..936cb22880 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -57,11 +57,7 @@ public:
explicit QMenuBar(QWidget *parent = 0);
~QMenuBar();
-#ifdef Q_NO_USING_KEYWORD
- void addAction(QAction *action) { QWidget::addAction(action); }
-#else
using QWidget::addAction;
-#endif
QAction *addAction(const QString &text);
QAction *addAction(const QString &text, const QObject *receiver, const char* member);
diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h
index 9f67aaa8da..c47da891c8 100644
--- a/src/widgets/widgets/qplaintextedit.h
+++ b/src/widgets/widgets/qplaintextedit.h
@@ -176,7 +176,7 @@ public:
void print(QPagedPaintDevice *printer) const;
int blockCount() const;
- QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
public Q_SLOTS:
@@ -218,43 +218,43 @@ Q_SIGNALS:
void modificationChanged(bool);
protected:
- virtual bool event(QEvent *e);
- virtual void timerEvent(QTimerEvent *e);
- virtual void keyPressEvent(QKeyEvent *e);
- virtual void keyReleaseEvent(QKeyEvent *e);
- virtual void resizeEvent(QResizeEvent *e);
- virtual void paintEvent(QPaintEvent *e);
- virtual void mousePressEvent(QMouseEvent *e);
- virtual void mouseMoveEvent(QMouseEvent *e);
- virtual void mouseReleaseEvent(QMouseEvent *e);
- virtual void mouseDoubleClickEvent(QMouseEvent *e);
- virtual bool focusNextPrevChild(bool next);
+ virtual bool event(QEvent *e) Q_DECL_OVERRIDE;
+ virtual void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ virtual void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ virtual void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ virtual void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
+ virtual void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ virtual void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ virtual void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ virtual void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ virtual void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ virtual bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
#ifndef QT_NO_CONTEXTMENU
- virtual void contextMenuEvent(QContextMenuEvent *e);
+ virtual void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
#endif
#ifndef QT_NO_DRAGANDDROP
- virtual void dragEnterEvent(QDragEnterEvent *e);
- virtual void dragLeaveEvent(QDragLeaveEvent *e);
- virtual void dragMoveEvent(QDragMoveEvent *e);
- virtual void dropEvent(QDropEvent *e);
+ virtual void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
+ virtual void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
+ virtual void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
+ virtual void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
#endif
- virtual void focusInEvent(QFocusEvent *e);
- virtual void focusOutEvent(QFocusEvent *e);
- virtual void showEvent(QShowEvent *);
- virtual void changeEvent(QEvent *e);
+ virtual void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
+ virtual void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
+ virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+ virtual void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- virtual void wheelEvent(QWheelEvent *e);
+ virtual void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
#endif
virtual QMimeData *createMimeDataFromSelection() const;
virtual bool canInsertFromMimeData(const QMimeData *source) const;
virtual void insertFromMimeData(const QMimeData *source);
- virtual void inputMethodEvent(QInputMethodEvent *);
+ virtual void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
QPlainTextEdit(QPlainTextEditPrivate &dd, QWidget *parent);
- virtual void scrollContentsBy(int dx, int dy);
+ virtual void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
virtual void doSetTextCursor(const QTextCursor &cursor);
QTextBlock firstVisibleBlock() const;
@@ -287,14 +287,14 @@ public:
QPlainTextDocumentLayout(QTextDocument *document);
~QPlainTextDocumentLayout();
- void draw(QPainter *, const PaintContext &);
- int hitTest(const QPointF &, Qt::HitTestAccuracy ) const;
+ void draw(QPainter *, const PaintContext &) Q_DECL_OVERRIDE;
+ int hitTest(const QPointF &, Qt::HitTestAccuracy ) const Q_DECL_OVERRIDE;
- int pageCount() const;
- QSizeF documentSize() const;
+ int pageCount() const Q_DECL_OVERRIDE;
+ QSizeF documentSize() const Q_DECL_OVERRIDE;
- QRectF frameBoundingRect(QTextFrame *) const;
- QRectF blockBoundingRect(const QTextBlock &block) const;
+ QRectF frameBoundingRect(QTextFrame *) const Q_DECL_OVERRIDE;
+ QRectF blockBoundingRect(const QTextBlock &block) const Q_DECL_OVERRIDE;
void ensureBlockLayout(const QTextBlock &block) const;
@@ -304,7 +304,7 @@ public:
void requestUpdate();
protected:
- void documentChanged(int from, int /*charsRemoved*/, int charsAdded);
+ void documentChanged(int from, int /*charsRemoved*/, int charsAdded) Q_DECL_OVERRIDE;
private:
diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h
index 6ab8b90a0d..1e74c7b895 100644
--- a/src/widgets/widgets/qplaintextedit_p.h
+++ b/src/widgets/widgets/qplaintextedit_p.h
@@ -72,18 +72,18 @@ public:
QPlainTextEditControl(QPlainTextEdit *parent);
- QMimeData *createMimeDataFromSelection() const;
- bool canInsertFromMimeData(const QMimeData *source) const;
- void insertFromMimeData(const QMimeData *source);
- int hitTest(const QPointF &point, Qt::HitTestAccuracy = Qt::FuzzyHit) const;
- QRectF blockBoundingRect(const QTextBlock &block) const;
+ QMimeData *createMimeDataFromSelection() const Q_DECL_OVERRIDE;
+ bool canInsertFromMimeData(const QMimeData *source) const Q_DECL_OVERRIDE;
+ void insertFromMimeData(const QMimeData *source) Q_DECL_OVERRIDE;
+ int hitTest(const QPointF &point, Qt::HitTestAccuracy = Qt::FuzzyHit) const Q_DECL_OVERRIDE;
+ QRectF blockBoundingRect(const QTextBlock &block) const Q_DECL_OVERRIDE;
inline QRectF cursorRect(const QTextCursor &cursor) const {
QRectF r = QWidgetTextControl::cursorRect(cursor);
r.setLeft(qMax(r.left(), (qreal) 0.));
return r;
}
inline QRectF cursorRect() { return cursorRect(textCursor()); }
- void ensureCursorVisible() {
+ void ensureCursorVisible() Q_DECL_OVERRIDE {
textEdit->ensureCursorVisible();
emit microFocusChanged();
}
@@ -93,7 +93,7 @@ public:
int topBlock;
QTextBlock firstVisibleBlock() const;
- QVariant loadResource(int type, const QUrl &name) {
+ QVariant loadResource(int type, const QUrl &name) Q_DECL_OVERRIDE {
return textEdit->loadResource(type, name);
}
diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp
index 58aec8ee9a..1c76bd0ac1 100644
--- a/src/widgets/widgets/qprogressbar.cpp
+++ b/src/widgets/widgets/qprogressbar.cpp
@@ -132,7 +132,7 @@ void QProgressBar::initStyleOption(QStyleOptionProgressBar *option) const
if (QStyleOptionProgressBarV2 *optionV2
= qstyleoption_cast<QStyleOptionProgressBarV2 *>(option)) {
- optionV2->orientation = d->orientation; // ### Qt 5: use State_Horizontal instead
+ optionV2->orientation = d->orientation; // ### Qt 6: remove this member from QStyleOptionProgressBarV2
optionV2->invertedAppearance = d->invertedAppearance;
optionV2->bottomToTop = (d->textDirection == QProgressBar::BottomToTop);
}
diff --git a/src/widgets/widgets/qprogressbar.h b/src/widgets/widgets/qprogressbar.h
index 2cdcbccdb3..898656f8f4 100644
--- a/src/widgets/widgets/qprogressbar.h
+++ b/src/widgets/widgets/qprogressbar.h
@@ -77,8 +77,8 @@ public:
Qt::Alignment alignment() const;
void setAlignment(Qt::Alignment alignment);
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
Qt::Orientation orientation() const;
@@ -103,8 +103,8 @@ Q_SIGNALS:
void valueChanged(int value);
protected:
- bool event(QEvent *e);
- void paintEvent(QPaintEvent *);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionProgressBar *option) const;
private:
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index ebf66f8ef8..5063651658 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -57,8 +57,8 @@ public:
QPushButton(const QIcon& icon, const QString &text, QWidget *parent=0);
~QPushButton();
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
bool autoDefault() const;
void setAutoDefault(bool);
@@ -79,14 +79,14 @@ public Q_SLOTS:
#endif
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
#ifdef Q_WS_MAC
bool hitButton(const QPoint &pos) const;
#endif // Q_WS_MAC
- void paintEvent(QPaintEvent *);
- void keyPressEvent(QKeyEvent *);
- void focusInEvent(QFocusEvent *);
- void focusOutEvent(QFocusEvent *);
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionButton *option) const;
QPushButton(QPushButtonPrivate &dd, QWidget* parent = 0);
diff --git a/src/widgets/widgets/qradiobutton.h b/src/widgets/widgets/qradiobutton.h
index 0bfb0de4e8..beda0e0d38 100644
--- a/src/widgets/widgets/qradiobutton.h
+++ b/src/widgets/widgets/qradiobutton.h
@@ -51,14 +51,14 @@ public:
explicit QRadioButton(const QString &text, QWidget *parent=0);
~QRadioButton();
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
protected:
- bool event(QEvent *e);
- bool hitButton(const QPoint &) const;
- void paintEvent(QPaintEvent *);
- void mouseMoveEvent(QMouseEvent *);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool hitButton(const QPoint &) const Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionButton *button) const;
diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h
index 7193f69f59..f46d6a8643 100644
--- a/src/widgets/widgets/qrubberband.h
+++ b/src/widgets/widgets/qrubberband.h
@@ -67,12 +67,12 @@ public:
{ resize(s.width(), s.height()); }
protected:
- bool event(QEvent *e);
- void paintEvent(QPaintEvent *);
- void changeEvent(QEvent *);
- void showEvent(QShowEvent *);
- void resizeEvent(QResizeEvent *);
- void moveEvent(QMoveEvent *);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void moveEvent(QMoveEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionRubberBand *option) const;
private:
diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h
index 568dbc6e4f..3ec9ca14a3 100644
--- a/src/widgets/widgets/qscrollarea.h
+++ b/src/widgets/widgets/qscrollarea.h
@@ -60,9 +60,9 @@ public:
bool widgetResizable() const;
void setWidgetResizable(bool resizable);
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
- bool focusNextPrevChild(bool next);
+ bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
Qt::Alignment alignment() const;
void setAlignment(Qt::Alignment);
@@ -72,10 +72,10 @@ public:
protected:
QScrollArea(QScrollAreaPrivate &dd, QWidget *parent = 0);
- bool event(QEvent *);
- bool eventFilter(QObject *, QEvent *);
- void resizeEvent(QResizeEvent *);
- void scrollContentsBy(int dx, int dy);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
QSize viewportSizeHint() const Q_DECL_OVERRIDE;
diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h
index 2b67f04850..992bd511c8 100644
--- a/src/widgets/widgets/qscrollbar.h
+++ b/src/widgets/widgets/qscrollbar.h
@@ -53,21 +53,21 @@ public:
explicit QScrollBar(Qt::Orientation, QWidget *parent=0);
~QScrollBar();
- QSize sizeHint() const;
- bool event(QEvent *event);
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
protected:
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *);
+ void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
#endif
- void paintEvent(QPaintEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
- void hideEvent(QHideEvent*);
- void sliderChange(SliderChange change);
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void hideEvent(QHideEvent*) Q_DECL_OVERRIDE;
+ void sliderChange(SliderChange change) Q_DECL_OVERRIDE;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *);
+ void contextMenuEvent(QContextMenuEvent *) Q_DECL_OVERRIDE;
#endif
void initStyleOption(QStyleOptionSlider *option) const;
diff --git a/src/widgets/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h
index 61b397e2bb..7885d0a2b7 100644
--- a/src/widgets/widgets/qsizegrip.h
+++ b/src/widgets/widgets/qsizegrip.h
@@ -48,19 +48,19 @@ public:
explicit QSizeGrip(QWidget *parent);
~QSizeGrip();
- QSize sizeHint() const;
- void setVisible(bool);
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ void setVisible(bool) Q_DECL_OVERRIDE;
protected:
- void paintEvent(QPaintEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *mouseEvent);
- void moveEvent(QMoveEvent *moveEvent);
- void showEvent(QShowEvent *showEvent);
- void hideEvent(QHideEvent *hideEvent);
- bool eventFilter(QObject *, QEvent *);
- bool event(QEvent *);
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
+ void moveEvent(QMoveEvent *moveEvent) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *showEvent) Q_DECL_OVERRIDE;
+ void hideEvent(QHideEvent *hideEvent) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) Q_DECL_OVERRIDE;
public:
diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h
index 6d7bf7eee8..66b23e6fa3 100644
--- a/src/widgets/widgets/qslider.h
+++ b/src/widgets/widgets/qslider.h
@@ -66,8 +66,8 @@ public:
~QSlider();
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
void setTickPosition(TickPosition position);
TickPosition tickPosition() const;
@@ -75,13 +75,13 @@ public:
void setTickInterval(int ti);
int tickInterval() const;
- bool event(QEvent *event);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
protected:
- void paintEvent(QPaintEvent *ev);
- void mousePressEvent(QMouseEvent *ev);
- void mouseReleaseEvent(QMouseEvent *ev);
- void mouseMoveEvent(QMouseEvent *ev);
+ void paintEvent(QPaintEvent *ev) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionSlider *option) const;
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index e8b22151fa..3fe1218b87 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -58,10 +58,10 @@ class QSpinBoxPrivate : public QAbstractSpinBoxPrivate
Q_DECLARE_PUBLIC(QSpinBox)
public:
QSpinBoxPrivate();
- void emitSignals(EmitPolicy ep, const QVariant &);
+ void emitSignals(EmitPolicy ep, const QVariant &) Q_DECL_OVERRIDE;
- virtual QVariant valueFromText(const QString &n) const;
- virtual QString textFromValue(const QVariant &n) const;
+ virtual QVariant valueFromText(const QString &n) const Q_DECL_OVERRIDE;
+ virtual QString textFromValue(const QVariant &n) const Q_DECL_OVERRIDE;
QVariant validateAndInterpret(QString &input, int &pos,
QValidator::State &state) const;
@@ -79,10 +79,10 @@ class QDoubleSpinBoxPrivate : public QAbstractSpinBoxPrivate
Q_DECLARE_PUBLIC(QDoubleSpinBox)
public:
QDoubleSpinBoxPrivate();
- void emitSignals(EmitPolicy ep, const QVariant &);
+ void emitSignals(EmitPolicy ep, const QVariant &) Q_DECL_OVERRIDE;
- virtual QVariant valueFromText(const QString &n) const;
- virtual QString textFromValue(const QVariant &n) const;
+ virtual QVariant valueFromText(const QString &n) const Q_DECL_OVERRIDE;
+ virtual QString textFromValue(const QVariant &n) const Q_DECL_OVERRIDE;
QVariant validateAndInterpret(QString &input, int &pos,
QValidator::State &state) const;
double round(double input) const;
diff --git a/src/widgets/widgets/qsplashscreen.h b/src/widgets/widgets/qsplashscreen.h
index bb8b359831..41db23a434 100644
--- a/src/widgets/widgets/qsplashscreen.h
+++ b/src/widgets/widgets/qsplashscreen.h
@@ -66,9 +66,9 @@ Q_SIGNALS:
void messageChanged(const QString &message);
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
virtual void drawContents(QPainter *painter);
- void mousePressEvent(QMouseEvent *);
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QSplashScreen)
diff --git a/src/widgets/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h
index f82c06c3bc..c08682eef2 100644
--- a/src/widgets/widgets/qsplitter.h
+++ b/src/widgets/widgets/qsplitter.h
@@ -77,8 +77,8 @@ public:
bool opaqueResize() const;
void refresh();
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QList<int> sizes() const;
void setSizes(const QList<int> &list);
@@ -104,12 +104,12 @@ Q_SIGNALS:
protected:
virtual QSplitterHandle *createHandle();
- void childEvent(QChildEvent *);
+ void childEvent(QChildEvent *) Q_DECL_OVERRIDE;
- bool event(QEvent *);
- void resizeEvent(QResizeEvent *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *);
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
void moveSplitter(int pos, int index);
void setRubberBand(int position);
int closestLegalPosition(int, int);
@@ -138,15 +138,15 @@ public:
bool opaqueResize() const;
QSplitter *splitter() const;
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
protected:
- void paintEvent(QPaintEvent *);
- void mouseMoveEvent(QMouseEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
- void resizeEvent(QResizeEvent *);
- bool event(QEvent *);
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) Q_DECL_OVERRIDE;
void moveSplitter(int p);
int closestLegalPosition(int p);
diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h
index af048bc749..71191ba133 100644
--- a/src/widgets/widgets/qstackedwidget.h
+++ b/src/widgets/widgets/qstackedwidget.h
@@ -73,7 +73,7 @@ Q_SIGNALS:
void widgetRemoved(int index);
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QStackedWidget)
diff --git a/src/widgets/widgets/qstatusbar.h b/src/widgets/widgets/qstatusbar.h
index d24680ab2a..56d45b9001 100644
--- a/src/widgets/widgets/qstatusbar.h
+++ b/src/widgets/widgets/qstatusbar.h
@@ -73,14 +73,14 @@ Q_SIGNALS:
void messageChanged(const QString &text);
protected:
- void showEvent(QShowEvent *);
- void paintEvent(QPaintEvent *);
- void resizeEvent(QResizeEvent *);
+ void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
// ### Qt 6: consider making reformat() and hideOrShow() private
void reformat();
void hideOrShow();
- bool event(QEvent *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QStatusBar)
diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h
index bdc9dae07c..5cca289020 100644
--- a/src/widgets/widgets/qtabbar.h
+++ b/src/widgets/widgets/qtabbar.h
@@ -130,8 +130,8 @@ public:
int currentIndex() const;
int count() const;
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
void setDrawBase(bool drawTheBase);
bool drawBase() const;
@@ -183,20 +183,20 @@ protected:
virtual void tabRemoved(int index);
virtual void tabLayoutChange();
- bool event(QEvent *);
- void resizeEvent(QResizeEvent *);
- void showEvent(QShowEvent *);
- void hideEvent(QHideEvent *);
- void paintEvent(QPaintEvent *);
- void mousePressEvent (QMouseEvent *);
- void mouseMoveEvent (QMouseEvent *);
- void mouseReleaseEvent (QMouseEvent *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+ void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent (QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent (QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent (QMouseEvent *) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *event);
+ void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
#endif
- void keyPressEvent(QKeyEvent *);
- void changeEvent(QEvent *);
- void timerEvent(QTimerEvent *event);
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionTab *option, int tabIndex) const;
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index b26ad20f1a..9393c94c9e 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -119,9 +119,9 @@ public:
TabBarAnimation(Tab *t, QTabBarPrivate *_priv) : tab(t), priv(_priv)
{ setEasingCurve(QEasingCurve::InOutQuad); }
- void updateCurrentValue(const QVariant &current);
+ void updateCurrentValue(const QVariant &current) Q_DECL_OVERRIDE;
- void updateState(State, State newState);
+ void updateState(State, State newState) Q_DECL_OVERRIDE;
private:
//these are needed for the callbacks
Tab *tab;
@@ -250,12 +250,12 @@ class CloseButton : public QAbstractButton
public:
CloseButton(QWidget *parent = 0);
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
inline QSize minimumSizeHint() const
{ return sizeHint(); }
- void enterEvent(QEvent *event);
- void leaveEvent(QEvent *event);
- void paintEvent(QPaintEvent *event);
+ void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
};
diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h
index 5d9adc40e5..dc5c49c99c 100644
--- a/src/widgets/widgets/qtabwidget.h
+++ b/src/widgets/widgets/qtabwidget.h
@@ -113,10 +113,10 @@ public:
TabShape tabShape() const;
void setTabShape(TabShape s);
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
- int heightForWidth(int width) const;
- bool hasHeightForWidth() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ int heightForWidth(int width) const Q_DECL_OVERRIDE;
+ bool hasHeightForWidth() const Q_DECL_OVERRIDE;
void setCornerWidget(QWidget * w, Qt::Corner corner = Qt::TopRightCorner);
QWidget * cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;
@@ -154,13 +154,13 @@ protected:
virtual void tabInserted(int index);
virtual void tabRemoved(int index);
- void showEvent(QShowEvent *);
- void resizeEvent(QResizeEvent *);
- void keyPressEvent(QKeyEvent *);
- void paintEvent(QPaintEvent *);
+ void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void setTabBar(QTabBar *);
- void changeEvent(QEvent *);
- bool event(QEvent *);
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionTabWidgetFrame *option) const;
diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp
index 1ef2f92804..7a02401dd1 100644
--- a/src/widgets/widgets/qtextbrowser.cpp
+++ b/src/widgets/widgets/qtextbrowser.cpp
@@ -129,7 +129,7 @@ public:
void setSource(const QUrl &url);
// re-imlemented from QTextEditPrivate
- virtual QUrl resolveUrl(const QUrl &url) const;
+ virtual QUrl resolveUrl(const QUrl &url) const Q_DECL_OVERRIDE;
inline QUrl resolveUrl(const QString &url) const
{ return resolveUrl(QUrl(url)); }
diff --git a/src/widgets/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h
index d08590cb27..de917d0bf3 100644
--- a/src/widgets/widgets/qtextbrowser.h
+++ b/src/widgets/widgets/qtextbrowser.h
@@ -65,7 +65,7 @@ public:
QStringList searchPaths() const;
void setSearchPaths(const QStringList &paths);
- virtual QVariant loadResource(int type, const QUrl &name);
+ virtual QVariant loadResource(int type, const QUrl &name) Q_DECL_OVERRIDE;
bool isBackwardAvailable() const;
bool isForwardAvailable() const;
@@ -98,14 +98,14 @@ Q_SIGNALS:
void anchorClicked(const QUrl &);
protected:
- bool event(QEvent *e);
- virtual void keyPressEvent(QKeyEvent *ev);
- virtual void mouseMoveEvent(QMouseEvent *ev);
- virtual void mousePressEvent(QMouseEvent *ev);
- virtual void mouseReleaseEvent(QMouseEvent *ev);
- virtual void focusOutEvent(QFocusEvent *ev);
- virtual bool focusNextPrevChild(bool next);
- virtual void paintEvent(QPaintEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ virtual void keyPressEvent(QKeyEvent *ev) Q_DECL_OVERRIDE;
+ virtual void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ virtual void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ virtual void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ virtual void focusOutEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
+ virtual bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
+ virtual void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QTextBrowser)
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 7ef864139f..a432a82ec0 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -77,19 +77,19 @@ class QTextEditControl : public QWidgetTextControl
public:
inline QTextEditControl(QObject *parent) : QWidgetTextControl(parent) {}
- virtual QMimeData *createMimeDataFromSelection() const {
+ virtual QMimeData *createMimeDataFromSelection() const Q_DECL_OVERRIDE {
QTextEdit *ed = qobject_cast<QTextEdit *>(parent());
if (!ed)
return QWidgetTextControl::createMimeDataFromSelection();
return ed->createMimeDataFromSelection();
}
- virtual bool canInsertFromMimeData(const QMimeData *source) const {
+ virtual bool canInsertFromMimeData(const QMimeData *source) const Q_DECL_OVERRIDE {
QTextEdit *ed = qobject_cast<QTextEdit *>(parent());
if (!ed)
return QWidgetTextControl::canInsertFromMimeData(source);
return ed->canInsertFromMimeData(source);
}
- virtual void insertFromMimeData(const QMimeData *source) {
+ virtual void insertFromMimeData(const QMimeData *source) Q_DECL_OVERRIDE {
QTextEdit *ed = qobject_cast<QTextEdit *>(parent());
if (!ed)
QWidgetTextControl::insertFromMimeData(source);
diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h
index dc8deea8b6..4c5af67cca 100644
--- a/src/widgets/widgets/qtextedit.h
+++ b/src/widgets/widgets/qtextedit.h
@@ -203,7 +203,7 @@ public:
void print(QPagedPaintDevice *printer) const;
- QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
public Q_SLOTS:
@@ -257,43 +257,43 @@ Q_SIGNALS:
void cursorPositionChanged();
protected:
- virtual bool event(QEvent *e);
- virtual void timerEvent(QTimerEvent *e);
- virtual void keyPressEvent(QKeyEvent *e);
- virtual void keyReleaseEvent(QKeyEvent *e);
- virtual void resizeEvent(QResizeEvent *e);
- virtual void paintEvent(QPaintEvent *e);
- virtual void mousePressEvent(QMouseEvent *e);
- virtual void mouseMoveEvent(QMouseEvent *e);
- virtual void mouseReleaseEvent(QMouseEvent *e);
- virtual void mouseDoubleClickEvent(QMouseEvent *e);
- virtual bool focusNextPrevChild(bool next);
+ virtual bool event(QEvent *e) Q_DECL_OVERRIDE;
+ virtual void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ virtual void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ virtual void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ virtual void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
+ virtual void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ virtual void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ virtual void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ virtual void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ virtual void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ virtual bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
#ifndef QT_NO_CONTEXTMENU
- virtual void contextMenuEvent(QContextMenuEvent *e);
+ virtual void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
#endif
#ifndef QT_NO_DRAGANDDROP
- virtual void dragEnterEvent(QDragEnterEvent *e);
- virtual void dragLeaveEvent(QDragLeaveEvent *e);
- virtual void dragMoveEvent(QDragMoveEvent *e);
- virtual void dropEvent(QDropEvent *e);
+ virtual void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
+ virtual void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
+ virtual void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
+ virtual void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
#endif
- virtual void focusInEvent(QFocusEvent *e);
- virtual void focusOutEvent(QFocusEvent *e);
- virtual void showEvent(QShowEvent *);
- virtual void changeEvent(QEvent *e);
+ virtual void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
+ virtual void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
+ virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+ virtual void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- virtual void wheelEvent(QWheelEvent *e);
+ virtual void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
#endif
virtual QMimeData *createMimeDataFromSelection() const;
virtual bool canInsertFromMimeData(const QMimeData *source) const;
virtual void insertFromMimeData(const QMimeData *source);
- virtual void inputMethodEvent(QInputMethodEvent *);
+ virtual void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
QTextEdit(QTextEditPrivate &dd, QWidget *parent);
- virtual void scrollContentsBy(int dx, int dy);
+ virtual void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
virtual void doSetTextCursor(const QTextCursor &cursor);
void zoomInF(float range);
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 77119a0d7d..c07c3dac8c 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -418,15 +418,6 @@ void QToolBarPrivate::plug(const QRect &r)
*/
/*!
- \fn void QToolBar::addAction(QAction *action)
- \overload
-
- Appends the \a action to the toolbar's list of actions.
-
- \sa QMenu::addAction(), QWidget::addAction()
-*/
-
-/*!
\fn void QToolBar::actionTriggered(QAction *action)
This signal is emitted when an action in this toolbar is triggered.
diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h
index 6bd1411592..57a69afb74 100644
--- a/src/widgets/widgets/qtoolbar.h
+++ b/src/widgets/widgets/qtoolbar.h
@@ -86,13 +86,7 @@ public:
void clear();
-#ifdef Q_NO_USING_KEYWORD
- inline void addAction(QAction *action)
- { QWidget::addAction(action); }
-#else
using QWidget::addAction;
-#endif
-
QAction *addAction(const QString &text);
QAction *addAction(const QIcon &icon, const QString &text);
QAction *addAction(const QString &text, const QObject *receiver, const char* member);
@@ -135,10 +129,10 @@ Q_SIGNALS:
void visibilityChanged(bool visible);
protected:
- void actionEvent(QActionEvent *event);
- void changeEvent(QEvent *event);
- void paintEvent(QPaintEvent *event);
- bool event(QEvent *event);
+ void actionEvent(QActionEvent *event) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionToolBar *option) const;
diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h
index 07e3301ed7..6625419d87 100644
--- a/src/widgets/widgets/qtoolbarextension_p.h
+++ b/src/widgets/widgets/qtoolbarextension_p.h
@@ -58,8 +58,8 @@ class Q_AUTOTEST_EXPORT QToolBarExtension : public QToolButton
public:
explicit QToolBarExtension(QWidget *parent);
- void paintEvent(QPaintEvent *);
- QSize sizeHint() const;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
public Q_SLOTS:
void setOrientation(Qt::Orientation o);
diff --git a/src/widgets/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h
index 47857d6802..4cedd2b37a 100644
--- a/src/widgets/widgets/qtoolbarlayout_p.h
+++ b/src/widgets/widgets/qtoolbarlayout_p.h
@@ -61,7 +61,7 @@ class QToolBarItem : public QWidgetItem
{
public:
QToolBarItem(QWidget *widget);
- bool isEmpty() const;
+ bool isEmpty() const Q_DECL_OVERRIDE;
QAction *action;
bool customWidget;
@@ -75,22 +75,22 @@ public:
QToolBarLayout(QWidget *parent = 0);
~QToolBarLayout();
- void addItem(QLayoutItem *item);
- QLayoutItem *itemAt(int index) const;
- QLayoutItem *takeAt(int index);
- int count() const;
+ void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
+ QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
+ QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
+ int count() const Q_DECL_OVERRIDE;
- bool isEmpty() const;
- void invalidate();
- Qt::Orientations expandingDirections() const;
+ bool isEmpty() const Q_DECL_OVERRIDE;
+ void invalidate() Q_DECL_OVERRIDE;
+ Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
- void setGeometry(const QRect &r);
- QSize minimumSize() const;
- QSize sizeHint() const;
+ void setGeometry(const QRect &r) Q_DECL_OVERRIDE;
+ QSize minimumSize() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
void insertAction(int index, QAction *action);
int indexOf(QAction *action) const;
- int indexOf(QWidget *widget) const { return QLayout::indexOf(widget); }
+ int indexOf(QWidget *widget) const Q_DECL_OVERRIDE { return QLayout::indexOf(widget); }
bool layoutActions(const QSize &size);
QSize expandedSize(const QSize &size) const;
diff --git a/src/widgets/widgets/qtoolbarseparator_p.h b/src/widgets/widgets/qtoolbarseparator_p.h
index 3ac46db482..b3f862cefa 100644
--- a/src/widgets/widgets/qtoolbarseparator_p.h
+++ b/src/widgets/widgets/qtoolbarseparator_p.h
@@ -64,9 +64,9 @@ public:
Qt::Orientation orientation() const;
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOption *option) const;
public Q_SLOTS:
diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp
index 518b975b51..83a158e59e 100644
--- a/src/widgets/widgets/qtoolbox.cpp
+++ b/src/widgets/widgets/qtoolbox.cpp
@@ -65,12 +65,12 @@ public:
inline void setSelected(bool b) { selected = b; update(); }
inline void setIndex(int newIndex) { indexInPage = newIndex; }
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
protected:
void initStyleOption(QStyleOptionToolBox *opt) const;
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
private:
bool selected;
diff --git a/src/widgets/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h
index 1ea276e8ab..40bbce7d44 100644
--- a/src/widgets/widgets/qtoolbox.h
+++ b/src/widgets/widgets/qtoolbox.h
@@ -89,11 +89,11 @@ Q_SIGNALS:
void currentChanged(int index);
protected:
- bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
virtual void itemInserted(int index);
virtual void itemRemoved(int index);
- void showEvent(QShowEvent *e);
- void changeEvent(QEvent *);
+ void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
private:
diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h
index 922ea09abd..5301a8b22b 100644
--- a/src/widgets/widgets/qtoolbutton.h
+++ b/src/widgets/widgets/qtoolbutton.h
@@ -66,8 +66,8 @@ public:
explicit QToolButton(QWidget * parent=0);
~QToolButton();
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
Qt::ToolButtonStyle toolButtonStyle() const;
@@ -98,19 +98,19 @@ Q_SIGNALS:
void triggered(QAction *);
protected:
- bool event(QEvent *e);
- void mousePressEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
- void paintEvent(QPaintEvent *);
- void actionEvent(QActionEvent *);
-
- void enterEvent(QEvent *);
- void leaveEvent(QEvent *);
- void timerEvent(QTimerEvent *);
- void changeEvent(QEvent *);
-
- bool hitButton(const QPoint &pos) const;
- void nextCheckState();
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void actionEvent(QActionEvent *) Q_DECL_OVERRIDE;
+
+ void enterEvent(QEvent *) Q_DECL_OVERRIDE;
+ void leaveEvent(QEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+
+ bool hitButton(const QPoint &pos) const Q_DECL_OVERRIDE;
+ void nextCheckState() Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionToolButton *option) const;
private:
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index 49d9413fc0..1baceb9cc2 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -532,7 +532,7 @@ Q_SIGNALS:
void editFocusChange(bool);
#endif
protected:
- virtual void timerEvent(QTimerEvent *event);
+ virtual void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
private Q_SLOTS:
void _q_clipboardChanged();
diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h
index 5b165aa7be..5c9bb50bd4 100644
--- a/src/widgets/widgets/qwidgetresizehandler_p.h
+++ b/src/widgets/widgets/qwidgetresizehandler_p.h
@@ -88,7 +88,7 @@ Q_SIGNALS:
void activate();
protected:
- bool eventFilter(QObject *o, QEvent *e);
+ bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 8c48533a03..eabaa160a0 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -1312,8 +1312,10 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e)
else if (e == QKeySequence::Delete) {
QTextCursor localCursor = cursor;
localCursor.deleteChar();
- }
- else if (e == QKeySequence::DeleteEndOfWord) {
+ } else if (e == QKeySequence::Backspace) {
+ QTextCursor localCursor = cursor;
+ localCursor.deletePreviousChar();
+ }else if (e == QKeySequence::DeleteEndOfWord) {
if (!cursor.hasSelection())
cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);
cursor.removeSelectedText();
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index 949201e8a8..79f4e404a2 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -242,9 +242,9 @@ public:
bool findNextPrevAnchor(const QTextCursor& from, bool next, QTextCursor& newAnchor);
protected:
- virtual void timerEvent(QTimerEvent *e);
+ virtual void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
- virtual bool event(QEvent *e);
+ virtual bool event(QEvent *e) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QWidgetTextControl)
@@ -280,9 +280,9 @@ class QTextEditMimeData : public QMimeData
public:
inline QTextEditMimeData(const QTextDocumentFragment &aFragment) : fragment(aFragment) {}
- virtual QStringList formats() const;
+ virtual QStringList formats() const Q_DECL_OVERRIDE;
protected:
- virtual QVariant retrieveData(const QString &mimeType, QVariant::Type type) const;
+ virtual QVariant retrieveData(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE;
private:
void setup() const;