1

我在 PyQt4 Python2.7 中显示 QFrame 时遇到问题。
当我显示 QLineEdit 时,self.videoframeRemote没有绘制 Qframe。
如果我删除 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

4

1 回答 1

0

谢谢巴库留,

添加self.videoframeRemote.setMinimumSize(640, 480)使视频帧可见!

于 2013-05-21T10:35:52.377 回答