MCPcopy Create free account
hub / github.com/Kitware/ParaView / mousePressEvent

Method mousePressEvent

Qt/Python/pqPythonTabWidget.cxx:196–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196void pqPythonTabWidget::mousePressEvent(QMouseEvent* mouseEvent)
197{
198 if (mouseEvent->button() == Qt::RightButton)
199 {
200 const QPoint& mousePosition = mouseEvent->pos();
201 const int tabIndex = this->tabBar()->tabAt(mousePosition);
202
203 if (tabIndex >= 0 && tabIndex < this->count())
204 {
205 QMenu contextMenu;
206
207 QAction closeTabAction;
208 closeTabAction.setText(tr("Close"));
209 this->connect(&closeTabAction, &QAction::triggered,
210 [this, tabIndex]() { this->tabCloseRequested(tabIndex); });
211 contextMenu.addAction(&closeTabAction);
212
213#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
214 contextMenu.exec(mouseEvent->globalPos());
215#else
216 contextMenu.exec(mouseEvent->globalPosition().toPoint());
217#endif
218 }
219
220 mouseEvent->accept();
221 }
222
223 mouseEvent->ignore();
224}
225
226//-----------------------------------------------------------------------------
227void pqPythonTabWidget::updateTab(QWidget* widget)

Callers

nothing calls this directly

Calls 6

trFunction · 0.85
countMethod · 0.45
setTextMethod · 0.45
connectMethod · 0.45
execMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected