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


Python QtGui.QTreeView方法代码示例

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


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

示例1: setupUi

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QTreeView [as 别名]
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
        Dialog.resize(1304, 753)
        self.verticalLayout = QtGui.QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtGui.QLabel(Dialog)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.versions_treeView = QtGui.QTreeView(Dialog)
        self.versions_treeView.setObjectName("versions_treeView")
        self.verticalLayout.addWidget(self.versions_treeView)
        self.horizontalWidget = QtGui.QWidget(Dialog)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.horizontalWidget.sizePolicy().hasHeightForWidth())
        self.horizontalWidget.setSizePolicy(sizePolicy)
        self.horizontalWidget.setObjectName("horizontalWidget")
        self.horizontalLayout = QtGui.QHBoxLayout(self.horizontalWidget)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.selectNone_pushButton = QtGui.QPushButton(self.horizontalWidget)
        self.selectNone_pushButton.setObjectName("selectNone_pushButton")
        self.horizontalLayout.addWidget(self.selectNone_pushButton)
        self.selectAll_pushButton = QtGui.QPushButton(self.horizontalWidget)
        self.selectAll_pushButton.setObjectName("selectAll_pushButton")
        self.horizontalLayout.addWidget(self.selectAll_pushButton)
        self.update_pushButton = QtGui.QPushButton(self.horizontalWidget)
        self.update_pushButton.setObjectName("update_pushButton")
        self.horizontalLayout.addWidget(self.update_pushButton)
        self.cancel_pushButton = QtGui.QPushButton(self.horizontalWidget)
        self.cancel_pushButton.setObjectName("cancel_pushButton")
        self.horizontalLayout.addWidget(self.cancel_pushButton)
        self.verticalLayout.addWidget(self.horizontalWidget)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:42,代码来源:version_updater_UI_pyside.py

示例2: repair_tree_view

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QTreeView [as 别名]
def repair_tree_view():
    from PySide import QtGui
    doc = FreeCAD.ActiveDocument
    matches = []
    def search_children_recursively( node ):
        for c in node.children():
            if isinstance(c,QtGui.QTreeView) and isinstance(c, QtGui.QTreeWidget):
                matches.append(c)
            search_children_recursively( c)
    search_children_recursively(QtGui.QApplication.activeWindow())
    for m in matches:
        tree_nodes =  get_treeview_nodes(m)
        def get_node_by_label( label ):
            if label in tree_nodes and len( tree_nodes[label] ) == 1:
                return tree_nodes[label][0]
            elif not obj.Label in tree_nodes:
                FreeCAD.Console.PrintWarning( "  repair_tree_view: skipping %s since no node with text(0) == %s\n" % ( label, label) )
            else:
                FreeCAD.Console.PrintWarning( "  repair_tree_view: skipping %s since multiple nodes matching label\n" % ( label, label) )
        if doc.Label in tree_nodes: #all the code up until now has geen to find the QtGui.QTreeView widget (except for the get_node_by_label function)
            #FreeCAD.Console.PrintMessage( tree_nodes )
            for imported_obj in doc.Objects:
                try: #allow use of assembly2 contraints also on non imported objects
                    if isinstance( imported_obj.ViewObject.Proxy, ImportedPartViewProviderProxy ):
                        #FreeCAD.Console.PrintMessage( 'checking claim children for %s\n' % imported_obj.Label )
                        if get_node_by_label( imported_obj.Label ):
                            node_imported_obj =  get_node_by_label( imported_obj.Label )
                            if not hasattr( imported_obj.ViewObject.Proxy, 'Object'):
                                imported_obj.ViewObject.Proxy.Object = imported_obj # proxy.attach not called properly
                                FreeCAD.Console.PrintMessage('repair_tree_view: %s.ViewObject.Proxy.Object = %s' % (imported_obj.Name, imported_obj.Name) )
                            for constraint_obj in imported_obj.ViewObject.Proxy.claimChildren():
                                #FreeCAD.Console.PrintMessage('  - %s\n' % constraint_obj.Label )
                                if get_node_by_label( constraint_obj.Label ):
                                    #FreeCAD.Console.PrintMessage('     (found treeview node)\n')
                                    node_constraint_obj = get_node_by_label( constraint_obj.Label )
                                    if id( node_constraint_obj.parent()) != id(node_imported_obj):
                                        FreeCAD.Console.PrintMessage("repair_tree_view: %s under %s and not %s, repairing\n" % (constraint_obj.Label, node_constraint_obj.parent().text(0),  imported_obj.Label ))
                                        wrong_parent = node_constraint_obj.parent()
                                        wrong_parent.removeChild( node_constraint_obj )
                                        node_imported_obj.addChild( node_constraint_obj )
                except:
                    # FreeCAD.Console.PrintWarning( "not repaired %s \n" % ( imported_obj.Label ) )
                    pass
            #break 
开发者ID:hamish2014,项目名称:FreeCAD_assembly2,代码行数:46,代码来源:viewProviderProxy.py

示例3: __init__

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QTreeView [as 别名]
def __init__(self, title, obj_join = None): #none to be removed
        self.form = []
        self.obj_join = obj_join
        self.parts = self.obj_join.parts
        if hasattr(self.obj_join, "faces"):
            self.faces = self.obj_join.faces
        else:
            self.faces = PropertiesList()

        if title != "Crosspiece":
            self.partsList = PartsList(Part, self.parts)
        else:
            self.partsList = PartsList(CrossPartWidget, self.parts)
        self.tabsList = TabsList(self.faces)

        self.params_widget = None
        if self.params_widget:
            self.form.append(self.params_widget)
        self.hide_button = None
        self.show_button = None
        self.reset_transparency_button = None
        self.set_transparency_button = None
        self.active_document = self.obj_join.Document#FreeCAD.ActiveDocument
        self.tree_widget = QtGui.QWidget()
        self.tree_widget.setObjectName("TreePanel")
        self.tree_widget.setWindowTitle(title)
        self.tree_vbox = QtGui.QVBoxLayout(self.tree_widget)
        self.form.append(self.tree_widget)
        self.model = TreeModel()
        self.tree_view_widget = QtGui.QTreeView()
        self.tree_view_widget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
        self.tree_view_widget.setModel(self.model)
        self.tree_view_widget.setFixedHeight(250)
        self.selection_model = None
        self.tab_type_box = None
        self.edited_items = []
        self.edit_items_layout = None
        self.init_tree_widget()
        self.preview_doc = None
        self.show_other_state_checkbox = None
        self.other_object_list = []
        self.save_initial_objects()

        for item in self.parts:
            self.model.append_part(item.name, item.label, bool(item.link_name))

        for item in self.faces:
            self.model.append_tab(item.freecad_obj_name, item.tab_name, item.face_name, bool(item.link_name)) 
开发者ID:execuc,项目名称:LCInterlocking,代码行数:50,代码来源:treepanel.py


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