def __init__(self, topWin, parent=None): super(Titlebar, self).__init__(parent) self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) self.topWin = topWin self._oldPos = None self._pressFlag = False self.setContentsMargins(0, 0, 0, 0) setObjectTransparent(self) # init buttons. themeButton = getObjectWidget("themeButton") menuButton = getObjectWidget("menuButton") minButton = getObjectWidget("minButton") closeButton = getObjectWidget("closeButton") closeButton.clicked.connect(self.onCloseButtonClicked) layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 5, 0) layout.setSpacing(0) layout.addStretch() layout.addWidget(themeButton) layout.addWidget(menuButton) layout.addWidget(minButton) layout.addWidget(closeButton) self.setLayout(layout)
def __init__(self, model, parent=None): super(ChatView, self).__init__(parent) setObjectTransparent(self) self.setStyleSheet("background: transparent; border: none;") self.viewport().setAutoFillBackground(False) self.viewport().setContentsMargins(0, 0, 0, 0) self.setContentsMargins(0, 0, 0, 0) itemDelegate = MessageDelegate() self.setItemDelegate(itemDelegate) self.setModel(model)
def __init__(self, parent=None): super(DWindow, self).__init__(parent) # transparent self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) setObjectTransparent(self) self.setStyleSheet("background: transparent; border: none;") self.borderMargin = 2 self.contentMargin = 1 self.fullMargin = self.borderMargin + self.contentMargin self.setContentsMargins(self.fullMargin, self.fullMargin, self.fullMargin+1, self.fullMargin+1) # renders self.pix = QtGui.QPixmap()