Adds a widget to the grid edit's toolbar with the given
        alignment.
        
        :param      widget | <QtGui.QWidget>
                    align  | <QtCore.Qt.Alignment>
962541
def addWidget(self, widget, align=Qt.AlignLeft, before=None):
        
        # self.uiToolbarLAYOUT points to a deleted C/C++ object in PySide...
        layout = self.findChild(QHBoxLayout, 'uiToolbarLAYOUT')
        
        if before is not None:
            index = None
            for i in range(layout.count()):
                if layout.itemAt(i).widget() == before:
                    index = i
                    break
            
            if index is not None:
                layout.insertWidget(index, widget)
            else:
                layout.addWidget(widget)
            
        if align == Qt.AlignLeft:
            layout.insertWidget(0, widget)
        else:
            layout.addWidget(widget)
1250281
def add_widget(self, w):
        """"""
        if self.layout():
            self.layout().addWidget(w)
        else:
            layout = QVBoxLayout(self)
            layout.addWidget(w)
670481
def dockWidget(self, widget, title, area):
        
        assert widget.parent() is None, "Widget already has a parent"

        dockWidget = QtWidgets.QDockWidget(title, parent=self)
        dockWidget.setObjectName("dock_" + string_to_identifier(title))
        dockWidget.setWidget(widget)

        # Prevent parent context menu (with e.g. 'set inspector" option) to be displayed.
        dockWidget.setContextMenuPolicy(Qt.PreventContextMenu)

        self.addDockWidget(area, dockWidget)
        self.viewMenu.addAction(dockWidget.toggleViewAction())
        return dockWidget
93946
def add_grid(self, *args, **kwargs):
        
        from .grid import Grid
        grid = Grid(*args, **kwargs)
        return self.add_widget(grid)
152583
def refreshAlignmentUi(self):
        
        align = self.alignment()
        for name, value in (('align_left', Qt.AlignLeft),
                            ('align_right', Qt.AlignRight),
                            ('align_center', Qt.AlignHCenter),
                            ('align_justify', Qt.AlignJustify)):
            
            act = self._actions[name]
            act.blockSignals(True)
            act.setChecked(value == align)
            act.blockSignals(False)
186530
public void setEditWidget(I_CmsEditWidget editWidget) {

        // the edit widget may be set only once
        assert m_editWidget == null;
        m_editWidget = editWidget;
        m_mainPanel.add(m_editWidget);
        m_editWidget.asWidget().addStyleName(I_CmsLayoutBundle.INSTANCE.form().widget());
    }
1020450
def create_widget(self):
        
        d = self.declaration
        self.widget = LinearLayout(self.get_context(), None, d.style)
61968
def init_ui(self, ):
        
        self.sidebar = self.get_maya_sidebar()
        self.lay = self.sidebar.layout()
        self.tool_pb = QtGui.QPushButton("JB Wins")
        self.tooltip = JB_WindowToolTip()
        self.tooltip.install_tooltip(self.tool_pb)
        self.lay.addWidget(self.tool_pb)
        self.tool_pb.clicked.connect(self.tooltip.show)
1348637
def set_toolbar_children_widgets(self):
        

        LOGGER.debug("> Adding 'Application_Logo_label' widget!")
        self.addWidget(self.get_application_logo_label())

        LOGGER.debug("> Adding 'Spacer_label' widget!")
        self.addWidget(self.get_spacer_label())

        LOGGER.debug("> Adding 'Development_active_label', 'Preferences_active_label' widgets!")
        for layout_active_label in self.get_layouts_active_labels():
            self.addWidget(layout_active_label)

        LOGGER.debug("> Adding 'Custom_Layouts_active_label' widget!")
        self.addWidget(self.get_custom_layouts_active_label())

        LOGGER.debug("> Adding 'Miscellaneous_active_label' widget!")
        self.addWidget(self.get_miscellaneous_active_label())

        LOGGER.debug("> Adding 'Closure_Spacer_label' widget!")
        self.addWidget(self.get_closure_spacer_label())

        return True
358255
def setCentralWidget( self, widget ):
        
        self._scrollArea.takeWidget()
        self._scrollArea.setWidget(widget)
        
        self.adjustSize()
581647
def setAlignment(self, align):
        
        self.blockSignals(True)
        self.editor().setAlignment(align)
        self.blockSignals(False)
        self.refreshAlignmentUi()
534972
def create_widget(self):
        
        d = self.declaration
        self.widget = DatePicker(self.get_context(), None,
                                 d.style or "@attr/datePickerStyle")
656488
def init_widget(self):
        
        super(UiKitEditText, self).init_widget()

        #: Init font properties etc...
        self.init_text()

        d = self.declaration
        if d.placeholder:
            self.set_placeholder(d.placeholder)
        if d.input_type != 'text':
            self.set_input_type(d.input_type)
        if d.style:
            self.set_style(d.style)

        #: A really ugly way to add the target
        #: would be nice if we could just pass the block pointer here :)
        self.get_app().bridge.addTarget(
            self.widget,
            forControlEvents=UITextField.UIControlEventEditingChanged,
            andCallback=self.widget.getId(),
            usingMethod="onValueChanged",
            withValues=["text"]#,"selected"]
        )

        self.widget.onValueChanged.connect(self.on_value_changed)
4045
def create_widget(self):
        
        d = self.declaration
        self.dialog = Dialog(self.get_context(), d.style)
742869
def addTab(self, widget, *args):
        
        widget.dirty_changed.connect(self._on_dirty_changed)
        super(CodeEditTabWidget, self).addTab(widget, *args)
1041218
def modal(widget, parent=None, align=QtCore.Qt.AlignTop | QtCore.Qt.AlignRight, blurred=True):
        
        if parent is None:
            parent = QtGui.QApplication.instance().activeWindow()

        overlay = XOverlayWidget(parent)
        overlay.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        overlay.setCentralWidget(widget)
        overlay.setCloseAlignment(align)
        overlay.show()
        return overlay
870575
def insertTab(self, index, widget, title):
        
        self.insertWidget(index, widget)
        tab = self.tabBar().insertTab(index, title)
        tab.titleChanged.connect(widget.setWindowTitle)