add removeSplitAct to context menu of VEditWindow

Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
Le Tan 2016-11-06 13:34:00 +08:00
parent 915c25e1a5
commit d8aa464653
2 changed files with 12 additions and 0 deletions

View File

@ -14,11 +14,14 @@ VEditWindow::VEditWindow(VNote *vnote, QWidget *parent)
setTabsClosable(true); setTabsClosable(true);
setMovable(true); setMovable(true);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, &VEditWindow::tabCloseRequested, connect(this, &VEditWindow::tabCloseRequested,
this, &VEditWindow::handleTabCloseRequest); this, &VEditWindow::handleTabCloseRequest);
connect(this, &VEditWindow::tabBarClicked, connect(this, &VEditWindow::tabBarClicked,
this, &VEditWindow::handleTabbarClicked); this, &VEditWindow::handleTabbarClicked);
connect(this, &VEditWindow::customContextMenuRequested,
this, &VEditWindow::contextMenuRequested);
} }
void VEditWindow::setupCornerWidget() void VEditWindow::setupCornerWidget()
@ -294,3 +297,11 @@ void VEditWindow::mousePressEvent(QMouseEvent *event)
emit getFocused(); emit getFocused();
QTabWidget::mousePressEvent(event); QTabWidget::mousePressEvent(event);
} }
void VEditWindow::contextMenuRequested(QPoint pos)
{
QMenu menu(this);
menu.addAction(removeSplitAct);
menu.exec(this->mapToGlobal(pos));
}

View File

@ -51,6 +51,7 @@ private slots:
void splitWindow(); void splitWindow();
void removeSplit(); void removeSplit();
void handleTabbarClicked(int index); void handleTabbarClicked(int index);
void contextMenuRequested(QPoint pos);
private: private:
void setupCornerWidget(); void setupCornerWidget();