''' Created on Apr 15, 2015 @author: pjk ''' import sys from PyQt4 import QtGui, QtCore, QtDeclarative VIDEO_QML_GUI = 'qml/USBVideo.qml' class VideoApplication(QtDeclarative.QDeclarativeView): ''' classdocs ''' global rootObject def __init__(self, parent=None): ''' Constructor ''' QtDeclarative.QDeclarativeView.__init__(self, parent) self.setStyleSheet("background:transparent") self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) self.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView) self.setSource(QtCore.QUrl("VIDEO_QML_GUI) self.setGeometry(0, 0, 1280, 720) self.Setup() self.rootObject = self.rootObject() if __name__ == '__main__': app = QtGui.QApplication(sys.argv) video_ui = VideoApplication() video_ui.show() sys.exit(app.exec_())
USBVideo.qml은 Item컴포넌트를 사용해서 구현하였고 python코드에서 이부분이 창의 특성을 투명으로 설정한다.
self.setStyleSheet("background:transparent") self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
대략 이런 모습이 나온다.