Skip to content

Commit

Permalink
Bug fix in popup menu UI for tabwidget
Browse files Browse the repository at this point in the history
  • Loading branch information
NishantWankhade committed Sep 18, 2023
1 parent 26d52f6 commit 2c1356e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions FrameWorkCode/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,8 @@ void MainWindow::mousePressEvent(QMouseEvent *ev)

if(ev->button() == Qt::RightButton){
QPoint point_c = ev->pos();
if(ui->tabWidget->rect().contains(point_c) ){
qDebug()<<ui->tabWidget->currentWidget()->objectName();
if(ui->tabWidget->rect().contains(point_c) && ui->tabWidget->currentWidget()->objectName() == "tab"){
ui->textEdit->setContextMenuPolicy(Qt::CustomContextMenu);

QObject::connect(ui->textEdit, &QTextEdit::customContextMenuRequested, [=](const QPoint &pos) {
Expand Down Expand Up @@ -891,7 +892,7 @@ void MainWindow::mousePressEvent(QMouseEvent *ev)
menu.close();
});
}
else if(ui->textEdit_dict->rect().contains(point_c)){
else if(ui->tabWidget->rect().contains(point_c) && ui->tabWidget->currentWidget()->objectName() == "tab_3"){
ui->textEdit_dict->setContextMenuPolicy(Qt::CustomContextMenu);

QObject::connect(ui->textEdit_dict, &QTextEdit::customContextMenuRequested, [=](const QPoint &pos) {
Expand Down

0 comments on commit 2c1356e

Please sign in to comment.