mirror of
https://github.com/leozide/leocad
synced 2024-12-27 21:58:37 +01:00
Close tab with middle mouse click (#363)
This commit is contained in:
parent
b42e3b7e31
commit
0bae463b71
2 changed files with 30 additions and 4 deletions
|
@ -30,6 +30,26 @@
|
|||
lcMainWindow* gMainWindow;
|
||||
#define LC_TAB_LAYOUT_VERSION 0x0001
|
||||
|
||||
void lcTabBar::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonRelease && event->button() == Qt::MidButton)
|
||||
tabCloseRequested(tabAt(event->pos()));
|
||||
else
|
||||
QTabBar::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
lcTabWidget::lcTabWidget()
|
||||
: QTabWidget()
|
||||
{
|
||||
setTabBar(new lcTabBar());
|
||||
}
|
||||
|
||||
lcTabWidget::~lcTabWidget()
|
||||
{
|
||||
if (tabBar())
|
||||
delete tabBar();
|
||||
}
|
||||
|
||||
void lcModelTabWidget::ResetLayout()
|
||||
{
|
||||
QLayout* TabLayout = layout();
|
||||
|
|
|
@ -30,18 +30,24 @@ struct lcSearchOptions
|
|||
char Name[256];
|
||||
};
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
typedef QTabWidget lcTabWidget;
|
||||
#else
|
||||
class lcTabBar : public QTabBar
|
||||
{
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
};
|
||||
|
||||
class lcTabWidget : public QTabWidget
|
||||
{
|
||||
public:
|
||||
lcTabWidget();
|
||||
~lcTabWidget();
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
QTabBar* tabBar()
|
||||
{
|
||||
return QTabWidget::tabBar();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
class lcModelTabWidget : public QWidget
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue