mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 14:47:12 -05:00
hack around qt bug in restoreGeom()
This commit is contained in:
parent
4ced0f326f
commit
68cdde20aa
3 changed files with 12 additions and 4 deletions
|
|
@ -359,7 +359,7 @@ class EditDeck(QMainWindow):
|
|||
self.dialog = ankiqt.forms.cardlist.Ui_MainWindow()
|
||||
self.dialog.setupUi(self)
|
||||
self.setUnifiedTitleAndToolBarOnMac(True)
|
||||
restoreGeom(self, "editor")
|
||||
restoreGeom(self, "editor", 38)
|
||||
restoreState(self, "editor")
|
||||
restoreSplitter(self.dialog.splitter, "editor")
|
||||
self.dialog.splitter.setChildrenCollapsible(False)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ from anki.stdmodels import BasicModel
|
|||
from anki.hooks import runHook, addHook, removeHook, _hooks, wrap
|
||||
from anki.deck import newCardOrderLabels, newCardSchedulingLabels
|
||||
from anki.deck import revCardOrderLabels, failedCardOptionLabels
|
||||
from ankiqt.ui.utils import saveGeom, restoreGeom, saveState, restoreState
|
||||
import anki.lang
|
||||
import anki.deck
|
||||
import ankiqt
|
||||
|
|
@ -67,8 +68,8 @@ class AnkiQt(QMainWindow):
|
|||
self.setupProgressInfo()
|
||||
self.setupBackups()
|
||||
if self.config['mainWindowState']:
|
||||
self.restoreGeometry(self.config['mainWindowGeom'])
|
||||
self.restoreState(self.config['mainWindowState'])
|
||||
restoreGeom(self, "mainWindow", 21)
|
||||
restoreState(self, "mainWindow")
|
||||
else:
|
||||
self.resize(500, 500)
|
||||
# load deck
|
||||
|
|
|
|||
|
|
@ -215,10 +215,17 @@ def saveGeom(widget, key):
|
|||
key += "Geom"
|
||||
ankiqt.mw.config[key] = widget.saveGeometry()
|
||||
|
||||
def restoreGeom(widget, key):
|
||||
def restoreGeom(widget, key, offset=None):
|
||||
key += "Geom"
|
||||
if ankiqt.mw.config.get(key):
|
||||
widget.restoreGeometry(ankiqt.mw.config[key])
|
||||
if sys.platform.startswith("darwin") and offset:
|
||||
from ankiqt.ui.main import QtConfig as q
|
||||
minor = (q.qt_version & 0x00ff00) >> 8
|
||||
if minor > 6:
|
||||
# bug in osx toolkit
|
||||
s = widget.size()
|
||||
widget.resize(s.width(), s.height()+offset*2)
|
||||
|
||||
def saveState(widget, key):
|
||||
key += "State"
|
||||
|
|
|
|||
Loading…
Reference in a new issue