diaglib: Add more output to DebugProxyStyle.
- Add output for QStyleOptionViewItem. - Also wrap styleHint(). Task-number: QTBUG-48916 Change-Id: If28bd89b7d175b7a83ee0c8e2538906796fd8426 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>bb10
parent
8005fa3524
commit
39a3be72a4
|
|
@ -45,13 +45,36 @@ QDebug operator<<(QDebug debug, const QStyleOption *option)
|
|||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
QDebugStateSaver saver(debug);
|
||||
# if QT_VERSION >= 0x050400
|
||||
debug.noquote();
|
||||
# endif
|
||||
debug.nospace();
|
||||
#endif
|
||||
debug << "QStyleOption(";
|
||||
if (option)
|
||||
debug << "rec=" << option->rect;
|
||||
else
|
||||
debug << '0';
|
||||
if (!option) {
|
||||
debug << "QStyleOption(0)";
|
||||
return debug;
|
||||
}
|
||||
if (const QStyleOptionViewItem *ivo = qstyleoption_cast<const QStyleOptionViewItem *>(option)) {
|
||||
debug << "QStyleOptionViewItem(";
|
||||
#if QT_VERSION >= 0x050000
|
||||
debug << ivo->index;
|
||||
if (const int textSize = ivo->text.size())
|
||||
debug << ", \"" << (textSize < 20 ? ivo->text : ivo->text.left(20) + QLatin1String("...")) << '"';
|
||||
debug << ", ";
|
||||
#else // Qt 5
|
||||
Q_UNUSED(ivo)
|
||||
#endif
|
||||
} else {
|
||||
debug << "QStyleOption(";
|
||||
}
|
||||
debug << "rect=" << option->rect.width() << 'x' << option->rect.height()
|
||||
<< forcesign << option->rect.x() << option->rect.y() << noforcesign;
|
||||
if (option->state != QStyle::State_None)
|
||||
debug << ", state=" << option->state;
|
||||
#if QT_VERSION >= 0x050000
|
||||
if (option->styleObject && !option->styleObject->isWidgetType())
|
||||
debug << ", styleObject=" << option->styleObject;
|
||||
#endif
|
||||
debug << ')';
|
||||
return debug;
|
||||
}
|
||||
|
|
@ -132,6 +155,15 @@ QRect DebugProxyStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap &
|
|||
return result;
|
||||
}
|
||||
|
||||
int DebugProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget,
|
||||
QStyleHintReturn *returnData) const
|
||||
{
|
||||
const int result = QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||
qDebug() << __FUNCTION__ << hint << option << widget << "returnData="
|
||||
<< returnData << "returns" << result;
|
||||
return result;
|
||||
}
|
||||
|
||||
int DebugProxyStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
|
||||
{
|
||||
const int result = QProxyStyle::pixelMetric(metric, option, widget);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public:
|
|||
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const;
|
||||
QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const;
|
||||
QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
|
||||
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const;
|
||||
int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
|
||||
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const;
|
||||
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue