Example #1
0
EditorTab::EditorTab(QWidget *parent)
	: QTabWidget(parent)
{
	this->setTabsClosable(true);
    this->setTabShape(Triangular);

	LoadStyleSheet(this, "style_code_tab.css");

	connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));

	//create context menu
	context= new QMenu(this);		
	LoadStyleSheet(context, "style_menu.css");
	QAction * action = context->addAction("Close tab");
	connect(action, SIGNAL(triggered()), this, SLOT(closeThis()));
	action = context->addAction("Close all but this");
	connect(action, SIGNAL(triggered()), this, SLOT(closeAllButThis()));
	//projectContext->addAction(action);
	//projectContext->addSeparator();
}
Example #2
0
EditorTab::EditorTab(QWidget *parent)
	: QTabWidget(parent)
{
	this->setTabsClosable(true);
	this->setTabShape(Triangular);

	LoadStyleSheet(this, "style_code_tab.css");

	connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));

	//create context menu
	context= new QMenu(this);		
	LoadStyleSheet(context, "style_menu.css");
	QAction * action = context->addAction("Close tab");
	connect(action, SIGNAL(triggered()), this, SLOT(closeThis()));
	action = context->addAction("Close all but this");
	connect(action, SIGNAL(triggered()), this, SLOT(closeAllButThis()));

	tabBar()->installEventFilter( this );

    setAttribute(Qt::WA_DeleteOnClose);
}