当前位置: 首页>>代码示例>>Python>>正文


Python QScrollArea.setMinimumHeight方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QScrollArea.setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:Python QScrollArea.setMinimumHeight方法的具体用法?Python QScrollArea.setMinimumHeight怎么用?Python QScrollArea.setMinimumHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QScrollArea的用法示例。


在下文中一共展示了QScrollArea.setMinimumHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GalaxyWidget

# 需要导入模块: from PyQt5.QtWidgets import QScrollArea [as 别名]
# 或者: from PyQt5.QtWidgets.QScrollArea import setMinimumHeight [as 别名]
class GalaxyWidget(QWidget):
    """
    Serves as container for galaxy coords selector widget
    and galaxy view widget. All this container can be added
    as a signle widget (tab page).
    """

    def __init__(self, parent: QWidget):
        super(GalaxyWidget, self).__init__(parent)
        self.world = XNovaWorld_instance()
        # main layout
        self._layout = QVBoxLayout()
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(2)
        self.setLayout(self._layout)
        # sub-widgets
        self._galaxy_coords = GalaxyCoordsSelectorWidget(self)
        self._galaxy_coords.setGalaxyRange(1, 5)
        self._galaxy_coords.setSystemRange(1, 499)
        self._galaxy_coords.coordsChanged.connect(self.on_coords_cahnged)
        self._galaxyview = GalaxyView(self)
        # scrollarea
        self._sa_galaxy = QScrollArea(self)
        self._sa_galaxy.setMinimumWidth(400)
        self._sa_galaxy.setMinimumHeight(300)
        self._sa_galaxy.setWidget(self._galaxyview)
        #
        self._layout.addWidget(self._galaxy_coords)
        self._layout.addWidget(self._sa_galaxy)

    @pyqtSlot(int, int)
    def on_coords_cahnged(self, galaxy: int, system: int):
        logger.debug('on_coords_changed ({0}, {1})'.format(galaxy, system))
        self._galaxyview.show_coords(galaxy, system)

    def setCoords(self, galaxy: int, system: int):
        self._galaxy_coords.setCoords(galaxy, system, do_emit=False)
        self._galaxyview.show_coords(galaxy, system)

    def coords(self) -> list:
        ret = self._galaxy_coords.coords()
        return ret

    def get_tab_type(self) -> str:
        return 'galaxy'
开发者ID:minlexx,项目名称:xnovacmd,代码行数:47,代码来源:galaxy_widget.py

示例2: StitcherUI

# 需要导入模块: from PyQt5.QtWidgets import QScrollArea [as 别名]
# 或者: from PyQt5.QtWidgets.QScrollArea import setMinimumHeight [as 别名]
class StitcherUI(QDialog):
    thread_invoker = pyqtSignal()

    def __init__(self, argv, terminate, parent=None):
        super(StitcherUI, self).__init__(parent)
        self.setWindowTitle("Stitcher Preview")
        st = stitch.Stitcher(argv=argv)
        self.st = st
        #determine the shrink ratio to avoid too huge preview
        preview_ratio = 1.0
        if st.image.shape[1] > 10000:
            preview_ratio = 10000.0 / st.image.shape[1]
        if st.image.shape[0]*preview_ratio > 500:
            preview_ratio = 500.0 / st.image.shape[0]
        self.terminate = terminate
        self.thread = QThread()
        self.thread.start()

        self.worker = Renderer(st=st, preview_ratio=preview_ratio)
        #it might be too early.
        
        #determine the window size
        height,width = st.image.shape[0:2]
        height = int(height*preview_ratio)
        #determine the preview area size
        width = int(width*preview_ratio)

        self.scrollArea = QScrollArea()
        #self.scrollArea.setMaximumHeight(1000)
        self.largecanvas = ExtensibleCanvasWidget(width, height)
        #print(width,height)
        self.worker.frameRendered.connect(self.largecanvas.updatePixmap)
        #Do not close the window when finished.
        #self.worker.finished.connect(self.finishIt)
        self.worker.moveToThread(self.thread)
        self.thread_invoker.connect(self.worker.task)
        self.thread_invoker.emit()

        self.scrollArea.setWidget(self.largecanvas)
        self.scrollArea.setMinimumHeight(500) #self.largecanvas.sizeHint().height())
        self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        self.btnStop = QPushButton('Stop')
        self.btnStop.clicked.connect(lambda: self.worker.stop())
        self.btnStop.clicked.connect(self.terminateIt)
        
        self.progress = QProgressBar(self)
        self.worker.progress.connect(self.progress.setValue)
        
        self.layout = QVBoxLayout()
        self.layout.addWidget(self.btnStop)
        self.layout.addWidget(self.progress)
        self.layout.addWidget(self.scrollArea)
        self.layout.addStretch(1)
        self.setLayout(self.layout)
        

        
    def terminateIt(self):
        self.close()
        if self.terminate:
            sys.exit(1)  #terminated
        
    def finishIt(self):
        self.close()
        
    def closeEvent(self, event):
        self.stop_thread()
        
    def stop_thread(self):
        self.worker.stop()
        self.thread.quit()
        self.thread.wait()
开发者ID:,项目名称:,代码行数:75,代码来源:


注:本文中的PyQt5.QtWidgets.QScrollArea.setMinimumHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。