Remove dead code from src/widgets

Code that's removed via QT_VERSION(6, 0, 0) check is already no
longer compiled.

Change-Id: I70865f330a6260ac2e9cf2770d599a5b6f7bb7d4
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-05-07 09:30:16 +02:00
parent 219e7bafa2
commit 90210c8d28
33 changed files with 14 additions and 268 deletions

View File

@ -3232,11 +3232,7 @@ void QWizard::paintEvent(QPaintEvent * event)
/*! /*!
\reimp \reimp
*/ */
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QWizard::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) bool QWizard::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
# else
bool QWizard::nativeEvent(const QByteArray &eventType, void *message, long *result)
# endif
{ {
#if QT_CONFIG(style_windowsvista) #if QT_CONFIG(style_windowsvista)
Q_D(QWizard); Q_D(QWizard);

View File

@ -188,11 +188,7 @@ protected:
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override; void paintEvent(QPaintEvent *event) override;
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC) #if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override; bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
# else
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
# endif
#endif #endif
void done(int result) override; void done(int result) override;
virtual void initializePage(int id); virtual void initializePage(int id);

View File

@ -339,11 +339,7 @@ void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
SetWindowThemeAttribute(handle, WTA_NONCLIENT, &opt, sizeof(WTA_OPTIONS)); SetWindowThemeAttribute(handle, WTA_NONCLIENT, &opt, sizeof(WTA_OPTIONS));
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QVistaHelper::winEvent(MSG* msg, qintptr *result) bool QVistaHelper::winEvent(MSG* msg, qintptr *result)
#else
bool QVistaHelper::winEvent(MSG* msg, long* result)
#endif
{ {
switch (msg->message) { switch (msg->message) {
case WM_NCHITTEST: { case WM_NCHITTEST: {
@ -405,11 +401,7 @@ void QVistaHelper::mouseEvent(QEvent *event)
} }
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QVistaHelper::handleWinEvent(MSG *message, qintptr *result) bool QVistaHelper::handleWinEvent(MSG *message, qintptr *result)
#else
bool QVistaHelper::handleWinEvent(MSG *message, long *result)
#endif
{ {
if (message->message == WM_THEMECHANGED || message->message == WM_DWMCOMPOSITIONCHANGED) if (message->message == WM_THEMECHANGED || message->message == WM_DWMCOMPOSITIONCHANGED)
cachedVistaState = Dirty; cachedVistaState = Dirty;
@ -517,11 +509,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
if (event->type() == QEvent::MouseMove) { if (event->type() == QEvent::MouseMove) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
qintptr result; qintptr result;
#else
long result;
#endif
MSG msg; MSG msg;
msg.message = WM_NCHITTEST; msg.message = WM_NCHITTEST;
msg.wParam = 0; msg.wParam = 0;
@ -535,11 +523,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
if (mouseEvent->button() == Qt::LeftButton) { if (mouseEvent->button() == Qt::LeftButton) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
qintptr result; qintptr result;
#else
long result;
#endif
MSG msg; MSG msg;
msg.message = WM_NCHITTEST; msg.message = WM_NCHITTEST;
msg.wParam = 0; msg.wParam = 0;
@ -554,11 +538,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
if (mouseEvent->button() == Qt::LeftButton) { if (mouseEvent->button() == Qt::LeftButton) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
qintptr result; qintptr result;
#else
long result;
#endif
MSG msg; MSG msg;
msg.message = WM_NCHITTEST; msg.message = WM_NCHITTEST;
msg.wParam = 0; msg.wParam = 0;

View File

@ -93,11 +93,7 @@ public:
bool setDWMTitleBar(TitleBarChangeType type); bool setDWMTitleBar(TitleBarChangeType type);
void setTitleBarIconAndCaptionVisible(bool visible); void setTitleBarIconAndCaptionVisible(bool visible);
void mouseEvent(QEvent *event); void mouseEvent(QEvent *event);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool handleWinEvent(MSG *message, qintptr *result); bool handleWinEvent(MSG *message, qintptr *result);
#else
bool handleWinEvent(MSG *message, long *result);
#endif
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
QVistaBackButton *backButton() const { return backButton_; } QVistaBackButton *backButton() const { return backButton_; }
@ -136,11 +132,7 @@ private:
void drawTitleBar(QPainter *painter); void drawTitleBar(QPainter *painter);
void setMouseCursor(QPoint pos); void setMouseCursor(QPoint pos);
void collapseTopFrameStrut(); void collapseTopFrameStrut();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool winEvent(MSG *message, qintptr *result); bool winEvent(MSG *message, qintptr *result);
#else
bool winEvent(MSG *message, long *result);
#endif
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);

View File

@ -2006,11 +2006,7 @@ void QGraphicsWidget::addAction(QAction *action)
\sa removeAction(), QMenu, addAction(), QWidget::addActions() \sa removeAction(), QMenu, addAction(), QWidget::addActions()
*/ */
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void QGraphicsWidget::addActions(const QList<QAction *> &actions) void QGraphicsWidget::addActions(const QList<QAction *> &actions)
#else
void QGraphicsWidget::addActions(QList<QAction *> actions)
#endif
{ {
for (int i = 0; i < actions.count(); ++i) for (int i = 0; i < actions.count(); ++i)
insertAction(nullptr, actions.at(i)); insertAction(nullptr, actions.at(i));
@ -2067,11 +2063,7 @@ void QGraphicsWidget::insertAction(QAction *before, QAction *action)
\sa removeAction(), QMenu, insertAction(), QWidget::insertActions() \sa removeAction(), QMenu, insertAction(), QWidget::insertActions()
*/ */
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void QGraphicsWidget::insertActions(QAction *before, const QList<QAction *> &actions) void QGraphicsWidget::insertActions(QAction *before, const QList<QAction *> &actions)
#else
void QGraphicsWidget::insertActions(QAction *before, QList<QAction *> actions)
#endif
{ {
for (int i = 0; i < actions.count(); ++i) for (int i = 0; i < actions.count(); ++i)
insertAction(before, actions.at(i)); insertAction(before, actions.at(i));

View File

@ -148,13 +148,8 @@ public:
#ifndef QT_NO_ACTION #ifndef QT_NO_ACTION
//actions //actions
void addAction(QAction *action); void addAction(QAction *action);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void addActions(const QList<QAction*> &actions); void addActions(const QList<QAction*> &actions);
void insertActions(QAction *before, const QList<QAction*> &actions); void insertActions(QAction *before, const QList<QAction*> &actions);
#else
void addActions(QList<QAction*> actions);
void insertActions(QAction *before, QList<QAction*> actions);
#endif
void insertAction(QAction *before, QAction *action); void insertAction(QAction *before, QAction *action);
void removeAction(QAction *action); void removeAction(QAction *action);
QList<QAction*> actions() const; QList<QAction*> actions() const;

View File

@ -100,9 +100,7 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override; bool setData(const QModelIndex &index, const QVariant &value, int role) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool clearItemData(const QModelIndex &index) override; bool clearItemData(const QModelIndex &index) override;
#endif
QMap<int, QVariant> itemData(const QModelIndex &index) const override; QMap<int, QVariant> itemData(const QModelIndex &index) const override;

View File

@ -480,7 +480,6 @@ bool QTableModel::setItemData(const QModelIndex &index, const QMap<int, QVariant
return true; return true;
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QTableModel::clearItemData(const QModelIndex &index) bool QTableModel::clearItemData(const QModelIndex &index)
{ {
if (!checkIndex(index, CheckIndexOption::IndexIsValid)) if (!checkIndex(index, CheckIndexOption::IndexIsValid))
@ -496,7 +495,6 @@ bool QTableModel::clearItemData(const QModelIndex &index)
emit dataChanged(index, index, QVector<int>{}); emit dataChanged(index, index, QVector<int>{});
return true; return true;
} }
#endif
Qt::ItemFlags QTableModel::flags(const QModelIndex &index) const Qt::ItemFlags QTableModel::flags(const QModelIndex &index) const
{ {
@ -2582,11 +2580,7 @@ QStringList QTableWidget::mimeTypes() const
If the list of items is empty, \nullptr is returned rather than a If the list of items is empty, \nullptr is returned rather than a
serialized empty list. serialized empty list.
*/ */
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
QMimeData *QTableWidget::mimeData(const QList<QTableWidgetItem *> &items) const QMimeData *QTableWidget::mimeData(const QList<QTableWidgetItem *> &items) const
#else
QMimeData *QTableWidget::mimeData(const QList<QTableWidgetItem*> items) const
#endif
{ {
Q_D(const QTableWidget); Q_D(const QTableWidget);
@ -2665,18 +2659,6 @@ QModelIndex QTableWidget::indexFromItem(const QTableWidgetItem *item) const
return d->tableModel()->index(item); return d->tableModel()->index(item);
} }
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/*!
\internal
\obsolete
\overload
*/
QModelIndex QTableWidget::indexFromItem(QTableWidgetItem *item) const
{
return indexFromItem(const_cast<const QTableWidgetItem *>(item));
}
#endif
/*! /*!
Returns a pointer to the QTableWidgetItem associated with the given \a index. Returns a pointer to the QTableWidgetItem associated with the given \a index.
*/ */

View File

@ -231,6 +231,9 @@ public:
QTableWidgetItem *item(int row, int column) const; QTableWidgetItem *item(int row, int column) const;
void setItem(int row, int column, QTableWidgetItem *item); void setItem(int row, int column, QTableWidgetItem *item);
QTableWidgetItem *takeItem(int row, int column); QTableWidgetItem *takeItem(int row, int column);
QList<QTableWidgetItem*> items(const QMimeData *data) const;
QModelIndex indexFromItem(const QTableWidgetItem *item) const;
QTableWidgetItem *itemFromIndex(const QModelIndex &index) const;
QTableWidgetItem *verticalHeaderItem(int row) const; QTableWidgetItem *verticalHeaderItem(int row) const;
void setVerticalHeaderItem(int row, QTableWidgetItem *item); void setVerticalHeaderItem(int row, QTableWidgetItem *item);
@ -315,27 +318,10 @@ Q_SIGNALS:
protected: protected:
bool event(QEvent *e) override; bool event(QEvent *e) override;
virtual QStringList mimeTypes() const; virtual QStringList mimeTypes() const;
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
virtual QMimeData *mimeData(const QList<QTableWidgetItem *> &items) const; virtual QMimeData *mimeData(const QList<QTableWidgetItem *> &items) const;
#else
virtual QMimeData *mimeData(const QList<QTableWidgetItem*> items) const;
#endif
virtual bool dropMimeData(int row, int column, const QMimeData *data, Qt::DropAction action); virtual bool dropMimeData(int row, int column, const QMimeData *data, Qt::DropAction action);
virtual Qt::DropActions supportedDropActions() const; virtual Qt::DropActions supportedDropActions() const;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
public:
#else
protected:
#endif
QList<QTableWidgetItem*> items(const QMimeData *data) const;
QModelIndex indexFromItem(const QTableWidgetItem *item) const;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QModelIndex indexFromItem(QTableWidgetItem *item) const; // ### Qt 6: remove
#endif
QTableWidgetItem *itemFromIndex(const QModelIndex &index) const;
protected: protected:
#if QT_CONFIG(draganddrop) #if QT_CONFIG(draganddrop)
void dropEvent(QDropEvent *event) override; void dropEvent(QDropEvent *event) override;

View File

@ -129,9 +129,7 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override; bool setData(const QModelIndex &index, const QVariant &value, int role) override;
bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override; bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool clearItemData(const QModelIndex &index) override; bool clearItemData(const QModelIndex &index) override;
#endif
QMap<int, QVariant> itemData(const QModelIndex &index) const override; QMap<int, QVariant> itemData(const QModelIndex &index) const override;

View File

@ -392,7 +392,6 @@ bool QTreeModel::setData(const QModelIndex &index, const QVariant &value, int ro
return false; return false;
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QTreeModel::clearItemData(const QModelIndex &index) bool QTreeModel::clearItemData(const QModelIndex &index)
{ {
if (!checkIndex(index, CheckIndexOption::IndexIsValid)) if (!checkIndex(index, CheckIndexOption::IndexIsValid))
@ -411,7 +410,6 @@ bool QTreeModel::clearItemData(const QModelIndex &index)
emit dataChanged(index, index, QVector<int>{}); emit dataChanged(index, index, QVector<int>{});
return true; return true;
} }
#endif
QMap<int, QVariant> QTreeModel::itemData(const QModelIndex &index) const QMap<int, QVariant> QTreeModel::itemData(const QModelIndex &index) const
{ {
@ -3257,11 +3255,7 @@ QStringList QTreeWidget::mimeTypes() const
If the list of items is empty, \nullptr is returned rather than a If the list of items is empty, \nullptr is returned rather than a
serialized empty list. serialized empty list.
*/ */
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem *> &items) const QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem *> &items) const
#else
QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
#endif
{ {
Q_D(const QTreeWidget); Q_D(const QTreeWidget);
if (d->treeModel()->cachedIndexes.isEmpty()) { if (d->treeModel()->cachedIndexes.isEmpty()) {
@ -3339,17 +3333,6 @@ QModelIndex QTreeWidget::indexFromItem(const QTreeWidgetItem *item, int column)
return d->index(item, column); return d->index(item, column);
} }
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/*!
\overload
\internal
*/
QModelIndex QTreeWidget::indexFromItem(QTreeWidgetItem *item, int column) const
{
return indexFromItem(const_cast<const QTreeWidgetItem *>(item), column);
}
#endif
/*! /*!
Returns a pointer to the QTreeWidgetItem associated with the given \a index. Returns a pointer to the QTreeWidgetItem associated with the given \a index.

View File

@ -303,6 +303,10 @@ public:
QTreeWidgetItem *itemAbove(const QTreeWidgetItem *item) const; QTreeWidgetItem *itemAbove(const QTreeWidgetItem *item) const;
QTreeWidgetItem *itemBelow(const QTreeWidgetItem *item) const; QTreeWidgetItem *itemBelow(const QTreeWidgetItem *item) const;
QList<QTreeWidgetItem*> items(const QMimeData *data) const;
QModelIndex indexFromItem(const QTreeWidgetItem *item, int column = 0) const;
QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const;
void setSelectionModel(QItemSelectionModel *selectionModel) override; void setSelectionModel(QItemSelectionModel *selectionModel) override;
@ -329,29 +333,11 @@ Q_SIGNALS:
protected: protected:
bool event(QEvent *e) override; bool event(QEvent *e) override;
virtual QStringList mimeTypes() const; virtual QStringList mimeTypes() const;
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
virtual QMimeData *mimeData(const QList<QTreeWidgetItem *> &items) const; virtual QMimeData *mimeData(const QList<QTreeWidgetItem *> &items) const;
#else
virtual QMimeData *mimeData(const QList<QTreeWidgetItem*> items) const;
#endif
virtual bool dropMimeData(QTreeWidgetItem *parent, int index, virtual bool dropMimeData(QTreeWidgetItem *parent, int index,
const QMimeData *data, Qt::DropAction action); const QMimeData *data, Qt::DropAction action);
virtual Qt::DropActions supportedDropActions() const; virtual Qt::DropActions supportedDropActions() const;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
public:
#else
protected:
#endif
QList<QTreeWidgetItem*> items(const QMimeData *data) const;
QModelIndex indexFromItem(const QTreeWidgetItem *item, int column = 0) const;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const; // ### Qt 6: remove
#endif
QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const;
protected:
#if QT_CONFIG(draganddrop) #if QT_CONFIG(draganddrop)
void dropEvent(QDropEvent *event) override; void dropEvent(QDropEvent *event) override;
#endif #endif

View File

@ -99,9 +99,7 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override; bool setData(const QModelIndex &index, const QVariant &value, int role) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool clearItemData(const QModelIndex &index) override; bool clearItemData(const QModelIndex &index) override;
#endif
QMap<int, QVariant> itemData(const QModelIndex &index) const override; QMap<int, QVariant> itemData(const QModelIndex &index) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override;

View File

@ -376,11 +376,7 @@ Q_WIDGETS_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSize
Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidgetItem *i) Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidgetItem *i)
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *w = const_cast<QWidgetItem *>(i)->widget();
#else
QWidget *w = i->widget(); QWidget *w = i->widget();
#endif
return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(),
w->minimumSize(), w->maximumSize(), w->minimumSize(), w->maximumSize(),
w->sizePolicy()); w->sizePolicy());
@ -418,11 +414,7 @@ Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QSize &sizeHint,
Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align) Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align)
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *w = const_cast<QWidgetItem *>(i)->widget();
#else
QWidget *w = i->widget(); QWidget *w = i->widget();
#endif
return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(),
w->sizePolicy(), align); w->sizePolicy(), align);
} }

View File

@ -360,11 +360,7 @@ QSpacerItem * QSpacerItem::spacerItem()
\sa layout(), spacerItem() \sa layout(), spacerItem()
*/ */
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *QLayoutItem::widget()
#else
QWidget *QLayoutItem::widget() const QWidget *QLayoutItem::widget() const
#endif
{ {
return nullptr; return nullptr;
} }
@ -372,11 +368,7 @@ QWidget *QLayoutItem::widget() const
/*! /*!
Returns the widget managed by this item. Returns the widget managed by this item.
*/ */
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *QWidgetItem::widget()
#else
QWidget *QWidgetItem::widget() const QWidget *QWidgetItem::widget() const
#endif
{ {
return wid; return wid;
} }

View File

@ -74,11 +74,7 @@ public:
virtual int minimumHeightForWidth(int) const; virtual int minimumHeightForWidth(int) const;
virtual void invalidate(); virtual void invalidate();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
virtual QWidget *widget();
#else
virtual QWidget *widget() const; virtual QWidget *widget() const;
#endif
virtual QLayout *layout(); virtual QLayout *layout();
virtual QSpacerItem *spacerItem(); virtual QSpacerItem *spacerItem();
@ -137,11 +133,7 @@ public:
bool isEmpty() const override; bool isEmpty() const override;
void setGeometry(const QRect&) override; void setGeometry(const QRect&) override;
QRect geometry() const override; QRect geometry() const override;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *widget() override;
#else
QWidget *widget() const override; QWidget *widget() const override;
#endif
bool hasHeightForWidth() const override; bool hasHeightForWidth() const override;
int heightForWidth(int) const override; int heightForWidth(int) const override;

View File

@ -224,12 +224,8 @@ private:
quint32 data; quint32 data;
}; };
}; };
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
// Can't add in Qt 5, as QList<QSizePolicy> would be BiC:
Q_DECLARE_TYPEINFO(QSizePolicy, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QSizePolicy, Q_PRIMITIVE_TYPE);
#else
Q_DECLARE_TYPEINFO(QSizePolicy, Q_RELOCATABLE_TYPE);
#endif
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes) Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)

View File

@ -3097,11 +3097,7 @@ void QWidget::addAction(QAction *action)
\sa removeAction(), QMenu, addAction() \sa removeAction(), QMenu, addAction()
*/ */
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void QWidget::addActions(const QList<QAction *> &actions) void QWidget::addActions(const QList<QAction *> &actions)
#else
void QWidget::addActions(QList<QAction*> actions)
#endif
{ {
for(int i = 0; i < actions.count(); i++) for(int i = 0; i < actions.count(); i++)
insertAction(nullptr, actions.at(i)); insertAction(nullptr, actions.at(i));
@ -3150,11 +3146,7 @@ void QWidget::insertAction(QAction *before, QAction *action)
\sa removeAction(), QMenu, insertAction(), contextMenuPolicy \sa removeAction(), QMenu, insertAction(), contextMenuPolicy
*/ */
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void QWidget::insertActions(QAction *before, const QList<QAction*> &actions) void QWidget::insertActions(QAction *before, const QList<QAction*> &actions)
#else
void QWidget::insertActions(QAction *before, QList<QAction*> actions)
#endif
{ {
for(int i = 0; i < actions.count(); ++i) for(int i = 0; i < actions.count(); ++i)
insertAction(before, actions.at(i)); insertAction(before, actions.at(i));
@ -9825,11 +9817,7 @@ void QWidget::hideEvent(QHideEvent *)
\endtable \endtable
*/ */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QWidget::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) bool QWidget::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
#else
bool QWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
#endif
{ {
Q_UNUSED(eventType); Q_UNUSED(eventType);
Q_UNUSED(message); Q_UNUSED(message);

View File

@ -551,13 +551,8 @@ public:
#ifndef QT_NO_ACTION #ifndef QT_NO_ACTION
//actions //actions
void addAction(QAction *action); void addAction(QAction *action);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void addActions(const QList<QAction*> &actions); void addActions(const QList<QAction*> &actions);
void insertActions(QAction *before, const QList<QAction*> &actions); void insertActions(QAction *before, const QList<QAction*> &actions);
#else
void addActions(QList<QAction*> actions);
void insertActions(QAction *before, QList<QAction*> actions);
#endif
void insertAction(QAction *before, QAction *action); void insertAction(QAction *before, QAction *action);
void removeAction(QAction *action); void removeAction(QAction *action);
QList<QAction*> actions() const; QList<QAction*> actions() const;
@ -648,11 +643,7 @@ protected:
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent *event);
virtual void hideEvent(QHideEvent *event); virtual void hideEvent(QHideEvent *event);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result);
#else
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result);
#endif
// Misc. protected functions // Misc. protected functions
virtual void changeEvent(QEvent *); virtual void changeEvent(QEvent *);

View File

@ -1047,11 +1047,7 @@ void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event
} }
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
#else
bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
#endif
{ {
return m_widget->nativeEvent(eventType, message, result); return m_widget->nativeEvent(eventType, message, result);
} }

View File

@ -103,11 +103,7 @@ protected:
#endif #endif
void handleExposeEvent(QExposeEvent *); void handleExposeEvent(QExposeEvent *);
void handleWindowStateChangedEvent(QWindowStateChangeEvent *event); void handleWindowStateChangedEvent(QWindowStateChangeEvent *event);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override; bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
#else
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
#endif
#if QT_CONFIG(tabletevent) #if QT_CONFIG(tabletevent)
void handleTabletEvent(QTabletEvent *); void handleTabletEvent(QTabletEvent *);
#endif #endif

View File

@ -2393,25 +2393,6 @@ int QStyle::combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
return result; return result;
} }
// ### Qt 6: Remove in favor of template<class T> QDebug operator<<(QDebug, const QFlags<T> &).
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QT_BEGIN_INCLUDE_NAMESPACE
# include <QDebug>
QT_END_INCLUDE_NAMESPACE
# if !defined(QT_NO_DEBUG_STREAM)
QDebug operator<<(QDebug debug, QStyle::State state)
{
# if !defined(QT_NO_DEBUG)
return operator<< <QStyle::StateFlag>(debug, state);
# else
Q_UNUSED(state);
return debug;
# endif
}
# endif // !QT_NO_DEBUG_STREAM
#endif // QT_VERSION < QT_VERSION_CHECK(6,0,0)
/*! /*!
\since 4.6 \since 4.6

View File

@ -868,13 +868,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State) Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State)
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls) Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
#if !defined(QT_NO_DEBUG_STREAM)
// ### Qt 6: Remove in favor of template<class T> QDebug operator<<(QDebug, const QFlags<T> &).
# if QT_VERSION < QT_VERSION_CHECK(6,0,0)
Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
# endif
#endif
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QSTYLE_H #endif // QSTYLE_H

View File

@ -66,15 +66,10 @@ public:
QString description() const; QString description() const;
void setDescription(const QString &description); void setDescription(const QString &description);
// QTBUG-68722
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
protected:
#else
public:
#endif
QSize sizeHint() const override; QSize sizeHint() const override;
int heightForWidth(int) const override; int heightForWidth(int) const override;
QSize minimumSizeHint() const override; QSize minimumSizeHint() const override;
protected: protected:
bool event(QEvent *e) override; bool event(QEvent *e) override;
void paintEvent(QPaintEvent *) override; void paintEvent(QPaintEvent *) override;

View File

@ -198,18 +198,9 @@ QDateTimeEdit::QDateTimeEdit(QTime time, QWidget *parent)
d->init(time.isValid() ? time : QDATETIMEEDIT_TIME_MIN); d->init(time.isValid() ? time : QDATETIMEEDIT_TIME_MIN);
} }
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/*! /*!
\internal \internal
*/ */
QDateTimeEdit::QDateTimeEdit(const QVariant &var, QVariant::Type parserType, QWidget *parent)
: QDateTimeEdit(var, QMetaType::Type(parserType), parent)
{ }
/*!
\internal
*/
#endif
QDateTimeEdit::QDateTimeEdit(const QVariant &var, QMetaType::Type parserType, QWidget *parent) QDateTimeEdit::QDateTimeEdit(const QVariant &var, QMetaType::Type parserType, QWidget *parent)
: QAbstractSpinBox(*new QDateTimeEditPrivate, parent) : QAbstractSpinBox(*new QDateTimeEditPrivate, parent)
{ {

View File

@ -195,9 +195,6 @@ protected:
void paintEvent(QPaintEvent *event) override; void paintEvent(QPaintEvent *event) override;
void initStyleOption(QStyleOptionSpinBox *option) const; void initStyleOption(QStyleOptionSpinBox *option) const;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = nullptr);
#endif
QDateTimeEdit(const QVariant &val, QMetaType::Type parserType, QWidget *parent = nullptr); QDateTimeEdit(const QVariant &val, QMetaType::Type parserType, QWidget *parent = nullptr);
private: private:
Q_DECLARE_PRIVATE(QDateTimeEdit) Q_DECLARE_PRIVATE(QDateTimeEdit)

View File

@ -201,11 +201,7 @@ inline QLayoutItem *QDockWidgetItem::dockWidgetChildItem() const
inline QDockWidgetLayout *QDockWidgetItem::dockWidgetLayout() const inline QDockWidgetLayout *QDockWidgetItem::dockWidgetLayout() const
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *w = const_cast<QDockWidgetItem*>(this)->widget();
#else
QWidget *w = widget(); QWidget *w = widget();
#endif
if (w != nullptr) if (w != nullptr)
return qobject_cast<QDockWidgetLayout*>(w->layout()); return qobject_cast<QDockWidgetLayout*>(w->layout());
return nullptr; return nullptr;

View File

@ -851,11 +851,7 @@ void QMainWindow::removeToolBar(QToolBar *toolbar)
\sa addToolBar(), addToolBarBreak(), Qt::ToolBarArea \sa addToolBar(), addToolBarBreak(), Qt::ToolBarArea
*/ */
Qt::ToolBarArea QMainWindow::toolBarArea( Qt::ToolBarArea QMainWindow::toolBarArea(const QToolBar *toolbar) const
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
const
#endif
QToolBar *toolbar) const
{ return d_func()->layout->toolBarArea(toolbar); } { return d_func()->layout->toolBarArea(toolbar); }
/*! /*!

View File

@ -158,13 +158,10 @@ public:
bool unifiedTitleAndToolBarOnMac() const; bool unifiedTitleAndToolBarOnMac() const;
Qt::ToolBarArea toolBarArea( Qt::ToolBarArea toolBarArea(const QToolBar *toolbar) const;
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
const
#endif
QToolBar *toolbar) const;
bool toolBarBreak(QToolBar *toolbar) const; bool toolBarBreak(QToolBar *toolbar) const;
#endif #endif // QT_CONFIG(toolbar)
#if QT_CONFIG(dockwidget) #if QT_CONFIG(dockwidget)
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget); void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget);
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget, void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget,

View File

@ -2738,11 +2738,7 @@ QAction *QMenuPrivate::exec(const QPoint &p, QAction *action, PositionFunction p
\sa popup(), QWidget::mapToGlobal() \sa popup(), QWidget::mapToGlobal()
*/ */
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
QAction *QMenu::exec(const QList<QAction *> &actions, const QPoint &pos, QAction *at, QWidget *parent) QAction *QMenu::exec(const QList<QAction *> &actions, const QPoint &pos, QAction *at, QWidget *parent)
#else
QAction *QMenu::exec(QList<QAction*> actions, const QPoint &pos, QAction *at, QWidget *parent)
#endif
{ {
QMenu menu(parent); QMenu menu(parent);
menu.addActions(actions); menu.addActions(actions);

View File

@ -202,11 +202,7 @@ public:
QAction *exec(); QAction *exec();
QAction *exec(const QPoint &pos, QAction *at = nullptr); QAction *exec(const QPoint &pos, QAction *at = nullptr);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
static QAction *exec(const QList<QAction *> &actions, const QPoint &pos, QAction *at = nullptr, QWidget *parent = nullptr); static QAction *exec(const QList<QAction *> &actions, const QPoint &pos, QAction *at = nullptr, QWidget *parent = nullptr);
#else
static QAction *exec(QList<QAction*> actions, const QPoint &pos, QAction *at = nullptr, QWidget *parent = nullptr);
#endif
QSize sizeHint() const override; QSize sizeHint() const override;

View File

@ -810,13 +810,6 @@ void QTextBrowser::reload()
setSource(s, d->currentType); setSource(s, d->currentType);
} }
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
void QTextBrowser::setSource(const QUrl &url)
{
setSource(url, QTextDocument::UnknownResource);
}
#endif
/*! /*!
Attempts to load the document at the given \a url with the specified \a type. Attempts to load the document at the given \a url with the specified \a type.
@ -832,14 +825,12 @@ void QTextBrowser::setSource(const QUrl &url, QTextDocument::ResourceType type)
doSetSource(url, type); doSetSource(url, type);
} }
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
/*! /*!
Attempts to load the document at the given \a url with the specified \a type. Attempts to load the document at the given \a url with the specified \a type.
setSource() calls doSetSource. In Qt 5, setSource(const QUrl &url) was virtual. setSource() calls doSetSource. In Qt 5, setSource(const QUrl &url) was virtual.
In Qt 6, doSetSource() is virtual instead, so that it can be overridden in subclasses. In Qt 6, doSetSource() is virtual instead, so that it can be overridden in subclasses.
*/ */
#endif
void QTextBrowser::doSetSource(const QUrl &url, QTextDocument::ResourceType type) void QTextBrowser::doSetSource(const QUrl &url, QTextDocument::ResourceType type)
{ {
Q_D(QTextBrowser); Q_D(QTextBrowser);

View File

@ -90,12 +90,7 @@ public:
void setOpenLinks(bool open); void setOpenLinks(bool open);
public Q_SLOTS: public Q_SLOTS:
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
virtual void setSource(const QUrl &name);
void setSource(const QUrl &name, QTextDocument::ResourceType type);
#else
void setSource(const QUrl &name, QTextDocument::ResourceType type = QTextDocument::UnknownResource); void setSource(const QUrl &name, QTextDocument::ResourceType type = QTextDocument::UnknownResource);
#endif
virtual void backward(); virtual void backward();
virtual void forward(); virtual void forward();
virtual void home(); virtual void home();
@ -118,10 +113,7 @@ protected:
virtual void focusOutEvent(QFocusEvent *ev) override; virtual void focusOutEvent(QFocusEvent *ev) override;
virtual bool focusNextPrevChild(bool next) override; virtual bool focusNextPrevChild(bool next) override;
virtual void paintEvent(QPaintEvent *e) override; virtual void paintEvent(QPaintEvent *e) override;
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) virtual void doSetSource(const QUrl &name, QTextDocument::ResourceType type = QTextDocument::UnknownResource);
virtual
#endif
void doSetSource(const QUrl &name, QTextDocument::ResourceType type = QTextDocument::UnknownResource);
private: private:
Q_DISABLE_COPY(QTextBrowser) Q_DISABLE_COPY(QTextBrowser)