Replace all remaining functions deprecated in Qt 5, if possible.

These are:
    - QInputDialog::getInteger() [-> getInt()]
    - QKeySequence::operator QString() [-> toString()]
    - QRegion::intersect() [-> intersected()]
    - qVariantCanConvert() [-> QVariant::canConvert()]

Plus some left-over occurrences of qFindChild() and
QAbstractItemModel::reset() that were missed by the
respective earlier patches.

All deprecated features still left are not trivially
replaceable, i.e. the code using them cannot be made
to compile with both Qt 4 and Qt 5.

Change-Id: I32541681bbf66b0fef78f5c7025521f9ff84f463
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Christian Kandeler
2012-09-21 13:44:33 +02:00
committed by hjk
parent aef4280bc1
commit 89fa7823b3
9 changed files with 23 additions and 21 deletions

View File

@@ -814,7 +814,7 @@ static inline GitClientMemberFunc memberFunctionFromAction(const QObject *o)
if (o) {
if (const QAction *action = qobject_cast<const QAction *>(o)) {
const QVariant v = action->data();
if (qVariantCanConvert<GitClientMemberFunc>(v))
if (v.canConvert<GitClientMemberFunc>())
return qvariant_cast<GitClientMemberFunc>(v);
}
}

View File

@@ -88,7 +88,7 @@ bool inputText(QWidget *parent, const QString &title, const QString &prompt, QSt
dialog.setLabelText(prompt);
dialog.setTextValue(*s);
// Nasty hack:
if (QLineEdit *le = qFindChild<QLineEdit*>(&dialog))
if (QLineEdit *le = dialog.findChild<QLineEdit*>())
le->setMinimumWidth(500);
if (dialog.exec() != QDialog::Accepted)
return false;

View File

@@ -186,8 +186,9 @@ void RemoteModel::clear()
{
if (m_remotes.isEmpty())
return;
beginResetModel();
m_remotes.clear();
reset();
endResetModel();
}
bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage)
@@ -200,6 +201,7 @@ bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage
return false;
// Parse output
m_workingDirectory = workingDirectory;
beginResetModel();
m_remotes.clear();
const QStringList lines = output.split(QLatin1Char('\n'));
for (int r = 0; r < lines.count(); ++r) {
@@ -207,7 +209,7 @@ bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage
if (newRemote.parse(lines.at(r)))
m_remotes.push_back(newRemote);
}
reset();
endResetModel();
return true;
}