diff options
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 184 | ||||
-rw-r--r-- | src/widgets/dialogs/qcolordialog.h | 10 | ||||
-rw-r--r-- | src/widgets/dialogs/qcolordialog_p.h | 7 | ||||
-rw-r--r-- | src/widgets/dialogs/qerrormessage.cpp | 4 | ||||
-rw-r--r-- | src/widgets/dialogs/qerrormessage.h | 4 | ||||
-rw-r--r-- | src/widgets/dialogs/qfiledialog.h | 14 | ||||
-rw-r--r-- | src/widgets/dialogs/qfiledialog_p.h | 22 | ||||
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel.h | 36 | ||||
-rw-r--r-- | src/widgets/dialogs/qfontdialog.cpp | 2 | ||||
-rw-r--r-- | src/widgets/dialogs/qfontdialog.h | 14 | ||||
-rw-r--r-- | src/widgets/dialogs/qfontdialog_p.h | 6 | ||||
-rw-r--r-- | src/widgets/dialogs/qfscompleter_p.h | 4 | ||||
-rw-r--r-- | src/widgets/dialogs/qinputdialog.cpp | 8 | ||||
-rw-r--r-- | src/widgets/dialogs/qinputdialog.h | 14 | ||||
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 10 | ||||
-rw-r--r-- | src/widgets/dialogs/qmessagebox.h | 18 | ||||
-rw-r--r-- | src/widgets/dialogs/qprogressdialog.cpp | 16 | ||||
-rw-r--r-- | src/widgets/dialogs/qprogressdialog.h | 16 | ||||
-rw-r--r-- | src/widgets/dialogs/qsidebar_p.h | 20 | ||||
-rw-r--r-- | src/widgets/dialogs/qwizard.cpp | 4 | ||||
-rw-r--r-- | src/widgets/dialogs/qwizard.h | 12 |
21 files changed, 170 insertions, 255 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index b133c49b5e..5fffe61877 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -84,7 +84,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); @@ -137,12 +137,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) @@ -514,15 +514,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: @@ -636,11 +636,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; @@ -673,9 +673,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 @@ -995,14 +995,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: @@ -1119,10 +1119,7 @@ QColorShower::QColorShower(QColorDialog *parent) #if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lab, 0, 0, -1, 1); #else - if (nonTouchUI) - gl->addWidget(lab, 0, 0, 1, -1); - else - gl->addWidget(lab, 0, 0, -1, 1); + gl->addWidget(lab, 0, 0, 1, -1); #endif connect(lab, SIGNAL(colorDropped(QRgb)), this, SIGNAL(newCol(QRgb))); connect(lab, SIGNAL(colorDropped(QRgb)), this, SLOT(setRgb(QRgb))); @@ -1138,13 +1135,8 @@ QColorShower::QColorShower(QColorDialog *parent) gl->addWidget(lblHue, 0, 1); gl->addWidget(hEd, 0, 2); #else - if (nonTouchUI) { - gl->addWidget(lblHue, 1, 0); - gl->addWidget(hEd, 2, 0); - } else { - lblHue->hide(); - hEd->hide(); - } + gl->addWidget(lblHue, 1, 0); + gl->addWidget(hEd, 2, 0); #endif sEd = new QColSpinBox(this); @@ -1157,13 +1149,8 @@ QColorShower::QColorShower(QColorDialog *parent) gl->addWidget(lblSat, 1, 1); gl->addWidget(sEd, 1, 2); #else - if (nonTouchUI) { - gl->addWidget(lblSat, 1, 1); - gl->addWidget(sEd, 2, 1); - } else { - lblSat->hide(); - sEd->hide(); - } + gl->addWidget(lblSat, 1, 1); + gl->addWidget(sEd, 2, 1); #endif vEd = new QColSpinBox(this); @@ -1176,13 +1163,8 @@ QColorShower::QColorShower(QColorDialog *parent) gl->addWidget(lblVal, 2, 1); gl->addWidget(vEd, 2, 2); #else - if (nonTouchUI) { - gl->addWidget(lblVal, 1, 2); - gl->addWidget(vEd, 2, 2); - } else { - lblVal->hide(); - vEd->hide(); - } + gl->addWidget(lblVal, 1, 2); + gl->addWidget(vEd, 2, 2); #endif rEd = new QColSpinBox(this); @@ -1195,13 +1177,8 @@ QColorShower::QColorShower(QColorDialog *parent) gl->addWidget(lblRed, 0, 3); gl->addWidget(rEd, 0, 4); #else - if (nonTouchUI) { - gl->addWidget(lblRed, 3, 0); - gl->addWidget(rEd, 4, 0); - } else { - lblRed->hide(); - rEd->hide(); - } + gl->addWidget(lblRed, 3, 0); + gl->addWidget(rEd, 4, 0); #endif gEd = new QColSpinBox(this); @@ -1214,13 +1191,8 @@ QColorShower::QColorShower(QColorDialog *parent) gl->addWidget(lblGreen, 1, 3); gl->addWidget(gEd, 1, 4); #else - if (nonTouchUI) { - gl->addWidget(lblGreen, 3, 1); - gl->addWidget(gEd, 4, 1); - } else { - lblGreen->hide(); - gEd->hide(); - } + gl->addWidget(lblGreen, 3, 1); + gl->addWidget(gEd, 4, 1); #endif bEd = new QColSpinBox(this); @@ -1233,13 +1205,8 @@ QColorShower::QColorShower(QColorDialog *parent) gl->addWidget(lblBlue, 2, 3); gl->addWidget(bEd, 2, 4); #else - if (nonTouchUI) { - gl->addWidget(lblBlue, 3, 2); - gl->addWidget(bEd, 4, 2); - } else { - lblBlue->hide(); - bEd->hide(); - } + gl->addWidget(lblBlue, 3, 2); + gl->addWidget(bEd, 4, 2); #endif alphaEd = new QColSpinBox(this); @@ -1252,13 +1219,8 @@ QColorShower::QColorShower(QColorDialog *parent) gl->addWidget(alphaLab, 3, 1, 1, 3); gl->addWidget(alphaEd, 3, 4); #else - if (nonTouchUI) { - gl->addWidget(alphaLab, 1, 3, 3, 1); - gl->addWidget(alphaEd, 4, 3); - } else { - alphaLab->hide(); - alphaEd->hide(); - } + gl->addWidget(alphaLab, 1, 3, 3, 1); + gl->addWidget(alphaEd, 4, 3); #endif alphaEd->hide(); alphaLab->hide(); @@ -1598,11 +1560,16 @@ void QColorDialogPrivate::_q_pickScreenColor() buttons->setDisabled(true); screenColorPickerButton->setDisabled(true); - q->setCurrentColor(grabScreenColor(QCursor::pos())); - lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel") - .arg(QCursor::pos().x()) - .arg(QCursor::pos().y()) - .arg(q->currentColor().name())); + const QPoint globalPos = QCursor::pos(); + q->setCurrentColor(grabScreenColor(globalPos)); + updateColorLabelText(globalPos); +} + +void QColorDialogPrivate::updateColorLabelText(const QPoint &globalPos) +{ + lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2\nPress ESC to cancel") + .arg(globalPos.x()) + .arg(globalPos.y())); } void QColorDialogPrivate::releaseColorPicking() @@ -1674,9 +1641,7 @@ void QColorDialogPrivate::initWidgets() if (!smallDisplay) { leftLay = new QVBoxLayout; topLay->addLayout(leftLay); - } - if (!smallDisplay) { standard = new QColorWell(q, standardColorRows, colorColumns, QColorDialogOptions::standardColors()); lblBasicColors = new QLabel(q); #ifndef QT_NO_SHORTCUT @@ -1688,7 +1653,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); @@ -1743,12 +1708,7 @@ void QColorDialogPrivate::initWidgets() cp->setFrameStyle(QFrame::Panel + QFrame::Sunken); #if defined(QT_SMALL_COLORDIALOG) - if (!nonTouchUI) { - pickLay->addWidget(cp); - cLay->addSpacing(lumSpace); - } else { - cp->hide(); - } + cp->hide(); #else cLay->addSpacing(lumSpace); cLay->addWidget(cp); @@ -1757,15 +1717,7 @@ void QColorDialogPrivate::initWidgets() lp = new QColorLuminancePicker(q); #if defined(QT_SMALL_COLORDIALOG) - QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); - const int minDimension = qMin(screenSize.height(), screenSize.width()); - //set picker to be finger-usable - int pickerWidth = !nonTouchUI ? minDimension/9 : minDimension/12; - lp->setFixedWidth(pickerWidth); - if (!nonTouchUI) - pickLay->addWidget(lp); - else - lp->hide(); + lp->hide(); #else lp->setFixedWidth(20); pickLay->addSpacing(10); @@ -1784,12 +1736,11 @@ void QColorDialogPrivate::initWidgets() QObject::connect(cs, SIGNAL(currentColorChanged(QColor)), q, SIGNAL(currentColorChanged(QColor))); #if defined(QT_SMALL_COLORDIALOG) - if (!nonTouchUI) - pWidth -= cp->size().width(); topLay->addWidget(cs); #else rightLay->addWidget(cs); - leftLay->addSpacing(cs->gl->margin()); + if (leftLay) + leftLay->addSpacing(cs->gl->margin()); #endif buttons = new QDialogButtonBox(q); @@ -1835,6 +1786,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(); @@ -2137,16 +2089,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 @@ -2244,8 +2186,8 @@ void QColorDialogPrivate::updateColorPicking(const QPoint &globalPos) // QTBUG-39792, do not change standard, custom color selectors while moving as // otherwise it is not possible to pre-select a custom cell for assignment. setCurrentColor(color, ShowColor); - lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel") - .arg(globalPos.x()).arg(globalPos.y()).arg(color.name())); + updateColorLabelText(globalPos); + } bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e) diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index b06da2ab13..87e62be81f 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 9182b510f1..cf8bb33d94 100644 --- a/src/widgets/dialogs/qcolordialog_p.h +++ b/src/widgets/dialogs/qcolordialog_p.h @@ -111,13 +111,14 @@ public: void _q_newStandard(int, int); void _q_pickScreenColor(); void _q_updateColorPicking(); + void updateColorLabelText(const QPoint &); void updateColorPicking(const QPoint &pos); void releaseColorPicking(); bool handleColorPickingMouseMove(QMouseEvent *e); bool handleColorPickingMouseButtonRelease(QMouseEvent *e); bool handleColorPickingKeyPress(QKeyEvent *e); - bool canBeNativeDialog() const; + bool canBeNativeDialog() const Q_DECL_OVERRIDE; QWellArray *custom; QWellArray *standard; @@ -167,8 +168,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 ¤t, const QModelIndex &previous) { + void currentChanged(const QModelIndex ¤t, 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.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 371949e768..3f178189b9 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -65,6 +65,7 @@ public: QProgressDialogPrivate() : label(0), cancel(0), bar(0), shown_once(false), cancellation_flag(false), + setValue_called(false), showTime(defaultShowTime), #ifndef QT_NO_SHORTCUT escapeShortcut(0), @@ -87,6 +88,7 @@ public: QTimer *forceTimer; bool shown_once; bool cancellation_flag; + bool setValue_called; QElapsedTimer starttime; #ifndef QT_NO_CURSOR QCursor parentCursor; @@ -123,6 +125,8 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance } else { q->setCancelButtonText(cancelText); } + starttime.start(); + forceTimer->start(showTime); } void QProgressDialogPrivate::layout() @@ -598,6 +602,7 @@ void QProgressDialog::reset() d->bar->reset(); d->cancellation_flag = false; d->shown_once = false; + d->setValue_called = false; d->forceTimer->stop(); /* @@ -636,7 +641,7 @@ int QProgressDialog::value() const \brief the current amount of progress made. For the progress dialog to work as expected, you should initially set - this property to 0 and finally set it to + this property to QProgressDialog::minimum() and finally set it to QProgressDialog::maximum(); you can call setValue() any number of times in-between. @@ -651,8 +656,7 @@ int QProgressDialog::value() const void QProgressDialog::setValue(int progress) { Q_D(QProgressDialog); - if (progress == d->bar->value() - || (d->bar->value() == -1 && progress == d->bar->maximum())) + if (d->setValue_called && progress == d->bar->value()) return; d->bar->setValue(progress); @@ -661,11 +665,13 @@ void QProgressDialog::setValue(int progress) if (isModal()) QApplication::processEvents(); } else { - if (progress == 0) { + if ((!d->setValue_called && progress == 0 /* for compat with Qt < 5.4 */) || progress == minimum()) { d->starttime.start(); d->forceTimer->start(d->showTime); + d->setValue_called = true; return; } else { + d->setValue_called = true; bool need_show; int elapsed = d->starttime.elapsed(); if (elapsed >= d->showTime) { @@ -759,7 +765,7 @@ void QProgressDialog::setMinimumDuration(int ms) { Q_D(QProgressDialog); d->showTime = ms; - if (d->bar->value() == 0) { + if (d->bar->value() == d->bar->minimum()) { d->forceTimer->stop(); d->forceTimer->start(ms); } 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); |