Fullscreened widget closure saves settings

This commit is contained in:
BasioMeusPuga
2018-03-02 19:03:20 +05:30
parent 11ab2db5ea
commit c2850a9c77
4 changed files with 15 additions and 4 deletions

1
TODO
View File

@@ -64,7 +64,6 @@ TODO
✓ Define every widget in code
Bugs:
If there are files open and the database is deleted, TypeErrors result
Closing a fullscreened contentView does not save settings
Secondary:
Annotations

View File

@@ -106,7 +106,8 @@ class Settings:
self.settings.setValue('windowSize', self.parent.size())
self.settings.setValue('windowPosition', self.parent.pos())
self.settings.setValue('currentView', self.parent.stackedWidget.currentIndex())
self.settings.setValue('listViewBackground', self.parent.settings['listview_background'])
self.settings.setValue(
'listViewBackground', self.parent.settings['listview_background'])
table_headers = []
for i in range(3):

View File

@@ -207,6 +207,10 @@ class Tab(QtWidgets.QWidget):
self.exit_fs.setContext(QtCore.Qt.ApplicationShortcut)
self.exit_fs.activated.connect(self.exit_fullscreen)
# TODO
# See why Ctrl + Q stop working on a non fullscreened contentView
# widget in case the following is in code
# self.exit_all = QtWidgets.QShortcut(
# QtGui.QKeySequence('Ctrl+Q'), self.contentView)
# self.exit_all.activated.connect(self.sneaky_exit)
@@ -466,6 +470,10 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
self.setCursor(QtCore.Qt.ArrowCursor)
self.parent.mouse_hide_timer.start(3000)
def closeEvent(self, *args):
# In case the program is closed when a contentView is fullscreened
self.main_window.closeEvent()
class PliantQTextBrowser(QtWidgets.QTextBrowser):
def __init__(self, main_window, parent=None):
@@ -519,6 +527,9 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
else:
self.parent.metadata['position']['last_visible_text'] = visible_text
def closeEvent(self, *args):
self.main_window.closeEvent()
# def mouseMoveEvent(self, event):
# TODO
# This does not work as expected