summaryrefslogtreecommitdiffstats
path: root/examples/itemviews/stardelegate
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-08-19 10:04:39 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-08-19 10:04:39 (GMT)
commita226143eeda6771efc4f0df6955351336735cb60 (patch)
treea279f87d74f5929e36fe6a3aa5e4f4d843b32458 /examples/itemviews/stardelegate
parentc02ad51733d0a2885ddb39cb7e3b09355ab97213 (diff)
parentffbce9839f8be5c2f21cc66b617dbeb0a47af269 (diff)
downloadQt-a226143eeda6771efc4f0df6955351336735cb60.zip
Qt-a226143eeda6771efc4f0df6955351336735cb60.tar.gz
Qt-a226143eeda6771efc4f0df6955351336735cb60.tar.bz2
Merge remote branch 'qt/master' into lighthouse-master
Diffstat (limited to 'examples/itemviews/stardelegate')
-rw-r--r--examples/itemviews/stardelegate/main.cpp2
-rw-r--r--examples/itemviews/stardelegate/stardelegate.cpp18
2 files changed, 10 insertions, 10 deletions
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);
}