本文整理汇总了Python中python_qt_binding.QtGui.QHBoxLayout.setSpacing方法的典型用法代码示例。如果您正苦于以下问题:Python QHBoxLayout.setSpacing方法的具体用法?Python QHBoxLayout.setSpacing怎么用?Python QHBoxLayout.setSpacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtGui.QHBoxLayout
的用法示例。
在下文中一共展示了QHBoxLayout.setSpacing方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import setSpacing [as 别名]
def __init__(self, editor, *args):
QFrame.__init__(self, *args)
self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
self.edit = editor
self.number_bar = self.NumberBar()
self.number_bar.set_text_edit(self.edit)
hbox = QHBoxLayout(self)
hbox.setSpacing(0)
# hbox.setMargin(0) # removed: it is not supported by Qt5
hbox.addWidget(self.number_bar)
hbox.addWidget(self.edit)
self.edit.installEventFilter(self)
self.edit.viewport().installEventFilter(self)
示例2: PathEditor
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import setSpacing [as 别名]
class PathEditor(QWidget):
'''
This is a path editor used as ItemDeligate in settings view. This editor
provides an additional button for directory selection dialog.
'''
editing_finished_signal = Signal()
def __init__(self, path, parent=None):
QWidget.__init__(self, parent)
self.path = path
self._layout = QHBoxLayout(self)
self._layout.setContentsMargins(0, 0, 0, 0)
self._layout.setSpacing(0)
self._button = QPushButton('...')
self._button.setMaximumSize(QSize(24, 20))
self._button.clicked.connect(self._on_path_select_clicked)
self._layout.addWidget(self._button)
self._lineedit = QLineEdit(path)
self._lineedit.returnPressed.connect(self._on_editing_finished)
self._layout.addWidget(self._lineedit)
self.setLayout(self._layout)
self.setFocusProxy(self._button)
self.setAutoFillBackground(True)
def _on_path_select_clicked(self):
# Workaround for QFileDialog.getExistingDirectory because it do not
# select the configuration folder in the dialog
self.dialog = QFileDialog(self, caption='Select a new settings folder')
self.dialog.setOption(QFileDialog.HideNameFilterDetails, True)
self.dialog.setFileMode(QFileDialog.Directory)
self.dialog.setDirectory(self.path)
if self.dialog.exec_():
fileNames = self.dialog.selectedFiles()
path = fileNames[0]
if os.path.isfile(path):
path = os.path.basename(path)
self._lineedit.setText(path)
self.path = dir
self.editing_finished_signal.emit()
def _on_editing_finished(self):
if self._lineedit.text():
self.path = self._lineedit.text()
self.editing_finished_signal.emit()
示例3: _create_replace_frame
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import setSpacing [as 别名]
def _create_replace_frame(self):
# create frame with replace row
self.rplc_frame = rplc_frame = QFrame(self)
rplc_hbox_layout = QHBoxLayout(rplc_frame)
rplc_hbox_layout.setContentsMargins(0, 0, 0, 0)
rplc_hbox_layout.setSpacing(1)
self.replace_field = EnchancedLineEdit(rplc_frame)
self.replace_field.setPlaceholderText('replace text')
self.replace_field.returnPressed.connect(self.on_replace)
rplc_hbox_layout.addWidget(self.replace_field)
self.replace_result_label = QLabel(rplc_frame)
self.replace_result_label.setText(' ')
rplc_hbox_layout.addWidget(self.replace_result_label)
self.replace_button = replace_button = QPushButton("> &Replace >")
replace_button.setFixedWidth(90)
replace_button.clicked.connect(self.on_replace_click)
rplc_hbox_layout.addWidget(replace_button)
rplc_frame.setVisible(False)
return rplc_frame
示例4: _create_find_frame
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import setSpacing [as 别名]
def _create_find_frame(self):
find_frame = QFrame(self)
find_hbox_layout = QHBoxLayout(find_frame)
find_hbox_layout.setContentsMargins(0, 0, 0, 0)
find_hbox_layout.setSpacing(1)
self.search_field = EnchancedLineEdit(find_frame)
self.search_field.setPlaceholderText('search text')
self.search_field.textChanged.connect(self.on_search_text_changed)
self.search_field.returnPressed.connect(self.on_search)
find_hbox_layout.addWidget(self.search_field)
self.search_result_label = QLabel(find_frame)
self.search_result_label.setText(' ')
find_hbox_layout.addWidget(self.search_result_label)
self.find_button_back = QPushButton("<")
self.find_button_back.setFixedWidth(44)
self.find_button_back.clicked.connect(self.on_search_back)
find_hbox_layout.addWidget(self.find_button_back)
self.find_button = QPushButton(">")
self.find_button.setDefault(True)
# self.find_button.setFlat(True)
self.find_button.setFixedWidth(44)
self.find_button.clicked.connect(self.on_search)
find_hbox_layout.addWidget(self.find_button)
return find_frame