mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added confirmation dialog when closing a tab
This commit is contained in:
parent
4cb666b75a
commit
fb750d6d85
1 changed files with 12 additions and 2 deletions
|
@ -324,15 +324,25 @@ void NotebookTab::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
this->mouseDown = false;
|
this->mouseDown = false;
|
||||||
|
|
||||||
|
auto removeThisPage = [this] {
|
||||||
|
auto reply = QMessageBox::question(this, "Remove this tab",
|
||||||
|
"Are you sure that you want to remove this tab?",
|
||||||
|
QMessageBox::Yes | QMessageBox::Cancel);
|
||||||
|
|
||||||
|
if (reply == QMessageBox::Yes) {
|
||||||
|
this->notebook->removePage(this->page);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (event->button() == Qt::MiddleButton) {
|
if (event->button() == Qt::MiddleButton) {
|
||||||
if (this->rect().contains(event->pos())) {
|
if (this->rect().contains(event->pos())) {
|
||||||
this->notebook->removePage(this->page);
|
removeThisPage();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this->hasXButton() && this->mouseDownX && this->getXRect().contains(event->pos())) {
|
if (this->hasXButton() && this->mouseDownX && this->getXRect().contains(event->pos())) {
|
||||||
this->mouseDownX = false;
|
this->mouseDownX = false;
|
||||||
|
|
||||||
this->notebook->removePage(this->page);
|
removeThisPage();
|
||||||
} else {
|
} else {
|
||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue