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, jid, parent=None): super(ChatWindow, self).__init__(parent) # set size self.setMinimumSize(QtCore.QSize(580, 600)) self.anchorLayout = QtWidgets.QGraphicsAnchorLayout() self.anchorLayout.setSpacing(0) self.anchorLayout.setMinimumSize(QtCore.QSizeF(self.contentsRect().width(), self.contentsRect().height())) titlebar = createProxyWidget(Titlebar(self), QtCore.QSizeF(self.rect().width(), -1)) mask = createProxyWidget(getObjectWidget("mask", QtWidgets.QLabel), minimum=QtCore.QSizeF(self.rect().width(), 136), maximum=QtCore.QSizeF(self.rect().width(), 136)) self.chatview = ChatView(model) _chatview = createProxyWidget(self.chatview, QtCore.QSizeF(self.rect().width(), -1)) self.anchorLayout.addAnchor(mask, QtCore.Qt.AnchorTop, self.anchorLayout, QtCore.Qt.AnchorTop) self.anchorLayout.addAnchor(titlebar, QtCore.Qt.AnchorTop, self.anchorLayout, QtCore.Qt.AnchorTop) self.anchorLayout.addAnchor(_chatview, QtCore.Qt.AnchorTop, mask, QtCore.Qt.AnchorBottom) self.anchorLayout.addAnchor(_chatview, QtCore.Qt.AnchorBottom, self.anchorLayout, QtCore.Qt.AnchorBottom) mainWidget = QtWidgets.QGraphicsWidget() mainWidget.setLayout(self.anchorLayout) # mainWidget.setPos(-5, -5) mainWidget.setPos(0, -5) self.addItem(mainWidget) self.model = model self.jid = jid
def __init__(self, model, jid, parent=None): super(ChatWindow, self).__init__(parent) # set size self.setMinimumSize(QtCore.QSize(580, 600)) self.anchorLayout = QtWidgets.QGraphicsAnchorLayout() self.anchorLayout.setSpacing(0) self.anchorLayout.setMinimumSize( QtCore.QSizeF(self.contentsRect().width(), self.contentsRect().height())) titlebar = createProxyWidget(Titlebar(self), QtCore.QSizeF(self.rect().width(), -1)) mask = createProxyWidget(getObjectWidget("mask", QtWidgets.QLabel), minimum=QtCore.QSizeF(self.rect().width(), 136), maximum=QtCore.QSizeF(self.rect().width(), 136)) self.chatview = ChatView(model) _chatview = createProxyWidget(self.chatview, QtCore.QSizeF(self.rect().width(), -1)) self.anchorLayout.addAnchor(mask, QtCore.Qt.AnchorTop, self.anchorLayout, QtCore.Qt.AnchorTop) self.anchorLayout.addAnchor(titlebar, QtCore.Qt.AnchorTop, self.anchorLayout, QtCore.Qt.AnchorTop) self.anchorLayout.addAnchor(_chatview, QtCore.Qt.AnchorTop, mask, QtCore.Qt.AnchorBottom) self.anchorLayout.addAnchor(_chatview, QtCore.Qt.AnchorBottom, self.anchorLayout, QtCore.Qt.AnchorBottom) mainWidget = QtWidgets.QGraphicsWidget() mainWidget.setLayout(self.anchorLayout) # mainWidget.setPos(-5, -5) mainWidget.setPos(0, -5) self.addItem(mainWidget) self.model = model self.jid = jid