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


Python QBoxLayout.addLayout方法代码示例

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


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

示例1: CandidateCrawlerUI

# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addLayout [as 别名]
class CandidateCrawlerUI(object):
    def setupUi(self, MainWindow):
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.qbox = QBoxLayout(QBoxLayout.TopToBottom, self.centralwidget)
        self.centralwidget.setLayout(self.qbox)
               
        #####Mots-clés###
        self.keywords_label = QtGui.QLabel(self.centralwidget)
        self.keywords_label.setText(_translate("AdminWindow", "Mots-clés de recherche", None))
         
        self.keywords_help = QtGui.QPushButton(self.centralwidget)
        self.keywords_help.setIcon(QIcon('./share/icon/point interrogation.png'))
        self.keywords_help.setIconSize(QSize(10,10))
        
        self.hbox_keywords = QtGui.QHBoxLayout()
        self.hbox_keywords.addWidget(self.keywords_label)
        self.hbox_keywords.addWidget(self.keywords_help)
        self.hbox_keywords.setContentsMargins(0, 0, 120, 0)
        
        self.keywords_entry = QtGui.QLineEdit(self.centralwidget)
        
        self.vbox_keywords = QtGui.QVBoxLayout()
        self.vbox_keywords.addLayout(self.hbox_keywords)
        self.vbox_keywords.addWidget(self.keywords_entry)
        self.vbox_keywords.setContentsMargins(0, 0, 0, 5) 
         
        ###Région### 
        self.region_label = QtGui.QLabel(self.centralwidget)
        self.region_label.setText(_translate("AdminWindow", "Région (5 choix maximum)", None))
                        
        self.region_list = QtGui.QListView(self.centralwidget)
               
        self.vbox_region = QtGui.QVBoxLayout()
        self.vbox_region.addWidget(self.region_label)
        self.vbox_region.addWidget(self.region_list)
        self.vbox_region.setContentsMargins(0, 0, 0, 5)
        
        ###Mobilité###
        self.mobilite_label = QtGui.QLabel(self.centralwidget)
        self.mobilite_label.setText(_translate("AdminWindow", "Mobilité", None))
                        
        self.mobilite_combobox = QtGui.QComboBox(self.centralwidget)
        
        self.vbox_mobilite = QtGui.QVBoxLayout()
        self.vbox_mobilite.addWidget(self.mobilite_label)
        self.vbox_mobilite.addWidget(self.mobilite_combobox)
        self.vbox_mobilite.setContentsMargins(0, 0, 0, 5)
        
        ###Salaire###
        self.salaire_label = QtGui.QLabel(self.centralwidget)
        self.salaire_label.setText(_translate("AdminWindow", "Salaire", None))
                
        self.salaire_combobox = QtGui.QComboBox(self.centralwidget)
        
        self.vbox_salaire = QtGui.QVBoxLayout()
        self.vbox_salaire.addWidget(self.salaire_label)
        self.vbox_salaire.addWidget(self.salaire_combobox)
        self.vbox_salaire.setContentsMargins(0, 0, 0, 5)
        
        ###Disponibilité###
        self.disponibilite_label = QtGui.QLabel(self.centralwidget)
        self.disponibilite_label.setText(_translate("AdminWindow", "Disponibilité", None))
                
        self.disponibilite_list = QtGui.QListView(self.centralwidget)
        
        self.vbox_disponibilite = QtGui.QVBoxLayout()
        self.vbox_disponibilite.addWidget(self.disponibilite_label)
        self.vbox_disponibilite.addWidget(self.disponibilite_list)
        self.vbox_disponibilite.setContentsMargins(0, 0, 0, 5)
        
        ###Fraîcheur###
        self.fraicheur_label = QtGui.QLabel(self.centralwidget)
        self.fraicheur_label.setText(_translate("AdminWindow", "Fraîcheur", None))
                
        self.fraicheur_combobox = QtGui.QComboBox(self.centralwidget)
        
        self.vbox_fraicheur = QtGui.QVBoxLayout()
        self.vbox_fraicheur.addWidget(self.fraicheur_label)
        self.vbox_fraicheur.addWidget(self.fraicheur_combobox)
        self.vbox_fraicheur.setContentsMargins(0, 0, 0, 5)
        
        ###Nombre de CVs###
        self.cv_number_label = QtGui.QLabel(self.centralwidget)
        self.cv_number_label.setText(_translate("AdminWindow", "Nombre de CV", None))
        
        self.cv_number_entry = QtGui.QLineEdit(self.centralwidget)
        self.cv_number_entry.setInputMethodHints(QtCore.Qt.ImhNone)
        self.cv_number_entry.setText("50")
        
        self.vbox_cv_number = QtGui.QVBoxLayout()
        self.vbox_cv_number.addWidget(self.cv_number_label)
        self.vbox_cv_number.addWidget(self.cv_number_entry)
        self.vbox_cv_number.setContentsMargins(0, 0, 0, 5)
            
        ###Progression###         
        self.progression_label = QtGui.QLabel(self.centralwidget)
        self.progression_label.setText(_translate("AdminWindow", "Progression", None))
                     
        self.progression_text = QtGui.QTextBrowser(self.centralwidget)
        
