|
|
@ -39,6 +39,7 @@ |
|
|
|
#include <QDebug> |
|
|
|
#include <QDebug> |
|
|
|
#include <QEvent> |
|
|
|
#include <QEvent> |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMessageBox> |
|
|
|
|
|
|
|
#include <QMenu> |
|
|
|
#include <QMouseEvent> |
|
|
|
#include <QMouseEvent> |
|
|
|
#include <QObject> |
|
|
|
#include <QObject> |
|
|
|
#include <QRegularExpression> |
|
|
|
#include <QRegularExpression> |
|
|
@ -162,6 +163,15 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event) |
|
|
|
closeTab(tabIndex); |
|
|
|
closeTab(tabIndex); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (mouseEvent->button() == Qt::RightButton) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QMenu *menu = new QMenu(this); |
|
|
|
|
|
|
|
menu->setAttribute(Qt::WA_DeleteOnClose); |
|
|
|
|
|
|
|
menu->addAction(tr("Close tab"), this, [this, tabIndex]() { closeTab(tabIndex); }); |
|
|
|
|
|
|
|
menu->addAction(tr("Close all tabs"), this, &SearchWidget::closeAllTabs); |
|
|
|
|
|
|
|
menu->popup(QCursor::pos()); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return QWidget::eventFilter(object, event); |
|
|
|
return QWidget::eventFilter(object, event); |
|
|
@ -381,3 +391,9 @@ void SearchWidget::closeTab(int index) |
|
|
|
|
|
|
|
|
|
|
|
delete tab; |
|
|
|
delete tab; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SearchWidget::closeAllTabs() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
for (int i = (m_allTabs.size() - 1); i >= 0; --i) |
|
|
|
|
|
|
|
closeTab(i); |
|
|
|
|
|
|
|
} |
|
|
|