Remove many deprecated methods

Remove methods that have been marked as deprecated
before Qt 4.6. Keep others, but inline them
where possible and mark them as QT_DEPRECATED_SINCE(5, 0).

Change-Id: If881821ae095f054b31cc13464f19e2007c20ed7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
This commit is contained in:
Lars Knoll 2012-01-24 22:26:31 +01:00 committed by Qt by Nokia
parent 9a4d30d999
commit 3855233dab
27 changed files with 61 additions and 217 deletions

View File

@ -201,10 +201,8 @@ public:
virtual Qt::DropActions supportedDragActions() const;
#if QT_DEPRECATED_SINCE(5, 0)
void setSupportedDragActions(Qt::DropActions actions)
{
doSetSupportedDragActions(actions);
}
QT_DEPRECATED void setSupportedDragActions(Qt::DropActions actions)
{ doSetSupportedDragActions(actions); }
#endif
virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());

View File

@ -1774,7 +1774,7 @@ QString QCoreApplication::applicationFilePath()
}
# endif
QString argv0 = QFile::decodeName(QByteArray(argv()[0]));
QString argv0 = QFile::decodeName(arguments().at(0).toLocal8Bit());
QString absPath;
if (!argv0.isEmpty() && argv0.at(0) == QLatin1Char('/')) {
@ -1821,35 +1821,6 @@ qint64 QCoreApplication::applicationPid()
#endif
}
/*!
\obsolete
Use arguments().size() instead.
*/
int QCoreApplication::argc()
{
if (!self) {
qWarning("QCoreApplication::argc: Please instantiate the QApplication object first");
return 0;
}
return self->d_func()->argc;
}
/*!
\obsolete
Use arguments() instead.
*/
char **QCoreApplication::argv()
{
if (!self) {
qWarning("QCoreApplication::argv: Please instantiate the QApplication object first");
return 0;
}
return self->d_func()->argv;
}
/*!
\since 4.1

View File

@ -87,10 +87,6 @@ public:
~QCoreApplication();
#ifdef QT_DEPRECATED
QT_DEPRECATED static int argc();
QT_DEPRECATED static char **argv();
#endif
static QStringList arguments();
static void setAttribute(Qt::ApplicationAttribute attribute, bool on = true);

View File

@ -436,7 +436,7 @@ T qFindChild(const QObject *o, const QString &name = QString());
QList<T> qFindChildren(const QObject *oobj, const QString &name = QString());
QList<T> qFindChildren(const QObject *o, const QRegExp &re);
#endif
#ifdef QT_DEPRECATED
#if QT_DEPRECATED_SINCE(5, 0)
template<typename T>
inline QT_DEPRECATED T qFindChild(const QObject *o, const QString &name = QString())
{ return o->findChild<T>(name); }

View File

@ -502,7 +502,7 @@ template<> inline QVariant qvariant_cast<QVariant>(const QVariant &v)
return v;
}
#ifdef QT_DEPRECATED
#if QT_DEPRECATED_SINCE(5, 0)
template<typename T>
inline QT_DEPRECATED T qVariantValue(const QVariant &variant)
{ return qvariant_cast<T>(variant); }

View File

@ -4316,18 +4316,13 @@ int QRegExp::matchedLength() const
#ifndef QT_NO_REGEXP_CAPTURE
#ifndef QT_NO_DEPRECATED
/*!
\fn int QRegExp::numCaptures() const
\obsolete
Returns the number of captures contained in the regular expression.
\sa captureCount()
*/
int QRegExp::numCaptures() const
{
return captureCount();
}
#endif
/*!
\since 4.6

View File

@ -99,9 +99,6 @@ public:
int lastIndexIn(const QString &str, int offset = -1, CaretMode caretMode = CaretAtZero) const;
int matchedLength() const;
#ifndef QT_NO_REGEXP_CAPTURE
#ifdef QT_DEPRECATED
QT_DEPRECATED int numCaptures() const;
#endif
int captureCount() const;
QStringList capturedTexts() const;
QStringList capturedTexts();

View File

@ -70,7 +70,7 @@ struct QImageData;
class QImageDataMisc; // internal
#ifndef QT_NO_IMAGE_TEXT
#if QT_DEPRECATED_SINCE(5, 0)
class Q_GUI_EXPORT QImageTextKeyLang {
class QT_DEPRECATED QImageTextKeyLang {
public:
QImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { }
QImageTextKeyLang() { }
@ -270,11 +270,11 @@ public:
void setText(const QString &key, const QString &value);
#if QT_DEPRECATED_SINCE(5, 0)
inline QString text(const char* key, const char* lang=0) const;
inline QList<QImageTextKeyLang> textList() const;
inline QStringList textLanguages() const;
inline QString text(const QImageTextKeyLang&) const;
inline void setText(const char* key, const char* lang, const QString&);
QT_DEPRECATED inline QString text(const char* key, const char* lang=0) const;
QT_DEPRECATED inline QList<QImageTextKeyLang> textList() const;
QT_DEPRECATED inline QStringList textLanguages() const;
QT_DEPRECATED inline QString text(const QImageTextKeyLang&) const;
QT_DEPRECATED inline void setText(const char* key, const char* lang, const QString&);
#endif
#endif
@ -382,6 +382,7 @@ inline void QImage::setText(const char* key, const char* lang, const QString &s)
setText(k, s);
}
#endif
inline int QImage::numColors() const
{
return colorCount();

View File

@ -145,7 +145,7 @@ public:
inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = 0);
void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = 0);
#ifdef QT_DEPRECATED
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED int serialNumber() const;
#endif
qint64 cacheKey() const;

View File

@ -764,10 +764,12 @@ public:
friend class QApplicationPrivate;
};
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED enum DeviceType {
TouchScreen,
TouchPad
};
#endif
QTouchEvent(QEvent::Type eventType,
QTouchDevice *device = 0,
@ -778,7 +780,9 @@ public:
inline QWindow *window() const { return _window; }
inline QObject *target() const { return _target; }
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
#endif
inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
inline QTouchDevice *device() const { return _device; }

View File

@ -1088,7 +1088,7 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix4x4 &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix4x4 &);
#endif
#ifdef QT_DEPRECATED
#if QT_DEPRECATED_SINCE(5, 0)
template <int N, int M>
QT_DEPRECATED QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, qreal>& matrix)
{

View File

@ -922,15 +922,6 @@ QMatrix &QMatrix::rotate(qreal a)
\sa inverted()
*/
/*!
\obsolete
\fn qreal QMatrix::det() const
Returns the matrix's determinant.
\sa determinant()
*/
/*!
\since 4.6
\fn qreal QMatrix::determinant() const

View File

@ -101,9 +101,6 @@ public:
bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); }
qreal determinant() const { return _m11*_m22 - _m12*_m21; }
#ifdef QT_DEPRECATED
QT_DEPRECATED qreal det() const { return _m11*_m22 - _m12*_m21; }
#endif
QMatrix inverted(bool *invertible = 0) const;

View File

@ -4257,11 +4257,6 @@ void QRegion::setRects(const QRect *rects, int num)
}
}
int QRegion::numRects() const
{
return (d->qt_rgn ? d->qt_rgn->numRects : 0);
}
int QRegion::rectCount() const
{
return (d->qt_rgn ? d->qt_rgn->numRects : 0);

View File

@ -113,9 +113,6 @@ public:
QRect boundingRect() const;
QVector<QRect> rects() const;
void setRects(const QRect *rect, int num);
#ifdef QT_DEPRECATED
QT_DEPRECATED int numRects() const;
#endif
int rectCount() const;
const QRegion operator|(const QRegion &r) const;

View File

@ -43,9 +43,7 @@
#define QDESKTOPSERVICES_H
#include <QtCore/qstring.h>
#if QT_DEPRECATED_SINCE(5, 0)
#include <QtCore/qstandardpaths.h>
#endif
QT_BEGIN_HEADER
@ -66,7 +64,7 @@ public:
static void unsetUrlHandler(const QString &scheme);
#if QT_DEPRECATED_SINCE(5, 0)
enum StandardLocation {
QT_DEPRECATED enum StandardLocation {
DesktopLocation,
DocumentsLocation,
FontsLocation,

View File

@ -667,17 +667,6 @@ void QPrintPreviewWidget::setZoomFactor(qreal factor)
d->setZoomFactor(factor);
}
/*!
\obsolete
Returns the number of pages in the preview.
\sa pageCount()
*/
int QPrintPreviewWidget::numPages() const
{
Q_D(const QPrintPreviewWidget);
return d->pages.size();
}
/*!
\since 4.6
Returns the number of pages in the preview.

View File

@ -81,9 +81,6 @@ public:
ViewMode viewMode() const;
ZoomMode zoomMode() const;
int currentPage() const;
#ifdef QT_DEPRECATED
QT_DEPRECATED int numPages() const;
#endif
int pageCount() const;
void setVisible(bool visible);

View File

@ -1097,15 +1097,6 @@ void QFileDialog::setNameFilter(const QString &filter)
setNameFilters(qt_make_filter_list(filter));
}
/*!
\obsolete
Use setNameFilter() instead.
*/
void QFileDialog::setFilter(const QString &filter)
{
setNameFilter(filter);
}
/*!
\property QFileDialog::nameFilterDetailsVisible
@ -1177,16 +1168,6 @@ void QFileDialog::setNameFilters(const QStringList &filters)
d->_q_useNameFilter(0);
}
/*!
\obsolete
Use setNameFilters() instead.
*/
void QFileDialog::setFilters(const QStringList &filters)
{
setNameFilters(filters);
}
/*!
\since 4.4
@ -1198,17 +1179,6 @@ QStringList QFileDialog::nameFilters() const
return d_func()->options->nameFilters();
}
/*!
\obsolete
Use nameFilters() instead.
*/
QStringList QFileDialog::filters() const
{
return nameFilters();
}
/*!
\since 4.4
@ -1236,17 +1206,6 @@ void QFileDialog::selectNameFilter(const QString &filter)
}
}
/*!
\obsolete
Use selectNameFilter() instead.
*/
void QFileDialog::selectFilter(const QString &filter)
{
selectNameFilter(filter);
}
/*!
\since 4.4
@ -1263,16 +1222,6 @@ QString QFileDialog::selectedNameFilter() const
return d->qFileDialogUi->fileTypeCombo->currentText();
}
/*!
\obsolete
Use selectedNameFilter() instead.
*/
QString QFileDialog::selectedFilter() const
{
return selectedNameFilter();
}
/*!
\since 4.4
@ -1799,7 +1748,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
*selectedFilter = dialog.selectedFilter();
*selectedFilter = dialog.selectedNameFilter();
return dialog.selectedFiles().value(0);
}
return QString();
@ -1884,7 +1833,7 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
*selectedFilter = dialog.selectedFilter();
*selectedFilter = dialog.selectedNameFilter();
return dialog.selectedFiles();
}
return QStringList();
@ -1971,7 +1920,7 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
*selectedFilter = dialog.selectedFilter();
*selectedFilter = dialog.selectedNameFilter();
return dialog.selectedFiles().value(0);
}

View File

@ -110,13 +110,6 @@ public:
void selectFile(const QString &filename);
QStringList selectedFiles() const;
#ifdef QT_DEPRECATED
QT_DEPRECATED void setFilter(const QString &filter);
QT_DEPRECATED void setFilters(const QStringList &filters);
QT_DEPRECATED QStringList filters() const;
QT_DEPRECATED void selectFilter(const QString &filter);
QT_DEPRECATED QString selectedFilter() const;
#endif
void setNameFilterDetailsVisible(bool enabled);
bool isNameFilterDetailsVisible() const;

View File

@ -397,18 +397,6 @@ QLCDNumber::~QLCDNumber()
}
/*!
\deprecated
\property QLCDNumber::numDigits
\brief the current number of digits displayed
\sa digitCount
*/
void QLCDNumber::setNumDigits(int numDigits)
{
setDigitCount(numDigits);
}
/*!
\since 4.6
\property QLCDNumber::digitCount
@ -476,12 +464,6 @@ void QLCDNumber::setDigitCount(int numDigits)
}
}
int QLCDNumber::numDigits() const
{
Q_D(const QLCDNumber);
return d->ndigits;
}
/*!
Returns the current number of digits.
*/

View File

@ -58,7 +58,7 @@ class Q_WIDGETS_EXPORT QLCDNumber : public QFrame // LCD number widget
Q_OBJECT
Q_ENUMS(Mode SegmentStyle)
Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint)
Q_PROPERTY(int numDigits READ numDigits WRITE setNumDigits)
Q_PROPERTY(int numDigits READ digitCount WRITE setDigitCount)
Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount)
Q_PROPERTY(Mode mode READ mode WRITE setMode)
Q_PROPERTY(SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle)
@ -78,10 +78,6 @@ public:
};
bool smallDecimalPoint() const;
#ifdef QT_DEPRECATED
QT_DEPRECATED int numDigits() const;
QT_DEPRECATED void setNumDigits(int nDigits);
#endif
int digitCount() const;
void setDigitCount(int nDigits);

View File

@ -127,7 +127,7 @@ void tst_QCoreApplication::argc()
char *argv[] = { "tst_qcoreapplication" };
QCoreApplication app(argc, argv);
QCOMPARE(argc, 1);
QCOMPARE(app.argc(), 1);
QCOMPARE(app.arguments().count(), 1);
}
{
@ -135,7 +135,7 @@ void tst_QCoreApplication::argc()
char *argv[] = { "tst_qcoreapplication", "arg1", "arg2", "arg3" };
QCoreApplication app(argc, argv);
QCOMPARE(argc, 4);
QCOMPARE(app.argc(), 4);
QCOMPARE(app.arguments().count(), 4);
}
{
@ -143,7 +143,7 @@ void tst_QCoreApplication::argc()
char **argv = 0;
QCoreApplication app(argc, argv);
QCOMPARE(argc, 0);
QCOMPARE(app.argc(), 0);
QCOMPARE(app.arguments().count(), 0);
}
{
@ -151,7 +151,7 @@ void tst_QCoreApplication::argc()
char *argv[] = { "tst_qcoreapplication", "-qmljsdebugger=port:3768,block" };
QCoreApplication app(argc, argv);
QCOMPARE(argc, 1);
QCOMPARE(app.argc(), 1);
QCOMPARE(app.arguments().count(), 1);
}
}

