summaryrefslogtreecommitdiffstats
path: root/examples/itemviews/stardelegate/stardelegate.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-04 16:29:09 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-06 09:06:17 (GMT)
commit633f3f45e5420663cf4ceadea79e62fea44cd2eb (patch)
tree1b2c0d8b5dc0746a51c2ea4bf542845273cf7006 /examples/itemviews/stardelegate/stardelegate.cpp
parent7b5e37cab738804d47b78582aa3d0f3bb6933e70 (diff)
downloadQt-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/stardelegate/stardelegate.cpp')
-rw-r--r--examples/itemviews/stardelegate/stardelegate.cpp18
1 files changed, 9 insertions, 9 deletions
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);
}