我在使用PyQt4 Python2.7中的QFrame时遇到了问题
当我显示QLineEdit时,不会绘制Qframe self.videoframeRemote
如果我删除了QlineEdit,则会被绘制
我找不到什么出错了。这是代码:
class Player(QtGui.QMainWindow):
def __init__(self, master=None):
QtGui.QMainWindow.__init__(self, master)
self.setWindowTitle("Media Player")
self.instance1 = vlc.Instance()
self.instance2 = vlc.Instance()
self.mediaplayerLocal = self.instance1.media_player_new()
self.mediaplayerRemote = self.instance2.media_player_new()
self.createUI()
self.isPaused = False
self.OpenWebCamMic()
def createUI(self):
self.widget = QtGui.QWidget(self)
self.setCentralWidget(self.widget)
self.vboxlayout = QtGui.QVBoxLayout()
self.hboxlayout = QtGui.QHBoxLayout()
# In this widget, the video will be drawn
self.videoframeLocal = QtGui.QFrame()
self.palette1 = self.videoframeLocal.palette()
self.palette1.setColor (QtGui.QPalette.Window, QtGui.QColor(0,0,0))
self.videoframeRemote = QtGui.QFrame()
self.palette2 = self.videoframeRemote.palette()
self.palette2.setColor (QtGui.QPalette.Window, QtGui.QColor(0,0,0))
self.videoframeLocal.setPalette(self.palette1)
self.videoframeLocal.setAutoFillBackground(True)
self.videoframeLocal.setMaximumSize(160, 120)
self.vboxlayout.addWidget(self.videoframeLocal)
self.URIbox = QtGui.QLineEdit("type SIP URI here")
self.URIbox.setMaximumSize(160, 30)
self.vboxlayout.addWidget(self.URIbox)
self.callButton = QtGui.QPushButton("Call")
self.callButton.setMaximumSize(160, 30)
self.vboxlayout.addWidget(self.callButton)
self.connect(self.callButton, QtCore.SIGNAL("clicked()"), self.establishCall)
self.byeButton = QtGui.QPushButton("Bye")
self.byeButton.setMaximumSize(160, 30)
self.vboxlayout.addWidget(self.byeButton)
self.connect(self.byeButton, QtCore.SIGNAL("clicked()"), self.Bye)
self.hboxlayout.addLayout(self.vboxlayout)
self.videoframeRemote.setPalette(self.palette2)
self.videoframeRemote.setAutoFillBackground(True)
self.videoframeRemote.setMaximumSize(640, 480)
self.hboxlayout.addWidget(self.videoframeRemote)
self.widget.setLayout(self.hboxlayout)
self.timer = QtCore.QTimer(self)
self.timer.setInterval(200)
self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.updateUI)
有什么建议吗?
问候,
CK
答案 0 :(得分:0)
谢谢Bakuriu,
添加self.videoframeRemote.setMinimumSize(640, 480)
使视频框架可见!