#.........这里部分代码省略.........
开发者ID:GuillaumeDelamare,项目名称:candidate-crawler,代码行数:103,代码来源:Ponctual.py

示例2: E4SideBar

# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addLayout [as 别名]
class E4SideBar(QWidget):
    """
    Class implementing a sidebar with a widget area, that is hidden or shown, if the
    current tab is clicked again.
    """
    Version = 1
    
    North = 0
    East  = 1
    South = 2
    West  = 3
    
    def __init__(self, orientation = None, delay = 200, parent = None):
        """
        Constructor
        
        @param orientation orientation of the sidebar widget (North, East, South, West)
        @param delay value for the expand/shrink delay in milliseconds (integer)
        @param parent parent widget (QWidget)
        """
        QWidget.__init__(self, parent)
        
        self.__tabBar = QTabBar()
        self.__tabBar.setDrawBase(True)
        self.__tabBar.setShape(QTabBar.RoundedNorth)
        self.__tabBar.setUsesScrollButtons(True)
        self.__tabBar.setDrawBase(False)
        self.__stackedWidget = QStackedWidget(self)
        self.__stackedWidget.setContentsMargins(0, 0, 0, 0)
        self.__autoHideButton = QToolButton()
        self.__autoHideButton.setCheckable(True)
        self.__autoHideButton.setIcon(UI.PixmapCache.getIcon("autoHideOff.png"))
        self.__autoHideButton.setChecked(True)
        self.__autoHideButton.setToolTip(
            self.trUtf8("Deselect to activate automatic collapsing"))
        self.barLayout = QBoxLayout(QBoxLayout.LeftToRight)
        self.barLayout.setMargin(0)
        self.layout = QBoxLayout(QBoxLayout.TopToBottom)
        self.layout.setMargin(0)
        self.layout.setSpacing(0)
        self.barLayout.addWidget(self.__autoHideButton)
        self.barLayout.addWidget(self.__tabBar)
        self.layout.addLayout(self.barLayout)
        self.layout.addWidget(self.__stackedWidget)
        self.setLayout(self.layout)
        
        # initialize the delay timer
        self.__actionMethod = None
        self.__delayTimer = QTimer(self)
        self.__delayTimer.setSingleShot(True)
        self.__delayTimer.setInterval(delay)
        self.connect(self.__delayTimer, SIGNAL("timeout()"), self.__delayedAction)
        
        self.__minimized = False
        self.__minSize = 0
        self.__maxSize = 0
        self.__bigSize = QSize()
        
        self.splitter = None
        self.splitterSizes = []
        
        self.__hasFocus = False # flag storing if this widget or any child has the focus
        self.__autoHide = False
        
        self.__tabBar.installEventFilter(self)
        
        self.__orientation = E4SideBar.North
        if orientation is None:
            orientation = E4SideBar.North
        self.setOrientation(orientation)
        
        self.connect(self.__tabBar, SIGNAL("currentChanged(int)"), 
                     self.__stackedWidget, SLOT("setCurrentIndex(int)"))
        self.connect(e4App(), SIGNAL("focusChanged(QWidget*, QWidget*)"), 
                     self.__appFocusChanged)
        self.connect(self.__autoHideButton, SIGNAL("toggled(bool)"), 
                     self.__autoHideToggled)
    
    def setSplitter(self, splitter):
        """
        Public method to set the splitter managing the sidebar.
        
        @param splitter reference to the splitter (QSplitter)
        """
        self.splitter = splitter
        self.connect(self.splitter, SIGNAL("splitterMoved(int, int)"), 
                     self.__splitterMoved)
        self.splitter.setChildrenCollapsible(False)
        index = self.splitter.indexOf(self)
        self.splitter.setCollapsible(index, False)
    
    def __splitterMoved(self, pos, index):
        """
        Private slot to react on splitter moves.
        
        @param pos new position of the splitter handle (integer)
        @param index index of the splitter handle (integer)
        """
        if self.splitter:
            self.splitterSizes = self.splitter.sizes()
