Ejemplo n.º 1
0
    def _layoutChildWidgets(self, model, isLabeled):
        '''
    Create and layout child widgets.
    
    Note layout strategy: 
    Children added left to right.
    Middle widget has non-zero stretch and expands.
    The resulting layout of a column of these layouts has:
    - a fixed width column of buddy buttons, right aligned.
    - control values and their control arrows right aligned to the buddy buttons.
    
    TODO maybe the controls should be left aligned to the labels?
    '''
        # Child: optional label.  Label not used when control has it's own displayed name
        if isLabeled:
            self.addWidget(QLabel(self.getLabel()))

        # Child: Control
        self.controlWidget = self.createControlWidget()  # delegate to subclass
        self.addWidget(self.controlWidget,
                       stretch=1)  # TODO, stretch=0, alignment=Qt.AlignLeft)

        # Child: Buddy button
        self.buddyButton = BuddyIconButton(
            "Inherit",  # name, not used?
            initialState=not model.isReset,
            buddiedControl=self.controlWidget)
        self.addWidget(self.buddyButton)