mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
remove obsolete QAbstractItemDelegate::elidedText() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
fc51b22ea2
commit
caee5d2ff5
2 changed files with 28 additions and 45 deletions
|
@ -209,7 +209,7 @@ QWidget *QAbstractItemDelegate::createEditor(QWidget *,
|
|||
const QStyleOptionViewItem &,
|
||||
const QModelIndex &) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -283,26 +283,6 @@ bool QAbstractItemDelegate::editorEvent(QEvent *,
|
|||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use QFontMetrics::elidedText() instead.
|
||||
|
||||
\oldcode
|
||||
QFontMetrics fm = ...
|
||||
QString str = QAbstractItemDelegate::elidedText(fm, width, mode, text);
|
||||
\newcode
|
||||
QFontMetrics fm = ...
|
||||
QString str = fm.elidedText(text, mode, width);
|
||||
\endcode
|
||||
*/
|
||||
|
||||
QString QAbstractItemDelegate::elidedText(const QFontMetrics &fontMetrics, int width,
|
||||
Qt::TextElideMode mode, const QString &text)
|
||||
{
|
||||
return fontMetrics.elidedText(text, mode, width);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.3
|
||||
Whenever a help event occurs, this function is called with the \a event
|
||||
|
@ -326,35 +306,41 @@ bool QAbstractItemDelegate::helpEvent(QHelpEvent *event,
|
|||
{
|
||||
Q_UNUSED(option);
|
||||
|
||||
if (!event || !view)
|
||||
if (!event || !view) {
|
||||
return false;
|
||||
}
|
||||
switch (event->type()) {
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
case QEvent::ToolTip: {
|
||||
QHelpEvent *he = static_cast<QHelpEvent*>(event);
|
||||
QVariant tooltip = index.data(Qt::ToolTipRole);
|
||||
if (tooltip.canConvert<QString>()) {
|
||||
QToolTip::showText(he->globalPos(), tooltip.toString(), view);
|
||||
return true;
|
||||
case QEvent::ToolTip: {
|
||||
QHelpEvent *he = static_cast<QHelpEvent*>(event);
|
||||
QVariant tooltip = index.data(Qt::ToolTipRole);
|
||||
if (tooltip.canConvert<QString>()) {
|
||||
QToolTip::showText(he->globalPos(), tooltip.toString(), view);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;}
|
||||
#endif
|
||||
#ifndef QT_NO_WHATSTHIS
|
||||
case QEvent::QueryWhatsThis: {
|
||||
if (index.data(Qt::WhatsThisRole).isValid())
|
||||
return true;
|
||||
break; }
|
||||
case QEvent::WhatsThis: {
|
||||
QHelpEvent *he = static_cast<QHelpEvent*>(event);
|
||||
QVariant whatsthis = index.data(Qt::WhatsThisRole);
|
||||
if (whatsthis.canConvert<QString>()) {
|
||||
QWhatsThis::showText(he->globalPos(), whatsthis.toString(), view);
|
||||
return true;
|
||||
case QEvent::QueryWhatsThis: {
|
||||
if (index.data(Qt::WhatsThisRole).isValid()) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QEvent::WhatsThis: {
|
||||
QHelpEvent *he = static_cast<QHelpEvent*>(event);
|
||||
QVariant whatsthis = index.data(Qt::WhatsThisRole);
|
||||
if (whatsthis.canConvert<QString>()) {
|
||||
QWhatsThis::showText(he->globalPos(), whatsthis.toString(), view);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break ; }
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -82,9 +82,6 @@ public:
|
|||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index);
|
||||
|
||||
static QString elidedText(const QFontMetrics &fontMetrics, int width,
|
||||
Qt::TextElideMode mode, const QString &text);
|
||||
|
||||
public Q_SLOTS:
|
||||
bool helpEvent(QHelpEvent *event,
|
||||
QAbstractItemView *view,
|
||||
|
|
Loading…
Add table
Reference in a new issue