Python源码示例:PyQt5.QtCore.Qt.CustomizeWindowHint()

示例1
def __init__(self, parent=None):
        super(DesktopLyric, self).__init__()
        self.lyric = QString('Lyric Show.')
        self.intervel = 0
        self.maskRect = QRectF(0, 0, 0, 0)
        self.maskWidth = 0
        self.widthBlock = 0
        self.t = QTimer()
        self.screen = QApplication.desktop().availableGeometry()
        self.setObjectName(_fromUtf8("Dialog"))
        self.setWindowFlags(Qt.CustomizeWindowHint | Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.Tool)
        self.setMinimumHeight(65)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.handle = lyric_handle(self)
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.font = QFont(_fromUtf8('微软雅黑, verdana'), 50)
        self.font.setPixelSize(50)
        # QMetaObject.connectSlotsByName(self)
        self.handle.lyricmoved.connect(self.newPos)
        self.t.timeout.connect(self.changeMask) 
示例2
def __init__(self, parent=None):
        super(ventanaPrincipal, self).__init__(parent)

        self.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowSystemMenuHint)
        self.setMinimumSize(800, 400)
        self.pressing = False

        # Aplicar Barra de Título personalizada
        tituloBarra = QVBoxLayout()
        tituloBarra.addWidget(barraTitulo(self))
        tituloBarra.setContentsMargins(0, 0, 0, 0)
        tituloBarra.addStretch(-1)

        self.setLayout(tituloBarra)

        self.initUI() 
示例3
def __init__(self, parent=None):
        super(ventanaPrincipal, self).__init__(parent)

        self.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowSystemMenuHint)
        self.setFixedSize(800, 400)
        self.pressing = False

        # Aplicar Barra de Título personalizada
        tituloBarra = QVBoxLayout()
        tituloBarra.addWidget(barraTitulo(self))
        tituloBarra.setContentsMargins(0, 0, 0, 0)
        tituloBarra.addStretch(-1)

        self.setLayout(tituloBarra)

        self.initUI() 
示例4
def __init__(self, parent=None):
        super(ventanaPrincipal, self).__init__(parent)

        self.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowSystemMenuHint)
        self.setFixedSize(800, 400)
        self.pressing = False

        # Aplicar Barra de Título personalizada
        tituloBarra = QVBoxLayout()
        tituloBarra.addWidget(barraTitulo(self))
        tituloBarra.setContentsMargins(0, 0, 0, 0)
        tituloBarra.addStretch(-1)

        self.setLayout(tituloBarra)

        self.initUI() 
示例5
def __init__(self, etree, style, pkmeter, parent=None):
        PKWidget.__init__(self, etree, pkmeter, parent)
        self.pkmeter = pkmeter
        self.setStyleSheet(style)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setWindowFlags(
            Qt.Tool |
            Qt.FramelessWindowHint |
            Qt.WindowStaysOnBottomHint |
            Qt.NoDropShadowWindowHint |
            Qt.CustomizeWindowHint)
        self.layout().setContentsMargins(0,0,0,0)
        self.layout().setSpacing(0)
        self._init_menu()
        pkmixins.DraggableMixin.__init__(self) 
示例6
def __init__(self, parent=None):
        super(lyric_handle, self).__init__(parent)
        self.timer = QTimer()
        self.setObjectName(_fromUtf8("Dialog"))
        self.setWindowFlags(Qt.CustomizeWindowHint | Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.Tool)
        self.setStyleSheet('QDialog { background: #2c7ec8; border: 0px solid black;}')
        self.horiLayout = QHBoxLayout(self)
        self.horiLayout.setSpacing(5)
        self.horiLayout.setContentsMargins(0, 0, 0, 0)
        self.horiLayout.setObjectName(_fromUtf8("horiLayout"))
        self.handler = QLabel(self)
        self.handler.setToolTip('Move Lyric')
        self.handler.setPixmap(QPixmap(':/icons/handler.png'))
        self.handler.setMouseTracking(True)
        self.lockBt = PushButton2(self)
        self.lockBt.setToolTip('Unlocked')
        self.lockBt.loadPixmap(QPixmap(':/icons/unlock.png'))
        self.hideBt = PushButton2(self)
        self.hideBt.setToolTip('Hide Lyric')
        self.hideBt.loadPixmap(QPixmap(':/icons/close.png').copy(48, 0, 16, 16))
        self.lockBt.setCheckable(True)
        
        self.horiLayout.addWidget(self.handler)
        self.horiLayout.addWidget(self.lockBt)
        self.horiLayout.addWidget(self.hideBt)
    
        self.lockBt.clicked.connect(self.lockLyric)
        self.hideBt.clicked.connect(self.hideLyric)
        self.timer.timeout.connect(self.hide) 
示例7
def __init__(self, parent=None):
        super(Ayuda, self).__init__()

        self.setWindowTitle("Ayuda")
        self.setWindowFlags(Qt.WindowTitleHint | Qt.CustomizeWindowHint |
                            Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(450, 500)

        self.initUI() 
示例8
def __init__(self, parent=None):
        super(Acerca, self).__init__()

        self.setWindowTitle("Acerca de Siacle")
        self.setWindowFlags(Qt.WindowTitleHint | Qt.CustomizeWindowHint |
                            Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(450, 500)

        self.initUI() 
示例9
def __init__(self):
        """Initialize the window."""
        super().__init__()
        self.setupUi(self)
        self.setWindowFlags(
            # Qt.Window                |
            Qt.CustomizeWindowHint   |
            Qt.WindowTitleHint       |
            Qt.WindowCloseButtonHint |
            Qt.WindowStaysOnTopHint
        )

        self._no_internet_msg = pop_up(self, title=Messages.NO_CONNECTION,
                                       text=Messages.NO_CONNECTION_MSG,
                                       connection=self.close)

        self._bad_db_download_msg = pop_up(self, title=Messages.BAD_DOWNLOAD,
                                           text=Messages.BAD_DOWNLOAD_MSG,
                                           connection=self.close)

        self._slow_conn_msg = pop_up(self, title=Messages.SLOW_CONN,
                                     text=Messages.SLOW_CONN_MSG,
                                     connection=self.close)

        self._download_thread = DownloadThread()
        self._download_thread.finished.connect(self._wait_close)
        self._download_thread.progress.connect(self._display_progress)
        self._download_thread.speed_progress.connect(self._display_speed)
        self.closed.connect(self._download_thread.set_exit)
        self.cancel_btn.clicked.connect(self._terminate_process)
        self._size = 0
        self.target = None 
示例10
def setupUi(self):
        ui_thread_fun_dlg.Ui_ThreadFunDlg.setupUi(self, self)
        self.setWindowFlags(self.windowFlags() | Qt.CustomizeWindowHint)
        # self.setWindowFlags(self.windowFlags() & ~Qt.WindowCloseButtonHint)
        self.setWindowTitle(self.title)
        self.display_msg_signal.connect(self.setText)
        self.dlg_config_signal.connect(self.onConfigureDialog)
        self.show_window_signal.connect(self.onShowWindow)
        self.set_progress_value_signal.connect(self.setProgressValue)
        self.closeEvent = self.closeEvent
        # self.btnBox.accepted.connect(self.accept)
        # self.btnBox.rejected.connect(self.reject)
        self.progressBar.setVisible(False)
        self.btnBox.clear()
        self.btnBox.setCenterButtons(True)

        if self.buttons:
            for btn in self.buttons:
                assert isinstance(btn, dict)
                if btn.get('std_btn'):
                    b = self.btnBox.addButton(btn.get('std_btn'))
                elif btn.get('caption'):
                    if not btn.get('role'):
                        raise Exception("Button's role is mandatory")
                    b = self.btnBox.addButton(btn.get('caption'), btn.get('role'))
                else:
                    continue
                if btn.get('callback'):
                    b.clicked.connect(btn.get('callback'))
        if self.worker_fun:
            self.worker_thread = WorkerDlgThread(self, self.worker_fun, self.worker_args,
                                                 display_msg_signal=self.display_msg_signal,
                                                 set_progress_value_signal=self.set_progress_value_signal,
                                                 dlg_config_signal=self.dlg_config_signal,
                                                 show_dialog_signal=self.show_window_signal)
            self.worker_thread.finished.connect(self.threadFinished)

            # the user method controlled by the worker thread may need to access the widget
            # displaying a feedback for its non-standard purposes, so we expose it through
            # control object which is passed to that method
            self.worker_thread.ctrl_obj.set_msg_label(self.lblText)

        self.worker_result = None
        self.worker_exception = None
        if self.text:
            self.setText(self.text)
        if self.center_by_window:
            self.centerByWindow(self.center_by_window)
        if self.worker_fun:
            self.thread_running = True
            self.worker_thread.start()
        else:
            self.thread_running = False 
示例11
def __init__(self, parent=None, title="Title", data=[], on_ok_clicked=None):
        QWidget.__init__(self, parent)

        self.setWindowFlags(
            Qt.Dialog
            | Qt.WindowTitleHint
            | Qt.CustomizeWindowHint
            | Qt.WindowCloseButtonHint
        )
        self.data = data
        self.output_data = []
        self.on_ok_clicked = on_ok_clicked

        mainLayout = QGridLayout()

        # create labels and input widgets
        for i, item in enumerate(self.data):

            label_widget = QLabel(item["label"] + ":")

            if isinstance(item["data"], bool):
                input_widget = QCheckBox()
                input_widget.setChecked(item["data"])
            elif isinstance(item["data"], (int, str)):
                default = str(item.get("data", ""))
                input_widget = QLineEdit(default)
            elif isinstance(item["data"], list):
                input_widget = QComboBox()
                input_widget.addItems(item["data"])
            else:
                print(f"Error. Unknown data type: {type(item['data'])}")
                return

            if "tooltip" in item:
                input_widget.setToolTip(str(item["tooltip"]))
                label_widget.setToolTip(str(item["tooltip"]))

            item["widget"] = input_widget

            mainLayout.addWidget(label_widget, i, 0)
            mainLayout.addWidget(input_widget, i, 1)

        ok_btn = QPushButton("Ok")
        ok_btn.clicked.connect(self.on_ok_btn_clicked)
        mainLayout.addWidget(ok_btn)

        cancel_btn = QPushButton("Cancel")
        cancel_btn.clicked.connect(self.on_cancel_btn_clicked)
        mainLayout.addWidget(cancel_btn)

        self.setLayout(mainLayout)
        self.setWindowTitle(title)