From: Stephen Kelly Date: Thu, 15 Dec 2011 16:43:48 +0000 (+0100) Subject: Change a slot into a virtual method. X-Git-Tag: qt-v5.0.0-alpha1~2215 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e12d2d30f74b5fe1f80fac7192416cf6eb22d4d;p=profile%2Fivi%2Fqtbase.git Change a slot into a virtual method. Implements a BiC Qt5 TODO. Change-Id: Ie7dc32d954335019166dbd78d8b01ef79e2ad5c2 Reviewed-by: Robin Burchell Reviewed-by: Olivier Goffart --- diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index bdc5d69..514e98e 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -347,7 +347,6 @@ QString QAbstractItemDelegate::elidedText(const QFontMetrics &fontMetrics, int w \sa QHelpEvent */ -// ### Qt 5: Make this a virtual non-slot function bool QAbstractItemDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, diff --git a/src/widgets/itemviews/qabstractitemdelegate.h b/src/widgets/itemviews/qabstractitemdelegate.h index f494f0b..a4859f2 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.h +++ b/src/widgets/itemviews/qabstractitemdelegate.h @@ -108,11 +108,10 @@ public: static QString elidedText(const QFontMetrics &fontMetrics, int width, Qt::TextElideMode mode, const QString &text); -public Q_SLOTS: - bool helpEvent(QHelpEvent *event, - QAbstractItemView *view, - const QStyleOptionViewItem &option, - const QModelIndex &index); + virtual bool helpEvent(QHelpEvent *event, + QAbstractItemView *view, + const QStyleOptionViewItem &option, + const QModelIndex &index); Q_SIGNALS: void commitData(QWidget *editor); diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 06544e3..0776ca6 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1658,15 +1658,11 @@ bool QAbstractItemView::viewportEvent(QEvent *event) QStyleOptionViewItemV4 option = d->viewOptionsV4(); option.rect = visualRect(index); option.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None); - bool retval = false; - // ### Qt 5: make this a normal function call to a virtual function - QMetaObject::invokeMethod(d->delegateForIndex(index), "helpEvent", - Q_RETURN_ARG(bool, retval), - Q_ARG(QHelpEvent *, he), - Q_ARG(QAbstractItemView *, this), - Q_ARG(QStyleOptionViewItem, option), - Q_ARG(QModelIndex, index)); - return retval; + + QAbstractItemDelegate *delegate = d->delegateForIndex(index); + if (!delegate) + return false; + return delegate->helpEvent(he, this, option, index); } case QEvent::FontChange: d->doDelayedItemsLayout(); // the size of the items will change