diff --git a/ankiqt/ui/facteditor.py b/ankiqt/ui/facteditor.py index 20c47d070..c15f74dd9 100644 --- a/ankiqt/ui/facteditor.py +++ b/ankiqt/ui/facteditor.py @@ -16,8 +16,6 @@ import ankiqt from ankiqt.ui.utils import mungeQA, saveGeom, restoreGeom, getBase from anki.hooks import addHook, removeHook, runHook, runFilter from sqlalchemy.exceptions import InvalidRequestError -from PyQt4 import pyqtconfig -QtConfig = pyqtconfig.Configuration() clozeColour = "#0000ff" @@ -711,7 +709,7 @@ class FactEditor(object): self.setForeground(w) def _needExtraWord(self): - ver = QtConfig.qt_version >> 8 + ver = ui.main.QtConfig.qt_version >> 8 if ver == 0x404: # qt4.4 behaviour is wrong return False diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 9b9cf62dd..937c15f90 100755 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -9,6 +9,8 @@ from operator import itemgetter from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import QWebPage +from PyQt4 import pyqtconfig +QtConfig = pyqtconfig.Configuration() from anki import DeckStorage from anki.errors import * from anki.sound import hasSound, playFromText, clearAudioQueue, stripSounds @@ -1709,6 +1711,10 @@ learnt today") if self.config['simpleToolbar']: self.removeToolBar(mw.toolBar) mw.toolBar.hide() + ver = QtConfig.qt_version >> 8 + if ver >= 0x407: + # this became necessary in 4.7 or we end up with two toolbars + mw.toolBar.deleteLater() mw.toolBar = QToolBar(self) mw.toolBar.setObjectName("toolBar") mw.toolBar.addAction(mw.actionAddcards)