View File

@ -1311,7 +1311,7 @@ void tst_QRegExp::posAndCapConsistency()
QFETCH( QString, cap2 );
QRegExp re(reStr);
QCOMPARE(re.numCaptures(), 2);
QCOMPARE(re.captureCount(), 2);
QCOMPARE(re.capturedTexts().size(), 3);
QCOMPARE(re.indexIn(text), matchIndex);

View File

@ -329,8 +329,8 @@ void tst_QFiledialog::filterSelectedSignal()
filterChoices << "Image files (*.png *.xpm *.jpg)"
<< "Text files (*.txt)"
<< "Any files (*.*)";
fd.setFilters(filterChoices);
QCOMPARE(fd.filters(), filterChoices);
fd.setNameFilters(filterChoices);
QCOMPARE(fd.nameFilters(), filterChoices);
QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
QVERIFY(filters);
@ -354,7 +354,7 @@ void tst_QFiledialog::args()
#ifndef Q_OS_WIN
QCOMPARE(fd.directory(), QDir(directory));
#endif
QCOMPARE(fd.filters(), QStringList(filter));
QCOMPARE(fd.nameFilters(), QStringList(filter));
}
void tst_QFiledialog::directory()
@ -648,7 +648,7 @@ void tst_QFiledialog::filters()
QSignalSpy spyDirectoryEntered(&fd, SIGNAL(directoryEntered(const QString &)));
QSignalSpy spyFilesSelected(&fd, SIGNAL(filesSelected(const QStringList &)));
QSignalSpy spyFilterSelected(&fd, SIGNAL(filterSelected(const QString &)));
QCOMPARE(fd.filters(), QStringList("All Files (*)"));
QCOMPARE(fd.nameFilters(), QStringList("All Files (*)"));
// effects
QList<QComboBox*> views = qFindChildren<QComboBox*>(&fd, "fileTypeCombo");
@ -659,14 +659,14 @@ void tst_QFiledialog::filters()
filters << "Image files (*.png *.xpm *.jpg)"
<< "Text files (*.txt)"
<< "Any files (*.*)";
fd.setFilters(filters);
fd.setNameFilters(filters);
QCOMPARE(views.at(0)->isVisible(), false);
fd.show();
fd.setAcceptMode(QFileDialog::AcceptSave);
QCOMPARE(views.at(0)->isVisible(), true);
QCOMPARE(fd.filters(), filters);
fd.setFilter("Image files (*.png *.xpm *.jpg);;Text files (*.txt);;Any files (*.*)");
QCOMPARE(fd.filters(), filters);
QCOMPARE(fd.nameFilters(), filters);
fd.setNameFilter("Image files (*.png *.xpm *.jpg);;Text files (*.txt);;Any files (*.*)");
QCOMPARE(fd.nameFilters(), filters);
QCOMPARE(spyCurrentChanged.count(), 0);
QCOMPARE(spyDirectoryEntered.count(), 0);
QCOMPARE(spyFilesSelected.count(), 0);
@ -682,38 +682,38 @@ void tst_QFiledialog::filters()
QStringList expected;
expected << "C++ Source Files(*.cpp)";
expected << "Any(*.*)";
fd2.setFilter("C++ Source Files(*.cpp);;Any(*.*)");
QCOMPARE(expected, fd2.filters());
fd2.setFilter("C++ Source Files(*.cpp) ;;Any(*.*)");
QCOMPARE(expected, fd2.filters());
fd2.setFilter("C++ Source Files(*.cpp);; Any(*.*)");
QCOMPARE(expected, fd2.filters());
fd2.setFilter(" C++ Source Files(*.cpp);; Any(*.*)");
QCOMPARE(expected, fd2.filters());
fd2.setFilter("C++ Source Files(*.cpp) ;; Any(*.*)");
QCOMPARE(expected, fd2.filters());
fd2.setNameFilter("C++ Source Files(*.cpp);;Any(*.*)");
QCOMPARE(expected, fd2.nameFilters());
fd2.setNameFilter("C++ Source Files(*.cpp) ;;Any(*.*)");
QCOMPARE(expected, fd2.nameFilters());
fd2.setNameFilter("C++ Source Files(*.cpp);; Any(*.*)");
QCOMPARE(expected, fd2.nameFilters());
fd2.setNameFilter(" C++ Source Files(*.cpp);; Any(*.*)");
QCOMPARE(expected, fd2.nameFilters());
fd2.setNameFilter("C++ Source Files(*.cpp) ;; Any(*.*)");
QCOMPARE(expected, fd2.nameFilters());
}
void tst_QFiledialog::selectFilter()
{
QNonNativeFileDialog fd;
QSignalSpy spyFilterSelected(&fd, SIGNAL(filterSelected(const QString &)));
QCOMPARE(fd.selectedFilter(), QString("All Files (*)"));
QCOMPARE(fd.selectedNameFilter(), QString("All Files (*)"));
QStringList filters;
filters << "Image files (*.png *.xpm *.jpg)"
<< "Text files (*.txt)"
<< "Any files (*.*)";
fd.setFilters(filters);
QCOMPARE(fd.selectedFilter(), filters.at(0));
fd.selectFilter(filters.at(1));
QCOMPARE(fd.selectedFilter(), filters.at(1));
fd.selectFilter(filters.at(2));
QCOMPARE(fd.selectedFilter(), filters.at(2));
fd.setNameFilters(filters);
QCOMPARE(fd.selectedNameFilter(), filters.at(0));
fd.selectNameFilter(filters.at(1));
QCOMPARE(fd.selectedNameFilter(), filters.at(1));
fd.selectNameFilter(filters.at(2));
QCOMPARE(fd.selectedNameFilter(), filters.at(2));
fd.selectFilter("bob");
QCOMPARE(fd.selectedFilter(), filters.at(2));
fd.selectFilter("");
QCOMPARE(fd.selectedFilter(), filters.at(2));
fd.selectNameFilter("bob");
QCOMPARE(fd.selectedNameFilter(), filters.at(2));
fd.selectNameFilter("");
QCOMPARE(fd.selectedNameFilter(), filters.at(2));
QCOMPARE(spyFilterSelected.count(), 0);
}
@ -1004,8 +1004,8 @@ void tst_QFiledialog::proxymodel()
void tst_QFiledialog::setNameFilter()
{
QNonNativeFileDialog fd;
fd.setFilter(QString());
fd.setFilters(QStringList());
fd.setNameFilter(QString());
fd.setNameFilters(QStringList());
}
void tst_QFiledialog::focus()

View File

@ -266,7 +266,7 @@ void tst_QFileDialog2::showNameFilterDetails()
filterChoices << "Image files (*.png *.xpm *.jpg)"
<< "Text files (*.txt)"
<< "Any files (*.*)";
fd.setFilters(filterChoices);
fd.setNameFilters(filterChoices);
fd.setNameFilterDetailsVisible(false);
QCOMPARE(filters->itemText(0), QString("Image files"));

View File

@ -141,8 +141,6 @@ private:
tst_QMessageBox::tst_QMessageBox() : keyToSend(-1)
{
int argc = qApp->argc();
QT_REQUIRE_VERSION(argc, qApp->argv(), "4.6.2")
}
int tst_QMessageBox::exec(QMessageBox *msgBox, int key)