本文整理汇总了Python中PySide2.QtWidgets.QScrollArea方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QScrollArea方法的具体用法?Python QtWidgets.QScrollArea怎么用?Python QtWidgets.QScrollArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QScrollArea方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QScrollArea [as 别名]
def __init__(self, viewer: QRemoteDesktop, parent: QWidget = None):
"""
:param viewer: the RDP viewer widget
:param parent: the parent widget
"""
super().__init__(parent, Qt.WindowFlags())
self.widget = viewer
self.writeInCaps = False
self.text = QTextEdit()
self.text.setReadOnly(True)
self.text.setMinimumHeight(150)
self.log = logging.getLogger(LOGGER_NAMES.PLAYER)
self.tabLayout = QVBoxLayout()
self.scrollViewer = QScrollArea()
self.scrollViewer.setWidget(self.widget)
self.tabLayout.addWidget(self.scrollViewer, 10)
self.tabLayout.addWidget(self.text, 2)
self.setLayout(self.tabLayout)
示例2: quickMsg
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QScrollArea [as 别名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例3: quickMsg
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QScrollArea [as 别名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
layout.addWidget(QtWidgets.QLabel(msg))
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例4: quickMsg
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QScrollArea [as 别名]
def quickMsg(self, msg, block=1, ask=0):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
if ask==0:
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
else:
tmpMsg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
if block:
value = tmpMsg.exec_()
if value == QtWidgets.QMessageBox.Ok:
return 1
else:
return 0
else:
tmpMsg.show()
return 0
示例5: _on_releases_data
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QScrollArea [as 别名]
def _on_releases_data(self, task: asyncio.Task):
releases = task.result()
current_version = update_checker.strict_current_version()
last_changelog = self._options.last_changelog_displayed
all_change_logs, new_change_logs, version_to_display = update_checker.versions_to_display_for_releases(
current_version, last_changelog, releases)
if version_to_display is not None:
self.display_new_version(version_to_display)
if all_change_logs:
changelog_tab = QtWidgets.QWidget()
changelog_tab.setObjectName("changelog_tab")
changelog_tab_layout = QtWidgets.QVBoxLayout(changelog_tab)
changelog_tab_layout.setContentsMargins(0, 0, 0, 0)
changelog_tab_layout.setObjectName("changelog_tab_layout")
changelog_scroll_area = QtWidgets.QScrollArea(changelog_tab)
changelog_scroll_area.setWidgetResizable(True)
changelog_scroll_area.setObjectName("changelog_scroll_area")
changelog_scroll_contents = QtWidgets.QWidget()
changelog_scroll_contents.setGeometry(QtCore.QRect(0, 0, 489, 337))
changelog_scroll_contents.setObjectName("changelog_scroll_contents")
changelog_scroll_layout = QtWidgets.QVBoxLayout(changelog_scroll_contents)
changelog_scroll_layout.setObjectName("changelog_scroll_layout")
changelog_label = QtWidgets.QLabel(changelog_scroll_contents)
changelog_label.setObjectName("changelog_label")
changelog_label.setText(markdown.markdown("\n".join(all_change_logs)))
changelog_label.setWordWrap(True)
changelog_scroll_layout.addWidget(changelog_label)
changelog_scroll_area.setWidget(changelog_scroll_contents)
changelog_tab_layout.addWidget(changelog_scroll_area)
self.help_tab_widget.addTab(changelog_tab, "Change Log")
if new_change_logs:
QMessageBox.information(self, "What's new", markdown.markdown("\n".join(new_change_logs)))
with self._options as options:
options.last_changelog_displayed = current_version
示例6: _init_widgets
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QScrollArea [as 别名]
def _init_widgets(self):
area = QScrollArea()
area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
area.setWidgetResizable(True)
self._area = area
base_layout = QVBoxLayout()
base_layout.addWidget(area)
self.setLayout(base_layout)
示例7: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QScrollArea [as 别名]
def __init__(self, application, parent=None):
super(AttributeEditor, self).__init__(parent)
self.application = application
self.widget = QtWidgets.QWidget()
self.shape = ShapeSettings()
self.shape.optionSet.connect(self.optionSet.emit)
self.shape.rectModified.connect(self.rectModified.emit)
self.shape_toggler = WidgetToggler('Shape', self.shape)
self.image = ImageSettings()
self.image.optionSet.connect(self.image_modified)
self.image_toggler = WidgetToggler('Image', self.image)
self.appearence = AppearenceSettings()
self.appearence.optionSet.connect(self.optionSet.emit)
self.appearence_toggler = WidgetToggler('Appearence', self.appearence)
self.text = TextSettings()
self.text.optionSet.connect(self.optionSet.emit)
self.text_toggler = WidgetToggler('Text', self.text)
self.action = ActionSettings()
self.action.set_languages(self.application.available_languages)
self.action.optionSet.connect(self.optionSet.emit)
self.action_toggler = WidgetToggler('Action', self.action)
self.layout = QtWidgets.QVBoxLayout(self.widget)
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setSpacing(0)
self.layout.addWidget(self.shape_toggler)
self.layout.addWidget(self.shape)
self.layout.addWidget(self.image_toggler)
self.layout.addWidget(self.image)
self.layout.addWidget(self.appearence_toggler)
self.layout.addWidget(self.appearence)
self.layout.addWidget(self.text_toggler)
self.layout.addWidget(self.text)
self.layout.addWidget(self.action_toggler)
self.layout.addWidget(self.action)
self.layout.addStretch(1)
self.scroll_area = QtWidgets.QScrollArea()
self.scroll_area.setWidget(self.widget)
self.main_layout = QtWidgets.QVBoxLayout(self)
self.main_layout.setContentsMargins(0, 0, 0, 0)
self.main_layout.addWidget(self.scroll_area)
self.setFixedWidth(self.sizeHint().width() * 1.075)
示例8: _init_widgets
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QScrollArea [as 别名]
def _init_widgets(self):
if self._state.am_none():
return
if self._state.arch.name not in self.ARCH_REGISTERS:
l.error("Architecture %s is not listed in QRegisterViewer.ARCH_REGISTERS.", self._state.arch.name)
return
layout = QVBoxLayout()
area = QScrollArea()
area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
area.setWidgetResizable(True)
regs = self.ARCH_REGISTERS[self._state.arch.name]
# common ones
common_regs = regs['common']
for reg_name in common_regs:
sublayout = QHBoxLayout()
lbl_reg_name = QLabel(self)
lbl_reg_name.setProperty('class', 'reg_viewer_label')
lbl_reg_name.setText(reg_name)
lbl_reg_name.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
sublayout.addWidget(lbl_reg_name)
sublayout.addSpacing(10)
reg_value = QASTViewer(None, parent=self, workspace=self.workspace)
self._registers[reg_name] = reg_value
sublayout.addWidget(reg_value)
layout.addLayout(sublayout)
layout.setSpacing(0)
layout.addStretch(0)
layout.setContentsMargins(2, 2, 2, 2)
# the container
container = QFrame()
container.setAutoFillBackground(True)
palette = container.palette()
palette.setColor(container.backgroundRole(), Qt.white)
container.setPalette(palette)
container.setLayout(layout)
area.setWidget(container)
base_layout = QVBoxLayout()
base_layout.addWidget(area)
self.setLayout(base_layout)