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

3
TODO
View File

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

View File

@@ -731,7 +731,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
return current_color return current_color
signal_sender = self.sender().objectName() signal_sender = self.sender().objectName()
if signal_sender == 'libraryBackground': if signal_sender == 'libraryBackground':
current_color = self.settings['listview_background'] current_color = self.settings['listview_background']
new_color = open_color_dialog(current_color) new_color = open_color_dialog(current_color)

View File

@@ -106,7 +106,8 @@ class Settings:
self.settings.setValue('windowSize', self.parent.size()) self.settings.setValue('windowSize', self.parent.size())
self.settings.setValue('windowPosition', self.parent.pos()) self.settings.setValue('windowPosition', self.parent.pos())
self.settings.setValue('currentView', self.parent.stackedWidget.currentIndex()) 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 = [] table_headers = []
for i in range(3): 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.setContext(QtCore.Qt.ApplicationShortcut)
self.exit_fs.activated.connect(self.exit_fullscreen) 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( # self.exit_all = QtWidgets.QShortcut(
# QtGui.QKeySequence('Ctrl+Q'), self.contentView) # QtGui.QKeySequence('Ctrl+Q'), self.contentView)
# self.exit_all.activated.connect(self.sneaky_exit) # self.exit_all.activated.connect(self.sneaky_exit)
@@ -466,6 +470,10 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
self.setCursor(QtCore.Qt.ArrowCursor) self.setCursor(QtCore.Qt.ArrowCursor)
self.parent.mouse_hide_timer.start(3000) 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): class PliantQTextBrowser(QtWidgets.QTextBrowser):
def __init__(self, main_window, parent=None): def __init__(self, main_window, parent=None):
@@ -519,6 +527,9 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
else: else:
self.parent.metadata['position']['last_visible_text'] = visible_text self.parent.metadata['position']['last_visible_text'] = visible_text
def closeEvent(self, *args):
self.main_window.closeEvent()
# def mouseMoveEvent(self, event): # def mouseMoveEvent(self, event):
# TODO # TODO
# This does not work as expected # This does not work as expected