简体   繁体   中英

PySide - GUI inactive zone on the menu bar

I am coding a GUI in PySide for a couple of month now. This soft is half developed using Qt designer and half hard coded. It is a MainWindow soft with a central widget and a lot of docks.

Recently I realized that the menu bar (and a tiny bit of the task bar) had a zone which was 'inactive', ie the mouse can not access the menus directly. This zone is highlighted in green in the picture.

非活动区

The menus are working, since when I click on the right half of the configure menu button, I can access the File or Edit menu as shown in the following picture

在此处输入图片说明

The code translating the Qt designer output into python code is

call pyside-uic mainWindow.ui -o uiMainWindow.py
call pyside-rcc -o fittingRessources_rc.py pathtoressources\fittingRessources.qrc

I have tried to remove the icon of the soft. Move the task bars (in which case the buttons of the task bar are entirely active again). I have tried to remove the icons of the task bar. Nothing made a difference.

I can provide code if necessary, but first I was wondering if any of you already encountered this issue? and how it solved it? since it seems a bit ackward...

Cheers

The error appeared only when I was adding certain docks to the MainWindow using the following code:

self.variablesDock = VariablesDock(self,self.dataCurve)

where self is mainWindow. The VariablesDock class is the following

class VariablesDock(QWidget):
'''
Allows to define variables
'''

def __init__(self, mainWindow, dataCurve):
    '''
    Constructor
    '''
    super(VariablesDock,self).__init__(mainWindow)

    self.mainWindow = mainWindow
    self.dataCurve = dataCurve

    self.variablesDockWidget  = QtGui.QDockWidget(mainWindow)
    ... skip some code ...
    self.variablesDockWidget.setWidget(self.dockWidgetContents)
    mainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.variablesDockWidget)
    self.variablesDockWidget.setWindowTitle("Variables")

if I change the line super(VariablesDock,self).__init__(mainWindow) into

super(VariablesDock,self).__init__(None)

the error disappeared.

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM