Create standard close action
This commit is contained in:
parent
4c3a2df65c
commit
a5f4e4c54f
2 changed files with 21 additions and 3 deletions
|
|
@ -133,10 +133,13 @@ DatabaseWindow::DatabaseWindow(MasterController *master, QWidget *parent)
|
|||
|
||||
setCentralWidget(m_tabWidget);
|
||||
|
||||
createActions();
|
||||
|
||||
auto menuBar = new QMenuBar(this);
|
||||
setMenuBar(menuBar);
|
||||
|
||||
m_mainToolBar = new QToolBar(this);
|
||||
m_mainToolBar->addAction(m_closeAction);
|
||||
addToolBar(Qt::TopToolBarArea, m_mainToolBar);
|
||||
|
||||
auto statusBar = new QStatusBar(this);
|
||||
|
|
@ -158,6 +161,18 @@ DatabaseWindow::~DatabaseWindow()
|
|||
// delete ui;
|
||||
}
|
||||
|
||||
void DatabaseWindow::createActions()
|
||||
{
|
||||
{
|
||||
auto action = m_closeAction = new QAction(this);
|
||||
QIcon icon;
|
||||
icon.addFile(QString::fromUtf8(":/icons/page_white_delete.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
action->setIcon(icon);
|
||||
connect(m_closeAction, &QAction::triggered, this, &DatabaseWindow::actionClose_triggered);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QueryTab* DatabaseWindow::newSqlPage()
|
||||
{
|
||||
QueryTab *qt = new QueryTab(m_context);
|
||||
|
|
@ -293,9 +308,8 @@ void DatabaseWindow::on_actionExport_data_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
void DatabaseWindow::on_actionClose_triggered()
|
||||
void DatabaseWindow::actionClose_triggered()
|
||||
{
|
||||
//close();
|
||||
on_tabWidget_tabCloseRequested(m_tabWidget->currentIndex());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@ private:
|
|||
QTabWidget *m_tabWidget = nullptr;
|
||||
QToolBar *m_mainToolBar = nullptr;
|
||||
|
||||
// Standard actions
|
||||
QAction *m_closeAction = nullptr;
|
||||
|
||||
ConnectionConfig m_config;
|
||||
std::shared_ptr<OpenDatabase> m_database;
|
||||
|
||||
|
|
@ -140,6 +143,7 @@ private:
|
|||
|
||||
QFutureWatcher<LoadCatalog::Result> loadWatcher;
|
||||
|
||||
void createActions();
|
||||
QueryTab *GetActiveQueryTab();
|
||||
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
|
@ -161,7 +165,7 @@ private slots:
|
|||
void on_actionLoad_SQL_triggered();
|
||||
void on_actionSave_SQL_triggered();
|
||||
void on_actionExport_data_triggered();
|
||||
void on_actionClose_triggered();
|
||||
void actionClose_triggered();
|
||||
void on_actionAbout_triggered();
|
||||
void on_actionSave_SQL_as_triggered();
|
||||
void on_actionSave_copy_of_SQL_as_triggered();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue