Fixes bug: tabs are not properly closed

This commit is contained in:
Olivier Keshavjee 2016-03-30 09:43:18 +02:00
parent 644d0c1c7b
commit 465c387284
2 changed files with 9 additions and 3 deletions

View file

@ -374,14 +374,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.stack.setCurrentIndex(1)
def closeProject(self):
# Close open tabs in editor
self.mainEditor.closeAllTabs()
# Save datas
self.saveDatas()
self.currentProject = None
QSettings().setValue("lastProject", "")
# FIXME: close all opened tabs in mainEditor
# Clear datas
self.loadEmptyDatas()
self.saveTimer.stop()

View file

@ -78,11 +78,15 @@ class mainEditor(QWidget, Ui_mainEditor):
self.updateThingsVisible(index)
def closeTab(self, index):
# FIXME: submit data if textedit?
w = self.tab.widget(index)
self.tab.removeTab(index)
w.setCurrentModelIndex(QModelIndex())
w.deleteLater()
def closeAllTabs(self):
while(self.tab.count()):
self.closeTab(0)
def allTabs(self):
return [self.tab.widget(i) for i in range(self.tab.count())]