From 1c80d056e4f45b4ee7c4863cd792e83c889513c5 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 7 Apr 2020 17:49:43 +0200 Subject: 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/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 +- 6 files changed, 14 insertions(+), 16 deletions(-) (limited to 'src/widgets/kernel') 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 -- cgit v1.2.3