我正在打开应用程序中的多个文件。对于大文件,它需要几秒钟才能打开,因此我显示了一个QWidget,它的状态是打开的文件。在
主应用程序将一个信号传递给qwidget,标题栏得到更新。在
我使用setWindowFlags(Qt.WindowTitleHint)
来删除最小化/最大化按钮。在
{1美元^
#This is the method for reading files in the main class
#Some other method passes filenames to this method
def readfiles(self,filenames):
fopenstins=FileOpenStatusWidget()
fopenstins.show()
for i in range(len(filenames)): # Read files one by one
self.emit(SIGNAL('fopenstsig'),i+1,len(filenames))
#### More Code for reading files#####
class FileOpenStatusWidget(QtGui.QWidget):
def __init__(self):
super(FileOpenStatusWidget, self).__init__()
self.connect(main,SIGNAL('fopenstsig'),self.qwrtt)
self.layout = QtGui.QVBoxLayout()
self.status=QtGui.QLabel()
self.layout.addWidget(self.status) # This does not work -- Window remains blank
self.setWindowFlags(Qt.WindowTitleHint)
self.setLayout(self.layout)
def qwrtt(self,openedfiles,totalfiles):
self.status.setText('Opening File '+str(openedfiles)+'/'+str(totalfiles))
if openedfiles==totalfiles:
self.hide()
else:
self.setWindowTitle(self.status.text())
使用标志的组合:
Qt.CustomizeWindowHint | Qt.WindowTitleHint
。在窗口图标和关闭按钮由默认添加的
Qt.WindowSystemMenuHint
控制。Qt.CustomizeWindowHint
禁用所有默认提示。在相关问题 更多 >
编程相关推荐