Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用PySide灰显/具有不可见元素?_Python_Qt_Pyside - Fatal编程技术网

Python 如何使用PySide灰显/具有不可见元素?

Python 如何使用PySide灰显/具有不可见元素?,python,qt,pyside,Python,Qt,Pyside,我正在用PySide编写一个接口,我希望在执行另一个操作之前,该接口的某些元素将变灰/不可见/不可访问(例如,在加载文件之前计算文件中的单词是没有意义的),我认为这应该是可能的,但我似乎找不到方法 例如,我创建了以下菜单: # We create the actions for the edit menu countAction = QtGui.QAction(QtGui.QIcon('exit.png'), '&Count', self)

我正在用PySide编写一个接口,我希望在执行另一个操作之前,该接口的某些元素将变灰/不可见/不可访问(例如,在加载文件之前计算文件中的单词是没有意义的),我认为这应该是可能的,但我似乎找不到方法

例如,我创建了以下菜单:

        # We create the actions for the edit menu

        countAction = QtGui.QAction(QtGui.QIcon('exit.png'), '&Count', self)
        countAction.setShortcut('Ctrl+C')
        countAction.setStatusTip('Counts the points in the current point cloud')
        #openAction.triggered.connect(self.close)

        # We create the menus       

        editMenu = menuBar.addMenu('&Edit')

        # We add the actions to the edit menu
        editMenu.addAction(countAction)

如何使此菜单以及稍后的按钮和文本字段在发生特定事件(加载文件)之前不可执行?

Qt中的许多对象可以使用
setEnabled(False)
灰显,并使用
setEnabled(True)
重新启用。将其应用于QAction。

Qt中的许多对象可以使用
setEnabled(False)
灰显,并使用
setEnabled(True)
重新启用。把它应用到QAction上。

谢谢,我知道我忽略了一些简单的东西。谢谢,我知道我忽略了一些简单的东西。