Warn against deprecated API in Qt6
The code is fixed when possible.
-
QDate::toString(Qt::DateFormat format, QCalendar cal)
becomesQDate::toString(Qt::DateFormat format)
. -
QDateTime(const QDate &)
becomesQDate::startOfDay()
. -
QDir dir; dir = "..."
becomesQDir dir; dir.setPath("...")
. -
QDir::addResourceSearchPath()
becomesQDir::addSearchPath()
with prefix. -
Only warning are emitted for
addResourceSearchPath
. -
QProcess::start()
becomesQProcess::startCommand()
. -
QResource::isCompressed()
is replaced withQResource::compressionAlgorithm()
. -
QSignalMapper::mapped()
is replaced withQSignalMapper::mappedInt
,QSignalMapper::mappedString
,QSignalMapper::mappedObject
depending on the argument of the function. -
QString::SplitBehavior
is replaced withQt::SplitBehavior
. -
Qt::MatchRegExp
is replaced withQt::MatchRegularExpression
. -
QTextStream
functions are replaced by the one under the Qt namespace. -
QVariant
operators '<
' '<=
' '>
' '>=
' are replaced withQVariant::compare()
function. -
QVariant v1; QVariant v2; 'v1 < v2'
becomes 'QVariant::compare(v1, v2) < 0
'. -
QWizard::visitedPages()
is replaced withQWizard::visitedIds()
. -
QButtonGroup buttonClicked/Pressed/Released/Toggled(int)
is replaced withQButtonGroup::idClicked/Pressed/Released/Toggled(int)
. -
QCombobox::activated(const QString &)
andhighlighted(const QString &)
are replaced withQComboBox::textActivated
ortextHighlighted
respectively.
Warning for:
-
Usage of
QMap::insertMulti
,uniqueKeys
,values
,unite
, to be replaced with QMultiMap versions. -
Usage of
QHash::uniqueKeys
, to be replaced withQMultiHash
versions. -
Usage of
LinkedList
, to be replaced withstd::list
. -
Usage of global
qrand()
andqsrand()
, to be replaced usingQRandomGenerator
. -
Usage of
QTimeLine::curveShape
andQTimeLine::setCurveShape
, to be replaced usingQTimeLine::easingCurve
andQTimeLine::setEasingCurve
. -
Usage of
QSet
andQHash
biderectional iterator. Code has to be ported using forward iterator. -
Usage of
QMacCocoaViewContainer
, to be replaced usingQWindow::fromWinId
andQWidget::createWindowContainer
instead. -
Usage of
QMacNativeWidget
, to be replaced usingQWidget::winId
instead. -
Usage of
QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLength
, to be replaced usingAdjustToContents
orAdjustToContentsOnFirstShow
. -
Usage of
QComboBox::currentIndexChanged(const QString &)
, to be replaced usingcurrentIndexChanged(int)
instead, and getting the text usingitemText(index)
. -
Usage of
QSplashScreen(QWidget *parent,...)
, to be replaced with the constructor taking aQScreen *
. -
Usage of
QTextBrowser::highlighted(const QString &)
, to be replaced withhighlighted(const QUrl &)
. -
Usage of
QDockWidget::AllDockWidgetFeatures
, to be replaced withDockWidgetClosable|DockWidgetMovable|DockWidgetFloatable
. -
Usage of
QDirModel
, to be replaced withQFileSystemModel
. -
Usage of
QGraphicsView::matrix
,setMatrix(const QMatrix &)
andresetMatrix
, to be replaced withQGraphicsView::transform
,setTransform(const QTransform &)
andresetTransfrom
. -
Usage of the following QStyle enum:
QStyle::PixelMetrix::PM_DefaultTopLevelMargin
,PM_DefaultChildMargin
,PM_DefaultLayoutSpacing
andQStyle::SubElement::SE_DialogButtonBoxLayoutItem
.
This fix-it is intended to aid the user porting from Qt5 to Qt6.
Run this check with Qt5. The produced fixed code will compile on Qt6.