zoukankan      html  css  js  c++  java
  • PyQt的Layout的比例化分块。

    一、
    QGridLayout:
    // 列比   第0列与第1列之比为 1:2  
        layout2p1 -> setColumnStretch(0, 1);  
        layout2p1 -> setColumnStretch(1, 2);  
     
        // 行比   第0行与第1行之比为1:1  
        layout2p1 -> setRowStretch(0, 1);  
        layout2p1 -> setRowStretch(1, 1);  
    	
    二、	
    QHBoxLayout:
    	## 设置第一列和第二列的长度比为1:2
    	## 设置比例
    	## setStretch(int index, int stretch)
    	## 参数1为索引,参数2为比例,单独设置一个位置的比例无效
    	hBoxLayout.setStretch(0, 1)
        hBoxLayout.setStretch(1, 2)
    	## 设置间距为0
    	hBoxLayout.setSpacing(0)
     
    三、 
    QHBoxLayout:类似于QVBoxLayout 
     
     
    四、布局的方向 :setDirection(Direction)
    布局类的布局方向的可选值的枚举 :from PyQt5.QtWidgets import QBoxLayout
    存在默认的布局方向,在与默认布局方向相反的方向的靠近容器边框的布局情况下特别有用,如存在几个按钮靠近右边框 且 容器的大小能缩放。
    enum QBoxLayout.Direction
    This type is used to determine the direction of a box layout.
    
    		Constant	       Value			Description
    QBoxLayout::LeftToRight		0		Horizontal from left to right.
    QBoxLayout::RightToLeft		1		Horizontal from right to left.
    QBoxLayout::TopToBottom		2		Vertical from top to bottom.
    QBoxLayout::BottomToTop		3		Vertical from bottom to top. 
    
  • 相关阅读:
    Codeforces
    Codeforces
    SCUT
    Codeforces
    Codeforces
    poj 2229 Sumsets(类似于n的m划分)
    poj 1742 Coins(多重背包)
    hdu 2159FATE(完全背包)
    NOIP 普及组 2014 比例简化
    2018.10.2浪在ACM 集训队第三次测试赛
  • 原文地址:https://www.cnblogs.com/ribavnu/p/4661921.html
Copyright © 2011-2022 走看看