MCPcopy Create free account
hub / github.com/KDE/kdevelop / event

Function event

kdevplatform/sublime/container.cpp:92–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90// class ContainerTabBar
91
92class ContainerTabBar : public QTabBar
93{
94 Q_OBJECT
95
96public:
97 explicit ContainerTabBar(Container* container)
98 : QTabBar(container), m_container(container)
99 {
100 if (QApplication::style()->objectName() == QLatin1String("macintosh")) {
101 static QPointer<QStyle> qTabBarStyle = QStyleFactory::create(QStringLiteral("fusion"));
102 if (qTabBarStyle) {
103 setStyle(qTabBarStyle);
104 }
105 }
106 // configure the QTabBar style so it behaves as appropriately as possible,
107 // even if we end up using the native Macintosh style because the user's
108 // Qt doesn't have the Fusion style installed.
109 setDocumentMode(true);
110 setUsesScrollButtons(true);
111 setElideMode(Qt::ElideNone);
112 }
113
114 bool event(QEvent* ev) override {
115 if(ev->type() == QEvent::ToolTip)
116 {
117 ev->accept();
118
119 auto* helpEvent = static_cast<QHelpEvent*>(ev);
120 int tab = tabAt(helpEvent->pos());
121
122 if(tab != -1)
123 {
124 m_container->showTooltipForTab(tab);
125 }
126
127 return true;
128 }
129
130 return QTabBar::event(ev);
131 }
132 void mousePressEvent(QMouseEvent* event) override {
133 if (event->button() == Qt::MiddleButton) {
134 // just close on midbutton, drag can still be done with left mouse button

Callers 6

eventMethod · 0.85
eventMethod · 0.85
eventMethod · 0.85
eventMethod · 0.85
eventMethod · 0.85
eventMethod · 0.85

Calls 4

posMethod · 0.80
showTooltipForTabMethod · 0.80
typeMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected