本文整理汇总了Python中PyQt5.QtWidgets.QScrollArea.setMaximumHeight方法的典型用法代码示例。如果您正苦于以下问题:Python QScrollArea.setMaximumHeight方法的具体用法?Python QScrollArea.setMaximumHeight怎么用?Python QScrollArea.setMaximumHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QScrollArea
的用法示例。
在下文中一共展示了QScrollArea.setMaximumHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QScrollArea [as 别名]
# 或者: from PyQt5.QtWidgets.QScrollArea import setMaximumHeight [as 别名]
def __init__(self, tup_gallery, parent = None, menu = None):
super().__init__(parent)
self.setMaximumWidth(16777215)
assert isinstance(tup_gallery, tuple), "Incorrect type received, expected tuple"
assert isinstance(tup_gallery[0], str) and isinstance(tup_gallery[1], list)
main_layout = QVBoxLayout()
# todo make it scroll
scroll_area = QScrollArea()
dummy = QWidget()
self.gallery_layout = misc.FlowLayout(dummy)
scroll_area.setWidgetResizable(True)
scroll_area.setMaximumHeight(400)
scroll_area.setMidLineWidth(620)
scroll_area.setBackgroundRole(scroll_area.palette().Shadow)
scroll_area.setFrameStyle(scroll_area.NoFrame)
scroll_area.setWidget(dummy)
text = tup_gallery[0]
galleries = tup_gallery[1]
main_layout.addWidget(scroll_area, 3)
for g in galleries:
gall_w = misc.GalleryShowcaseWidget(parent=self, menu=menu())
gall_w.set_gallery(g, (170//1.40, 170))
gall_w.double_clicked.connect(self.gallery_doubleclicked.emit)
self.gallery_layout.addWidget(gall_w)
text_lbl = QLabel(text)
text_lbl.setAlignment(Qt.AlignCenter)
main_layout.addWidget(text_lbl)
main_layout.addLayout(self.buttons_layout)
self.main_widget.setLayout(main_layout)
self.setMaximumHeight(500)
self.setMaximumWidth(620)
self.resize(620, 500)
self.show()
示例2: SearchReplaceSlidingWidget
# 需要导入模块: from PyQt5.QtWidgets import QScrollArea [as 别名]
# 或者: from PyQt5.QtWidgets.QScrollArea import setMaximumHeight [as 别名]
class SearchReplaceSlidingWidget(QWidget):
"""
Class implementing the search and replace widget with sliding behavior.
@signal searchListChanged() emitted to indicate a change of the search list
"""
searchListChanged = pyqtSignal()
def __init__(self, replace, vm, parent=None):
"""
Constructor
@param replace flag indicating a replace widget is called
@param vm reference to the viewmanager object
@param parent parent widget of this widget (QWidget)
"""
super(SearchReplaceSlidingWidget, self).__init__(parent)
self.__searchReplaceWidget = \
SearchReplaceWidget(replace, vm, self, True)
srHeight = self.__searchReplaceWidget.height()
self.__layout = QHBoxLayout(self)
self.setLayout(self.__layout)
self.__layout.setContentsMargins(0, 0, 0, 0)
self.__layout.setAlignment(Qt.AlignTop)
self.__leftButton = QToolButton(self)
self.__leftButton.setArrowType(Qt.LeftArrow)
self.__leftButton.setSizePolicy(
QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)
self.__leftButton.setAutoRepeat(True)
self.__scroller = QScrollArea(self)
self.__scroller.setWidget(self.__searchReplaceWidget)
self.__scroller.setSizePolicy(
QSizePolicy.Expanding, QSizePolicy.Minimum)
self.__scroller.setMaximumHeight(srHeight)
self.__scroller.setFrameShape(QFrame.NoFrame)
self.__scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.__scroller.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.__scroller.setWidgetResizable(False)
self.__rightButton = QToolButton(self)
self.__rightButton.setArrowType(Qt.RightArrow)
self.__rightButton.setSizePolicy(
QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)
self.__rightButton.setAutoRepeat(True)
self.__layout.addWidget(self.__leftButton)
self.__layout.addWidget(self.__scroller)
self.__layout.addWidget(self.__rightButton)
self.setMaximumHeight(srHeight)
self.__searchReplaceWidget.searchListChanged.connect(
self.searchListChanged)
self.__leftButton.clicked.connect(self.__slideLeft)
self.__rightButton.clicked.connect(self.__slideRight)
def findNext(self):
"""
Public slot to find the next occurrence of text.
"""
self.__searchReplaceWidget.findNext()
def findPrev(self):
"""
Public slot to find the next previous of text.
"""
self.__searchReplaceWidget.findPrev()
def selectionChanged(self):
"""
Public slot tracking changes of selected text.
"""
editor = self.sender()
self.__searchReplaceWidget.updateSelectionCheckBox(editor)
@pyqtSlot(Editor)
def updateSelectionCheckBox(self, editor):
"""
Public slot to update the selection check box.
@param editor reference to the editor (Editor)
"""
self.__searchReplaceWidget.updateSelectionCheckBox(editor)
def show(self, text=''):
"""
Public slot to show the widget.
@param text text to be shown in the findtext edit (string)
"""
self.__searchReplaceWidget.show(text)
super(SearchReplaceSlidingWidget, self).show()
self.__enableScrollerButtons()
def __slideLeft(self):
"""
#.........这里部分代码省略.........