From 1c80d056e4f45b4ee7c4863cd792e83c889513c5 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 7 Apr 2020 17:49:43 +0200 Subject: [PATCH] Port QT_NO_TOOLTIP to QT_CONFIG(tooltip) We remove the QT_NO_TOOLTIP check from qstandarditemmodel.h, because as the 'tooltip' feature is in QtWidgets, we cannot use it properly in QtGui. Also this affects just two non-virtual inline methods, i.e. it has no effect on library size. Task-number: QTBUG-82785 Change-Id: Ic166f14fb1cf3e9dd789573a6b9db6a87fb50e10 Reviewed-by: Tasuku Suzuki Reviewed-by: Kai Koehne --- src/gui/itemmodels/qstandarditemmodel.h | 4 ---- src/widgets/accessible/complexwidgets.cpp | 2 ++ src/widgets/accessible/qaccessiblewidget.cpp | 4 +++- src/widgets/accessible/simplewidgets.cpp | 2 +- src/widgets/graphicsview/qgraphicsitem.cpp | 4 ++-- src/widgets/graphicsview/qgraphicsitem.h | 2 +- src/widgets/graphicsview/qgraphicsproxywidget.cpp | 4 ++-- src/widgets/graphicsview/qgraphicsscene.cpp | 6 ++++-- src/widgets/graphicsview/qgraphicsview.cpp | 2 +- src/widgets/itemviews/qabstractitemdelegate.cpp | 4 +++- src/widgets/itemviews/qabstractitemview.cpp | 2 ++ src/widgets/itemviews/qheaderview.cpp | 4 +++- src/widgets/itemviews/qlistwidget.h | 4 ++-- src/widgets/itemviews/qtablewidget.h | 4 ++-- src/widgets/itemviews/qtreewidget.h | 4 ++-- src/widgets/kernel/qapplication.cpp | 6 ++++-- src/widgets/kernel/qtooltip.cpp | 2 -- src/widgets/kernel/qtooltip.h | 6 +----- src/widgets/kernel/qwidget.cpp | 10 ++++++---- src/widgets/kernel/qwidget.h | 4 ++-- src/widgets/kernel/qwidget_p.h | 2 +- src/widgets/styles/qcommonstyle.cpp | 2 +- src/widgets/styles/qstylesheetstyle.cpp | 8 +++++--- src/widgets/util/qsystemtrayicon_x11.cpp | 2 +- src/widgets/widgets/qdockarealayout.cpp | 6 +++--- src/widgets/widgets/qmdisubwindow.cpp | 14 ++++++++------ src/widgets/widgets/qmenu.cpp | 6 ++++-- src/widgets/widgets/qtabbar.cpp | 12 +++++++----- src/widgets/widgets/qtabbar.h | 2 +- src/widgets/widgets/qtabbar_p.h | 2 +- src/widgets/widgets/qtabwidget.cpp | 4 ++-- src/widgets/widgets/qtabwidget.h | 2 +- src/widgets/widgets/qtoolbox.cpp | 12 +++++++----- src/widgets/widgets/qtoolbox.h | 2 +- src/widgets/widgets/qtoolbutton.cpp | 4 +++- src/widgets/widgets/qwidgettextcontrol.cpp | 10 ++++++---- src/widgets/widgets/qwidgettextcontrol_p_p.h | 2 +- 37 files changed, 96 insertions(+), 76 deletions(-) diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h index f1c6e6df5c..a66054a04f 100644 --- a/src/gui/itemmodels/qstandarditemmodel.h +++ b/src/gui/itemmodels/qstandarditemmodel.h @@ -79,12 +79,10 @@ public: } inline void setIcon(const QIcon &icon); -#ifndef QT_NO_TOOLTIP inline QString toolTip() const { return qvariant_cast(data(Qt::ToolTipRole)); } inline void setToolTip(const QString &toolTip); -#endif #ifndef QT_NO_STATUSTIP inline QString statusTip() const { @@ -260,10 +258,8 @@ inline void QStandardItem::setText(const QString &atext) inline void QStandardItem::setIcon(const QIcon &aicon) { setData(aicon, Qt::DecorationRole); } -#ifndef QT_NO_TOOLTIP inline void QStandardItem::setToolTip(const QString &atoolTip) { setData(atoolTip, Qt::ToolTipRole); } -#endif #ifndef QT_NO_STATUSTIP inline void QStandardItem::setStatusTip(const QString &astatusTip) diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index ce2ceac938..42074b63fb 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -57,7 +57,9 @@ #endif #include #include +#if QT_CONFIG(tooltip) #include +#endif #if QT_CONFIG(whatsthis) #include #endif diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 1a7372728d..26341f805d 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -48,7 +48,9 @@ #if QT_CONFIG(label) #include "qlabel.h" #endif +#if QT_CONFIG(tooltip) #include "qtooltip.h" +#endif #if QT_CONFIG(whatsthis) #include "qwhatsthis.h" #endif @@ -425,7 +427,7 @@ QString QAccessibleWidget::text(QAccessible::Text t) const break; case QAccessible::Description: str = widget()->accessibleDescription(); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) if (str.isEmpty()) str = widget()->toolTip(); #endif diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 107fd729fe..5b09143189 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -545,7 +545,7 @@ void *QAccessibleDisplay::interface_cast(QAccessible::InterfaceType t) /*! \internal */ QString QAccessibleDisplay::imageDescription() const { -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) return widget()->toolTip(); #else return QString(); diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 12ee1713a9..42f997b104 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -2239,7 +2239,7 @@ bool QGraphicsItem::isBlockedByModalPanel(QGraphicsItem **blockingPanel) const return false; } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) /*! Returns the item's tool tip, or an empty QString if no tool tip has been set. @@ -2263,7 +2263,7 @@ void QGraphicsItem::setToolTip(const QString &toolTip) d_ptr->setExtra(QGraphicsItemPrivate::ExtraToolTip, toolTipVariant.toString()); itemChange(ItemToolTipHasChanged, toolTipVariant); } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) #ifndef QT_NO_CURSOR /*! diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h index 5989c428f1..dda61fbe65 100644 --- a/src/widgets/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -191,7 +191,7 @@ public: void setPanelModality(PanelModality panelModality); bool isBlockedByModalPanel(QGraphicsItem **blockingPanel = nullptr) const; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) QString toolTip() const; void setToolTip(const QString &toolTip); #endif diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 13b4638299..42211c7ccf 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -890,7 +890,7 @@ bool QGraphicsProxyWidget::event(QEvent *event) } break; } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::GraphicsSceneHelp: { // Propagate the help event (for tooltip) to the widget under mouse if (d->lastWidgetUnderMouse) { @@ -981,7 +981,7 @@ bool QGraphicsProxyWidget::eventFilter(QObject *object, QEvent *event) d->styleChangeMode = QGraphicsProxyWidgetPrivate::NoMode; } break; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::ToolTipChange: // Propagate tooltip change to the proxy. if (!d->tooltipChangeMode) { diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 7c677f7d9c..d5ab1afd92 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -238,7 +238,9 @@ #include #include #include +#if QT_CONFIG(tooltip) #include +#endif #include #include #include @@ -3729,7 +3731,7 @@ void QGraphicsScene::focusOutEvent(QFocusEvent *focusEvent) */ void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent) { -#ifdef QT_NO_TOOLTIP +#if !QT_CONFIG(tooltip) Q_UNUSED(helpEvent); #else // Find the first item that does tooltips @@ -3860,7 +3862,7 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv */ void QGraphicsScenePrivate::leaveScene(QWidget *viewport) { -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) QToolTip::hideText(); #endif QGraphicsView *view = qobject_cast(viewport->parent()); diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 9c8042ba1a..ca14e03a72 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -2888,7 +2888,7 @@ bool QGraphicsView::viewportEvent(QEvent *event) QCoreApplication::sendEvent(d->scene, event); break; } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::ToolTip: { QHelpEvent *toolTip = static_cast(event); QGraphicsSceneHelpEvent helpEvent(QEvent::GraphicsSceneHelp); diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index 42a0d3e499..52d7d54595 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -45,7 +45,9 @@ #if QT_CONFIG(whatsthis) #include #endif +#if QT_CONFIG(tooltip) #include +#endif #include #include #include @@ -369,7 +371,7 @@ bool QAbstractItemDelegate::helpEvent(QHelpEvent *event, return false; Q_D(QAbstractItemDelegate); switch (event->type()) { -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::ToolTip: { QHelpEvent *he = static_cast(event); const int precision = inherits("QItemDelegate") ? 10 : 6; // keep in sync with DBL_DIG in qitemdelegate.cpp diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 18b4a620b5..2b44bac2f3 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -49,7 +49,9 @@ #endif #include #include +#if QT_CONFIG(tooltip) #include +#endif #include #if QT_CONFIG(lineedit) #include diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index bd79710b05..fce0834628 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -45,7 +45,9 @@ #include #include #include +#if QT_CONFIG(tooltip) #include +#endif #if QT_CONFIG(whatsthis) #include #endif @@ -2756,7 +2758,7 @@ bool QHeaderView::viewportEvent(QEvent *e) { Q_D(QHeaderView); switch (e->type()) { -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::ToolTip: { QHelpEvent *he = static_cast(e); int logical = logicalIndexAt(he->pos()); diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h index 26bbe5dd80..b2435cf36e 100644 --- a/src/widgets/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -93,7 +93,7 @@ public: { return data(Qt::StatusTipRole).toString(); } inline void setStatusTip(const QString &statusTip); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) inline QString toolTip() const { return data(Qt::ToolTipRole).toString(); } inline void setToolTip(const QString &toolTip); @@ -165,7 +165,7 @@ inline void QListWidgetItem::setIcon(const QIcon &aicon) inline void QListWidgetItem::setStatusTip(const QString &astatusTip) { setData(Qt::StatusTipRole, astatusTip); } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) inline void QListWidgetItem::setToolTip(const QString &atoolTip) { setData(Qt::ToolTipRole, atoolTip); } #endif diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h index 53c55525cb..825311ea74 100644 --- a/src/widgets/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -113,7 +113,7 @@ public: { return data(Qt::StatusTipRole).toString(); } inline void setStatusTip(const QString &statusTip); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) inline QString toolTip() const { return data(Qt::ToolTipRole).toString(); } inline void setToolTip(const QString &toolTip); @@ -187,7 +187,7 @@ inline void QTableWidgetItem::setIcon(const QIcon &aicon) inline void QTableWidgetItem::setStatusTip(const QString &astatusTip) { setData(Qt::StatusTipRole, astatusTip); } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) inline void QTableWidgetItem::setToolTip(const QString &atoolTip) { setData(Qt::ToolTipRole, atoolTip); } #endif diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h index 06187d3de4..03291ae2db 100644 --- a/src/widgets/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -113,7 +113,7 @@ public: { return data(column, Qt::StatusTipRole).toString(); } inline void setStatusTip(int column, const QString &statusTip); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) inline QString toolTip(int column) const { return data(column, Qt::ToolTipRole).toString(); } inline void setToolTip(int column, const QString &toolTip); @@ -220,7 +220,7 @@ inline void QTreeWidgetItem::setStatusTip(int column, const QString &astatusTip) { setData(column, Qt::StatusTipRole, astatusTip); } #endif -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) inline void QTreeWidgetItem::setToolTip(int column, const QString &atoolTip) { setData(column, Qt::ToolTipRole, atoolTip); } #endif diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index c5577e2772..27af52e199 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -58,7 +58,9 @@ #include "qstyle.h" #include "qstyleoption.h" #include "qstylefactory.h" +#if QT_CONFIG(tooltip) #include "qtooltip.h" +#endif #include "qtranslator.h" #include "qvariant.h" #include "qwidget.h" @@ -515,7 +517,7 @@ void QApplicationPrivate::init() void qt_init_tooltip_palette() { -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) if (const QPalette *toolTipPalette = QGuiApplicationPrivate::platformTheme()->palette(QPlatformTheme::ToolTipPalette)) QToolTip::setPalette(*toolTipPalette); #endif @@ -3157,7 +3159,7 @@ QT_WARNING_POP break; #endif // QT_CONFIG(tabletevent) -#if !defined(QT_NO_TOOLTIP) || QT_CONFIG(whatsthis) +#if QT_CONFIG(tooltip) || QT_CONFIG(whatsthis) case QEvent::ToolTip: case QEvent::WhatsThis: case QEvent::QueryWhatsThis: diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index 661568dcad..eda3be0ba3 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -57,7 +57,6 @@ #include #include -#ifndef QT_NO_TOOLTIP #include #include #include @@ -628,4 +627,3 @@ void QToolTip::setFont(const QFont &font) QT_END_NAMESPACE #include "qtooltip.moc" -#endif // QT_NO_TOOLTIP diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h index 1b263a6629..9f786bdee1 100644 --- a/src/widgets/kernel/qtooltip.h +++ b/src/widgets/kernel/qtooltip.h @@ -43,11 +43,9 @@ #include #include +QT_REQUIRE_CONFIG(tooltip); QT_BEGIN_NAMESPACE - -#ifndef QT_NO_TOOLTIP - class Q_WIDGETS_EXPORT QToolTip { QToolTip() = delete; @@ -67,8 +65,6 @@ public: static void setFont(const QFont &); }; -#endif // QT_NO_TOOLTIP - QT_END_NAMESPACE #endif // QTOOLTIP_H diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 4e391bf4ae..8afacb9dab 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -64,7 +64,9 @@ #include #include "private/qwidgetwindow_p.h" #include "qpainter.h" +#if QT_CONFIG(tooltip) #include "qtooltip.h" +#endif #if QT_CONFIG(whatsthis) #include "qwhatsthis.h" #endif @@ -147,7 +149,7 @@ QWidgetPrivate::QWidgetPrivate(int version) #if !defined(QT_NO_IM) , imHints(Qt::ImhNone) #endif -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) , toolTipDuration(-1) #endif , directFontResolveMask(0) @@ -8972,7 +8974,7 @@ bool QWidget::event(QEvent *event) } } break; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::ToolTip: if (!d->toolTip.isEmpty()) QToolTip::showText(static_cast(event)->globalPos(), d->toolTip, this, QRect(), d->toolTipDuration); @@ -11237,7 +11239,7 @@ void QWidgetPrivate::setWindowModified_helper() } } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) /*! \property QWidget::toolTip @@ -11294,7 +11296,7 @@ int QWidget::toolTipDuration() const return d->toolTipDuration; } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 8ca75b67b0..d13e273292 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -182,7 +182,7 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText NOTIFY windowIconTextChanged) // deprecated Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity) Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified) -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) Q_PROPERTY(int toolTipDuration READ toolTipDuration WRITE setToolTipDuration) #endif @@ -382,7 +382,7 @@ public: qreal windowOpacity() const; bool isWindowModified() const; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) void setToolTip(const QString &); QString toolTip() const; void setToolTipDuration(int msec); diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index b71b72fe13..3e52a6ad2f 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -654,7 +654,7 @@ public: // Implicit pointers (shared_null/shared_empty). QRegion opaqueChildren; QRegion dirty; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) QString toolTip; int toolTipDuration; #endif diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index e3e6cb05df..413ec2ca2c 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5351,7 +5351,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_Menu_SupportsSections: ret = false; break; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case SH_ToolTip_WakeUpDelay: ret = 700; break; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 2b97b4d5ee..a180fbf4fd 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -65,7 +65,9 @@ #include "private/qmath_p.h" #include #include "private/qabstractscrollarea_p.h" +#if QT_CONFIG(tooltip) #include +#endif #include #if QT_CONFIG(toolbutton) #include @@ -987,7 +989,7 @@ QRenderRule::QRenderRule(const QVector &declarations, const QObject int adj = -255; hasFont = v.extractFont(&font, &adj); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) if (object && qstrcmp(object->metaObject()->className(), "QTipLabel") == 0) palette = QToolTip::palette(); #endif @@ -1508,7 +1510,7 @@ public: if (isNullNode(node)) return QStringList(); const QMetaObject *metaObject = OBJECT_PTR(node)->metaObject(); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) if (qstrcmp(metaObject->className(), "QTipLabel") == 0) return QStringList(QLatin1String("QToolTip")); #endif @@ -1560,7 +1562,7 @@ public: if (isNullNode(node)) return false; const QMetaObject *metaObject = OBJECT_PTR(node)->metaObject(); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) if (qstrcmp(metaObject->className(), "QTipLabel") == 0) return nodeName == QLatin1String("QToolTip"); #endif diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index 86c11f98ed..da8752be08 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -308,7 +308,7 @@ void QSystemTrayIconPrivate::updateToolTip_sys() } if (!sys) return; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) sys->setToolTip(toolTip); #endif } diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 87f4519dd6..693692d6c7 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2109,7 +2109,7 @@ bool QDockAreaLayoutInfo::updateTabBar() const quintptr id = tabId(item); if (tab_idx == tabBar->count()) { tabBar->insertTab(tab_idx, title); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) tabBar->setTabToolTip(tab_idx, title); #endif tabBar->setTabData(tab_idx, id); @@ -2119,7 +2119,7 @@ bool QDockAreaLayoutInfo::updateTabBar() const tabBar->removeTab(tab_idx); else { tabBar->insertTab(tab_idx, title); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) tabBar->setTabToolTip(tab_idx, title); #endif tabBar->setTabData(tab_idx, id); @@ -2128,7 +2128,7 @@ bool QDockAreaLayoutInfo::updateTabBar() const if (title != tabBar->tabText(tab_idx)) { tabBar->setTabText(tab_idx, title); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) tabBar->setTabToolTip(tab_idx, title); #endif } diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index f68f46a7f1..ddc11cd470 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -154,7 +154,9 @@ #if QT_CONFIG(whatsthis) #include #endif +#if QT_CONFIG(tooltip) #include +#endif #if QT_CONFIG(mainwindow) #include #endif @@ -290,7 +292,7 @@ static inline bool isHoverControl(QStyle::SubControl control) return control != QStyle::SC_None && control != QStyle::SC_TitleBarLabel; } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOptionComplex &opt, QStyle::ComplexControl complexControl, QStyle::SubControl subControl) { @@ -355,7 +357,7 @@ static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOpti const QRect rect = widget->style()->subControlRect(complexControl, &opt, subControl, widget); QToolTip::showText(helpEvent->globalPos(), toolTip, widget, rect); } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) namespace QMdi { /* @@ -416,7 +418,7 @@ bool ControlLabel::event(QEvent *event) updateWindowIcon(); setFixedSize(label.size()); } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) else if (event->type() == QEvent::ToolTip) { QStyleOptionTitleBar options; options.initFrom(this); @@ -673,14 +675,14 @@ void ControllerWidget::leaveEvent(QEvent * /*event*/) */ bool ControllerWidget::event(QEvent *event) { -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) if (event->type() == QEvent::ToolTip) { QStyleOptionComplex opt; initStyleOption(&opt); QHelpEvent *helpEvent = static_cast(event); showToolTip(helpEvent, this, opt, QStyle::CC_MdiControls, getSubControl(helpEvent->pos())); } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) return QWidget::event(event); } @@ -2874,7 +2876,7 @@ bool QMdiSubWindow::event(QEvent *event) case QEvent::FontChange: d->font = font(); break; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::ToolTip: showToolTip(static_cast(event), this, d->titleBarOptions(), QStyle::CC_TitleBar, d->hoveredSubControl); diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 86bc3d69be..0aca290484 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -73,7 +73,9 @@ #include "qtoolbutton.h" #endif #include "qpushbutton.h" +#if QT_CONFIG(tooltip) #include "qtooltip.h" +#endif #include #include #include @@ -3029,7 +3031,7 @@ QMenu::event(QEvent *e) if (d->currentAction) d->popupAction(d->currentAction, 0, false); break; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::ToolTip: if (d->toolTipsVisible) { const QHelpEvent *ev = static_cast(e); @@ -3041,7 +3043,7 @@ QMenu::event(QEvent *e) } } break; -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) #if QT_CONFIG(whatsthis) case QEvent::QueryWhatsThis: e->setAccepted(d->whatsThis.size()); diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 57339ebd74..670cdeb345 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -52,7 +52,9 @@ #if QT_CONFIG(tabwidget) #include "qtabwidget.h" #endif +#if QT_CONFIG(tooltip) #include "qtooltip.h" +#endif #if QT_CONFIG(whatsthis) #include "qwhatsthis.h" #endif @@ -1280,7 +1282,7 @@ void QTabBar::setTabIcon(int index, const QIcon & icon) } } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) /*! Sets the tool tip of the tab at position \a index to \a tip. */ @@ -1302,7 +1304,7 @@ QString QTabBar::tabToolTip(int index) const return tab->toolTip; return QString(); } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) #if QT_CONFIG(whatsthis) /*! @@ -1711,7 +1713,7 @@ bool QTabBar::event(QEvent *event) update(oldHoverRect); return true; } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::ToolTip: if (const QTabBarPrivate::Tab *tab = d->at(tabAt(static_cast(event)->pos()))) { if (!tab->toolTip.isEmpty()) { @@ -1720,7 +1722,7 @@ bool QTabBar::event(QEvent *event) } } break; -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) #if QT_CONFIG(whatsthis) case QEvent::QEvent::QueryWhatsThis: { const QTabBarPrivate::Tab *tab = d->at(d->indexAtPos(static_cast(event)->pos())); @@ -2785,7 +2787,7 @@ CloseButton::CloseButton(QWidget *parent) #ifndef QT_NO_CURSOR setCursor(Qt::ArrowCursor); #endif -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) setToolTip(tr("Close Tab")); #endif resize(sizeHint()); diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index 0cf331b6ab..cf98834853 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -120,7 +120,7 @@ public: Qt::TextElideMode elideMode() const; void setElideMode(Qt::TextElideMode mode); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) void setTabToolTip(int index, const QString &tip); QString tabToolTip(int index) const; #endif diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index ac4cbd32a8..63a80d687c 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -117,7 +117,7 @@ public: bool visible; int shortcutId; QString text; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) QString toolTip; #endif #if QT_CONFIG(whatsthis) diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 8885610e26..115a557e52 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -1209,7 +1209,7 @@ int QTabWidget::count() const return d->tabs->count(); } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) /*! Sets the tab tool tip for the page at position \a index to \a tip. @@ -1232,7 +1232,7 @@ QString QTabWidget::tabToolTip(int index) const Q_D(const QTabWidget); return d->tabs->tabToolTip(index); } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) #if QT_CONFIG(whatsthis) /*! diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h index ceec3f8dd8..b61a02bdc6 100644 --- a/src/widgets/widgets/qtabwidget.h +++ b/src/widgets/widgets/qtabwidget.h @@ -91,7 +91,7 @@ public: QIcon tabIcon(int index) const; void setTabIcon(int index, const QIcon & icon); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) void setTabToolTip(int index, const QString & tip); QString tabToolTip(int index) const; #endif diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp index 5500104afb..57d26bb6ee 100644 --- a/src/widgets/widgets/qtoolbox.cpp +++ b/src/widgets/widgets/qtoolbox.cpp @@ -47,7 +47,9 @@ #include #include #include +#if QT_CONFIG(tooltip) #include +#endif #include #include @@ -96,7 +98,7 @@ public: inline void setText(const QString &text) { button->setText(text); } inline void setIcon(const QIcon &is) { button->setIcon(is); } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) inline void setToolTip(const QString &tip) { button->setToolTip(tip); } inline QString toolTip() const { return button->toolTip(); } #endif @@ -638,7 +640,7 @@ void QToolBox::setItemIcon(int index, const QIcon &icon) c->setIcon(icon); } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) /*! Sets the tooltip of the item at position \a index to \a toolTip. */ @@ -650,7 +652,7 @@ void QToolBox::setItemToolTip(int index, const QString &toolTip) if (c) c->setToolTip(toolTip); } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) /*! Returns \c true if the item at position \a index is enabled; otherwise returns \c false. @@ -687,7 +689,7 @@ QIcon QToolBox::itemIcon(int index) const return (c ? c->icon() : QIcon()); } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) /*! Returns the tooltip of the item at position \a index, or an empty string if \a index is out of range. @@ -699,7 +701,7 @@ QString QToolBox::itemToolTip(int index) const const QToolBoxPrivate::Page *c = d->page(index); return (c ? c->toolTip() : QString()); } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) /*! \reimp */ void QToolBox::showEvent(QShowEvent *e) diff --git a/src/widgets/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h index 2796631b94..d12d4dcfec 100644 --- a/src/widgets/widgets/qtoolbox.h +++ b/src/widgets/widgets/qtoolbox.h @@ -76,7 +76,7 @@ public: void setItemIcon(int index, const QIcon &icon); QIcon itemIcon(int index) const; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) void setItemToolTip(int index, const QString &toolTip); QString itemToolTip(int index) const; #endif diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 410c326d51..e8cb502650 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -49,7 +49,9 @@ #include #include #include +#if QT_CONFIG(tooltip) #include +#endif #if QT_CONFIG(mainwindow) #include #endif @@ -944,7 +946,7 @@ void QToolButton::setDefaultAction(QAction *action) buttonText.replace(QLatin1String("&"), QLatin1String("&&")); setText(buttonText); setIcon(action->icon()); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) setToolTip(action->toolTip()); #endif #if QT_CONFIG(statustip) diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 41932214c1..e32f779bb0 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -84,7 +84,9 @@ #include #include #include +#if QT_CONFIG(tooltip) #include +#endif #include #if QT_CONFIG(lineedit) #include @@ -1074,13 +1076,13 @@ void QWidgetTextControl::processEvent(QEvent *e, const QTransform &transform, QW d->isEnabled = e->isAccepted(); break; -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) case QEvent::ToolTip: { QHelpEvent *ev = static_cast(e); d->showToolTip(ev->globalPos(), transform.map(ev->pos()), contextWidget); break; } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) #if QT_CONFIG(draganddrop) case QEvent::DragEnter: { @@ -2948,7 +2950,7 @@ void QWidgetTextControlPrivate::activateLinkUnderCursor(QString href) emit q_func()->linkActivated(href); } -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) void QWidgetTextControlPrivate::showToolTip(const QPoint &globalPos, const QPointF &pos, QWidget *contextWidget) { const QString toolTip = q_func()->cursorForPosition(pos).charFormat().toolTip(); @@ -2956,7 +2958,7 @@ void QWidgetTextControlPrivate::showToolTip(const QPoint &globalPos, const QPoin return; QToolTip::showText(globalPos, toolTip, contextWidget); } -#endif // QT_NO_TOOLTIP +#endif // QT_CONFIG(tooltip) bool QWidgetTextControlPrivate::isPreediting() const { diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h index c77a31bedf..7304b15106 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h @@ -171,7 +171,7 @@ public: void activateLinkUnderCursor(QString href = QString()); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) void showToolTip(const QPoint &globalPos, const QPointF &pos, QWidget *contextWidget); #endif