fix qt4.7 duplicate toolbars

This commit is contained in:
Damien Elmes 2010-10-18 10:34:33 +09:00
parent ebd0ab5496
commit dcd6e2dfc3
2 changed files with 7 additions and 3 deletions

View file

@ -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

View file

@ -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)