#.........这里部分代码省略.........
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:103,代码来源:E4SideBar.py

示例3: SideBar

# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addLayout [as 别名]
class SideBar( QWidget ):
    """ Sidebar with a widget area which is hidden or shown.
        On by clicking any tab, off by clicking the current tab.
    """

    North = 0
    East  = 1
    South = 2
    West  = 3

    def __init__( self, orientation = 2, parent = None ):
        QWidget.__init__( self, parent )

        self.__tabBar = QTabBar()
        self.__tabBar.setDrawBase( True )
        self.__tabBar.setShape( QTabBar.RoundedNorth )
        self.__tabBar.setFocusPolicy( Qt.NoFocus )
        self.__tabBar.setUsesScrollButtons( True )
        self.__tabBar.setElideMode( 1 )
        self.__stackedWidget = QStackedWidget( self )
        self.__stackedWidget.setContentsMargins( 0, 0, 0, 0 )
        self.barLayout = QBoxLayout( QBoxLayout.LeftToRight )
        self.barLayout.setMargin( 0 )
        self.layout = QBoxLayout( QBoxLayout.TopToBottom )
        self.layout.setMargin( 0 )
        self.layout.setSpacing( 0 )
        self.barLayout.addWidget( self.__tabBar )
        self.layout.addLayout( self.barLayout )
        self.layout.addWidget( self.__stackedWidget )
        self.setLayout( self.layout )

        self.__minimized = False
        self.__minSize = 0
        self.__maxSize = 0
        self.__bigSize = QSize()

        self.splitter = None

        self.__tabBar.installEventFilter( self )

        self.__orientation = orientation
        self.setOrientation( orientation )

        self.__tabBar.currentChanged.connect(
                                        self.__stackedWidget.setCurrentIndex )
        return

    def setSplitter( self, splitter ):
        """ Set the splitter managing the sidebar """
        self.splitter = splitter
        return

    def __getIndex( self ):
        " Provides the widget index in splitters "
        if self.__orientation == SideBar.West:
            return 0
        if self.__orientation == SideBar.East:
            return 2
        if self.__orientation == SideBar.South:
            return 1
        return 0

    def __getWidget( self ):
        " Provides a reference to the widget "
        return self.splitter.widget( self.__getIndex() )

    def shrink( self ):
        """ Shrink the sidebar """
        if self.__minimized:
            return

        self.__minimized = True
        self.__bigSize = self.size()
        if self.__orientation in [ SideBar.North, SideBar.South ]:
            self.__minSize = self.minimumHeight()
            self.__maxSize = self.maximumHeight()
        else:
            self.__minSize = self.minimumWidth()
            self.__maxSize = self.maximumWidth()

        self.__stackedWidget.hide()

        sizes = self.splitter.sizes()
        selfIndex = self.__getIndex()

        if self.__orientation in [ SideBar.North, SideBar.South ]:
            newHeight = self.__tabBar.minimumSizeHint().height()
            self.setFixedHeight( newHeight )

            diff = sizes[ selfIndex ] - newHeight
            sizes[ selfIndex ] = newHeight
        else:
            newWidth = self.__tabBar.minimumSizeHint().width()
            self.setFixedWidth( newWidth )

            diff = sizes[ selfIndex ] - newWidth
            sizes[ selfIndex ] = newWidth

        if selfIndex == 0:
            sizes[ 1 ] += diff
#.........这里部分代码省略.........
开发者ID:eaglexmw,项目名称:codimension,代码行数:103,代码来源:sidebar.py


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