Change a slot into a virtual method.

Implements a BiC Qt5 TODO.

Change-Id: Ie7dc32d954335019166dbd78d8b01ef79e2ad5c2
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Stephen Kelly 2011-12-15 17:43:48 +01:00 committed by Qt by Nokia
parent c023f5600a
commit 7e12d2d30f
3 changed files with 9 additions and 15 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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