[英]PySide - GUI inactive zone on the menu bar
I am coding a GUI in PySide for a couple of month now. 我现在在PySide中编写GUI已有两个月了。 This soft is half developed using Qt designer and half hard coded.
该软件一半使用Qt设计器开发,一半使用硬编码。 It is a MainWindow soft with a central widget and a lot of docks.
这是一个MainWindow软件,带有一个中央小部件和许多扩展坞。
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 将Qt Designer输出转换为python代码的代码是
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: 仅当使用以下代码将某些扩展坞添加到MainWindow时,才会出现该错误:
self.variablesDock = VariablesDock(self,self.dataCurve)
where self is mainWindow. 其中self是mainWindow。 The
VariablesDock
class is the following VariablesDock
类如下
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__(mainWindow)
更改为
super(VariablesDock,self).__init__(None)
the error disappeared. 错误消失了。
Cheers 干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.