當前位置: 首頁>>代碼示例>>Python>>正文


Python QSizePolicy.Preferred方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QSizePolicy.Preferred方法的典型用法代碼示例。如果您正苦於以下問題:Python QSizePolicy.Preferred方法的具體用法?Python QSizePolicy.Preferred怎麽用?Python QSizePolicy.Preferred使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets.QSizePolicy的用法示例。


在下文中一共展示了QSizePolicy.Preferred方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QSizePolicy [as 別名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Preferred [as 別名]
def __init__(self, parent=None, elidemode=Qt.ElideRight):
        super().__init__(parent)
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)
        self._elidemode = elidemode
        self._elided_text = '' 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:7,代碼來源:textbase.py

示例2: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QSizePolicy [as 別名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Preferred [as 別名]
def __init__(self, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.listenerlist = ListenerList()
        self.listenerlist.listenersUpdated.connect(self.listenersUpdated)
        self.layout().addWidget(self.listenerlist)

        self.hostinput = QLineEdit()
        self.hostinput.setText("127.0.0.1")
        self.hostinput.returnPressed.connect(self.add_listener)
        self.portinput = QLineEdit()
        self.portinput.setMaxLength(5)
        self.portinput.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        self.portinput.returnPressed.connect(self.add_listener)
        self.addbutton = QToolButton()
        self.addbutton.setText("+")
        self.removebutton = QToolButton()
        self.removebutton.setText("-")
        editbar = QHBoxLayout()
        editbar.addWidget(self.addbutton)
        editbar.addWidget(self.removebutton)
        editbar.addWidget(QLabel("Interface:"))
        editbar.addWidget(self.hostinput)
        editbar.addWidget(QLabel("Port:"))
        editbar.addWidget(self.portinput)

        self.removebutton.clicked.connect(self.listenerlist.delete_selected)
        self.addbutton.clicked.connect(self.add_listener)

        self.layout().addLayout(editbar) 
開發者ID:roglew,項目名稱:guppy-proxy,代碼行數:33,代碼來源:settings.py

示例3: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QSizePolicy [as 別名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Preferred [as 別名]
def __init__(self, client):
        QWidget.__init__(self)
        self.client = client
        self.history = []
        self.history_pos = 0

        self.setLayout(QVBoxLayout())
        self.layout().setSpacing(0)
        self.layout().setContentsMargins(0, 0, 0, 0)
        buttons = QHBoxLayout()
        buttons.setContentsMargins(0, 0, 0, 0)
        buttons.setSpacing(8)

        submitButton = QPushButton("Submit")
        submitButton.clicked.connect(self.submit)
        self.dest_host_input = QLineEdit()
        self.dest_port_input = QLineEdit()
        self.dest_port_input.setMaxLength(5)
        self.dest_port_input.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        self.dest_usetls_input = QCheckBox()
        
        self.back_button = QToolButton()
        self.back_button.setText("<")
        self.back_button.clicked.connect(self.back)
        self.forward_button = QToolButton()
        self.forward_button.setText(">")
        self.forward_button.clicked.connect(self.forward)

        buttons.addWidget(self.back_button)
        buttons.addWidget(self.forward_button)
        buttons.addWidget(submitButton)
        buttons.addWidget(QLabel("Host:"))
        buttons.addWidget(self.dest_host_input)
        buttons.addWidget(QLabel("Port:"))
        buttons.addWidget(self.dest_port_input)
        buttons.addWidget(QLabel("Use TLS:"))
        buttons.addWidget(self.dest_usetls_input)
        buttons.addStretch()

        self.reqview = ReqViewWidget(tag_tab=True)
        self.reqview.set_read_only(False)
        self.reqview.set_tags_read_only(False)
        self.layout().addLayout(buttons)
        self.layout().addWidget(self.reqview)

        self.req = None
        self.dest_host = ""
        self.dest_port = 80
        self.use_tls = False
        self._update_buttons() 
開發者ID:roglew,項目名稱:guppy-proxy,代碼行數:52,代碼來源:repeater.py


注:本文中的PyQt5.QtWidgets.QSizePolicy.Preferred方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。