diff options
Diffstat (limited to 'src/widgets/kernel/qwhatsthis.cpp')
-rw-r--r-- | src/widgets/kernel/qwhatsthis.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 67ea6a7604..c80f37267f 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -20,7 +20,7 @@ #include <qpa/qplatformtheme.h> #include "private/qtextdocumentlayout_p.h" #include "qdebug.h" -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) #include "qaccessible.h" #endif @@ -97,8 +97,6 @@ QT_BEGIN_NAMESPACE \sa QToolTip */ -Q_CORE_EXPORT void qDeleteInEventHandler(QObject *o); - class QWhatsThat : public QWidget { Q_OBJECT @@ -110,7 +108,6 @@ public: static QWhatsThat *instance; protected: - void showEvent(QShowEvent *e) override; void mousePressEvent(QMouseEvent*) override; void mouseReleaseEvent(QMouseEvent*) override; void mouseMoveEvent(QMouseEvent*) override; @@ -123,7 +120,6 @@ private: QString text; QTextDocument* doc; QString anchor; - QPixmap background; }; QWhatsThat *QWhatsThat::instance = nullptr; @@ -197,11 +193,6 @@ QWhatsThat::~QWhatsThat() delete doc; } -void QWhatsThat::showEvent(QShowEvent *) -{ - background = QGuiApplication::primaryScreen()->grabWindow(0, x(), y(), width(), height()); -} - void QWhatsThat::mousePressEvent(QMouseEvent* e) { pressed = true; @@ -261,7 +252,6 @@ void QWhatsThat::paintEvent(QPaintEvent*) if (drawShadow) r.adjust(0, 0, -shadowWidth, -shadowWidth); QPainter p(this); - p.drawPixmap(0, 0, background); p.setPen(QPen(palette().toolTipText(), 0)); p.setBrush(palette().toolTipBase()); p.drawRect(r); @@ -366,7 +356,7 @@ QWhatsThisPrivate::QWhatsThisPrivate() QGuiApplication::setOverrideCursor(Qt::WhatsThisCursor); #endif } -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QAccessibleEvent event(this, QAccessible::ContextHelpStart); QAccessible::updateAccessibility(&event); #endif @@ -381,7 +371,7 @@ QWhatsThisPrivate::~QWhatsThisPrivate() #ifndef QT_NO_CURSOR QGuiApplication::restoreOverrideCursor(); #endif -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QAccessibleEvent event(this, QAccessible::ContextHelpEnd); QAccessible::updateAccessibility(&event); #endif @@ -428,7 +418,7 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e) break; case QEvent::KeyPress: { - QKeyEvent* kev = (QKeyEvent*)e; + QKeyEvent *kev = static_cast<QKeyEvent *>(e); #if QT_CONFIG(shortcut) if (kev->matches(QKeySequence::Cancel)) { QWhatsThis::leaveWhatsThisMode(); @@ -472,7 +462,7 @@ QWhatsThisAction::QWhatsThisAction(QObject *parent) : QAction(tr("What's This?") setIcon(p); #endif setCheckable(true); - connect(this, SIGNAL(triggered()), this, SLOT(actionTriggered())); + connect(this, &QWhatsThisAction::triggered, this, &QWhatsThisAction::actionTriggered); #ifndef QT_NO_SHORTCUT setShortcut(Qt::ShiftModifier | Qt::Key_F1); #endif @@ -618,7 +608,7 @@ void QWhatsThis::showText(const QPoint &pos, const QString &text, QWidget *w) */ void QWhatsThis::hideText() { - qDeleteInEventHandler(QWhatsThat::instance); + delete QWhatsThat::instance; } /*! |