diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-04 16:29:09 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-06 09:06:17 (GMT) |
commit | 633f3f45e5420663cf4ceadea79e62fea44cd2eb (patch) | |
tree | 1b2c0d8b5dc0746a51c2ea4bf542845273cf7006 /examples/itemviews | |
parent | 7b5e37cab738804d47b78582aa3d0f3bb6933e70 (diff) | |
download | Qt-633f3f45e5420663cf4ceadea79e62fea44cd2eb.zip Qt-633f3f45e5420663cf4ceadea79e62fea44cd2eb.tar.gz Qt-633f3f45e5420663cf4ceadea79e62fea44cd2eb.tar.bz2 |
Remove the use of deprecated qVariant*
Test directory untouched.
This just apply those regexp:
git grep -O"sed -i 's/qVariantValue</qvariant_cast</'" qVariantValue
git grep -O"sed -i 's/qVariantSetValue(\([^&*\(),]*\), */\\1.setValue(/'" qVariantSetValue
git grep -O"sed -i 's/qVariantSetValue *<\([^>]*\)> *(\([^&*\(),]*\), */\\2.setValue<\\1>(/'" qVariantSetValue
git grep -O"sed -i 's/qVariantCanConvert *<\([^>]*\)> *(\([^&*\(),]*\))/\\2.canConvert<\\1>()/g'" qVariantCanConvert
git grep -O"sed -i 's/qVariantCanConvert *<\([^>]*\)> *(\([^&*\(),]*([^&*\(),]*)\))/\\2.canConvert<\\1>()/g'" qVariantCanConvert
git grep -O"sed -i 's/qVariantFromValue\( *[(<]\)/QVariant::fromValue\\1/'" qVariantFromValue
git checkout src/corelib/kernal/qvariant*
Rev-by: dev mailing list
Diffstat (limited to 'examples/itemviews')
-rw-r--r-- | examples/itemviews/coloreditorfactory/colorlisteditor.cpp | 2 | ||||
-rw-r--r-- | examples/itemviews/puzzle/piecesmodel.cpp | 2 | ||||
-rw-r--r-- | examples/itemviews/stardelegate/main.cpp | 2 | ||||
-rw-r--r-- | examples/itemviews/stardelegate/stardelegate.cpp | 18 |
4 files changed, 12 insertions, 12 deletions
diff --git a/examples/itemviews/coloreditorfactory/colorlisteditor.cpp b/examples/itemviews/coloreditorfactory/colorlisteditor.cpp index 1af5831..4f4a954 100644 --- a/examples/itemviews/coloreditorfactory/colorlisteditor.cpp +++ b/examples/itemviews/coloreditorfactory/colorlisteditor.cpp @@ -50,7 +50,7 @@ ColorListEditor::ColorListEditor(QWidget *widget) : QComboBox(widget) //! [0] QColor ColorListEditor::color() const { - return qVariantValue<QColor>(itemData(currentIndex(), Qt::DecorationRole)); + return qvariant_cast<QColor>(itemData(currentIndex(), Qt::DecorationRole)); } //! [0] diff --git a/examples/itemviews/puzzle/piecesmodel.cpp b/examples/itemviews/puzzle/piecesmodel.cpp index e110cf1..e55663b 100644 --- a/examples/itemviews/puzzle/piecesmodel.cpp +++ b/examples/itemviews/puzzle/piecesmodel.cpp @@ -124,7 +124,7 @@ QMimeData *PiecesModel::mimeData(const QModelIndexList &indexes) const foreach (QModelIndex index, indexes) { if (index.isValid()) { - QPixmap pixmap = qVariantValue<QPixmap>(data(index, Qt::UserRole)); + QPixmap pixmap = qvariant_cast<QPixmap>(data(index, Qt::UserRole)); QPoint location = data(index, Qt::UserRole+1).toPoint(); stream << pixmap << location; } diff --git a/examples/itemviews/stardelegate/main.cpp b/examples/itemviews/stardelegate/main.cpp index d9f655d..444017e 100644 --- a/examples/itemviews/stardelegate/main.cpp +++ b/examples/itemviews/stardelegate/main.cpp @@ -71,7 +71,7 @@ void populateTableWidget(QTableWidget *tableWidget) QTableWidgetItem *item2 = new QTableWidgetItem(staticData[row].artist); QTableWidgetItem *item3 = new QTableWidgetItem; item3->setData(0, - qVariantFromValue(StarRating(staticData[row].rating))); + QVariant::fromValue(StarRating(staticData[row].rating))); tableWidget->setItem(row, 0, item0); tableWidget->setItem(row, 1, item1); diff --git a/examples/itemviews/stardelegate/stardelegate.cpp b/examples/itemviews/stardelegate/stardelegate.cpp index 44dd54f..ebb2e38 100644 --- a/examples/itemviews/stardelegate/stardelegate.cpp +++ b/examples/itemviews/stardelegate/stardelegate.cpp @@ -48,8 +48,8 @@ void StarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - if (qVariantCanConvert<StarRating>(index.data())) { - StarRating starRating = qVariantValue<StarRating>(index.data()); + if (index.data().canConvert<StarRating>()) { + StarRating starRating = qvariant_cast<StarRating>(index.data()); if (option.state & QStyle::State_Selected) painter->fillRect(option.rect, option.palette.highlight()); @@ -66,8 +66,8 @@ void StarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, QSize StarDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { - if (qVariantCanConvert<StarRating>(index.data())) { - StarRating starRating = qVariantValue<StarRating>(index.data()); + if (index.data().canConvert<StarRating>()) { + StarRating starRating = qvariant_cast<StarRating>(index.data()); return starRating.sizeHint(); } else { return QStyledItemDelegate::sizeHint(option, index); @@ -81,7 +81,7 @@ QWidget *StarDelegate::createEditor(QWidget *parent, const QModelIndex &index) const { - if (qVariantCanConvert<StarRating>(index.data())) { + if (index.data().canConvert<StarRating>()) { StarEditor *editor = new StarEditor(parent); connect(editor, SIGNAL(editingFinished()), this, SLOT(commitAndCloseEditor())); @@ -96,8 +96,8 @@ QWidget *StarDelegate::createEditor(QWidget *parent, void StarDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { - if (qVariantCanConvert<StarRating>(index.data())) { - StarRating starRating = qVariantValue<StarRating>(index.data()); + if (index.data().canConvert<StarRating>()) { + StarRating starRating = qvariant_cast<StarRating>(index.data()); StarEditor *starEditor = qobject_cast<StarEditor *>(editor); starEditor->setStarRating(starRating); } else { @@ -110,9 +110,9 @@ void StarDelegate::setEditorData(QWidget *editor, void StarDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { - if (qVariantCanConvert<StarRating>(index.data())) { + if (index.data().canConvert<StarRating>()) { StarEditor *starEditor = qobject_cast<StarEditor *>(editor); - model->setData(index, qVariantFromValue(starEditor->starRating())); + model->setData(index, QVariant::fromValue(starEditor->starRating())); } else { QStyledItemDelegate::setModelData(editor, model, index); } |