summaryrefslogtreecommitdiff
path: root/utils/themeeditor/editorwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/editorwindow.cpp')
-rw-r--r--utils/themeeditor/editorwindow.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index 4268788..a2fc11a 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -78,6 +78,12 @@ void EditorWindow::setupUI()
model->setRootPath(QDir::currentPath());
ui->fileTree->setModel(model);
+ /* Connecting the tab bar signals */
+ QObject::connect(ui->editorTabs, SIGNAL(currentChanged(int)),
+ this, SLOT(shiftTab(int)));
+ QObject::connect(ui->editorTabs, SIGNAL(tabCloseRequested(int)),
+ this, SLOT(closeTab(int)));
+
}
void EditorWindow::setupMenus()
@@ -102,6 +108,26 @@ void EditorWindow::newTab()
ui->editorTabs->addTab(doc, doc->getTitle());
}
+void EditorWindow::shiftTab(int index)
+{
+ if(index < 0)
+ ui->parseTree->setModel(0);
+ else
+ ui->parseTree->setModel(dynamic_cast<SkinDocument*>
+ (ui->editorTabs->currentWidget())->getModel());
+}
+
+void EditorWindow::closeTab(int index)
+{
+ SkinDocument* widget = dynamic_cast<SkinDocument*>
+ (ui->editorTabs->widget(index));
+ if(widget->requestClose())
+ {
+ ui->editorTabs->removeTab(index);
+ widget->deleteLater();
+ }
+}
+
void EditorWindow::showPanel()
{
if(sender() == ui->actionFile_Panel)