QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgstooltipcombobox.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgscheckablecombobox.cpp
3 ------------------------
4 begin : May 25, 2023
5 copyright : (C) 2017 by Mathieu Pellerin
6 email : mathieu at opengis dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "qgstooltipcombobox.h"
19#include "moc_qgstooltipcombobox.cpp"
20
21#include <QEvent>
22#include <QHelpEvent>
23#include <QPoint>
24#include <QToolTip>
25
26
28 : QComboBox( parent )
29{
30}
31
32bool QgsToolTipComboBox::event( QEvent *event )
33{
34 if ( event->type() == QEvent::ToolTip )
35 {
36 const QString description = currentData( Qt::ToolTipRole ).toString();
37 if ( !description.isEmpty() )
38 {
39 QHelpEvent *helpEvent = static_cast< QHelpEvent *>( event );
40 QPoint pos = mapToGlobal( helpEvent->pos() );
41 QToolTip::showText( pos, description );
42 }
43 return true;
44 }
45 return QComboBox::event( event );
46}
bool event(QEvent *event) override
QgsToolTipComboBox(QWidget *parent=nullptr)
Constructor for QgsToolTipComboBox.