def __init__(self, sourceModel, isProjectFilter, parent=None): QTreeView.__init__(self, parent) self.__model = sourceModel self.__sortModel = FilesBrowserSortFilterProxyModel(isProjectFilter) self.__sortModel.setSourceModel(self.__model) self.setModel(self.__sortModel) self.activated.connect(self.openSelectedItem) self.expanded.connect(self._resizeColumns) self.collapsed.connect(self._resizeColumns) self.setRootIsDecorated(True) self.setAlternatingRowColors(True) self.setUniformRowHeights(True) self.setItemDelegate(NoOutlineHeightDelegate(4)) header = self.header() header.setSortIndicator(0, Qt.AscendingOrder) header.setSortIndicatorShown(True) header.setClickable(True) self.setSortingEnabled(True) self.setSelectionMode(QAbstractItemView.SingleSelection) self.setSelectionBehavior(QAbstractItemView.SelectRows) self.header().setStretchLastSection(True) self.layoutDisplay() self.__debugMode = False return
def __init__(self, mainWindow): QTreeView.__init__(self, mainWindow) self.mainWindow = mainWindow self.setModel(DBModel(self)) self.setHeaderHidden(True) self.setEditTriggers(QTreeView.EditKeyPressed | QTreeView.SelectedClicked) self.setDragEnabled(True) self.setAcceptDrops(True) self.setDropIndicatorShown(True) self.connect( self.selectionModel(), SIGNAL("currentChanged(const QModelIndex&, const QModelIndex&)"), self.currentItemChanged) self.connect(self, SIGNAL("expanded(const QModelIndex&)"), self.itemChanged) self.connect(self, SIGNAL("collapsed(const QModelIndex&)"), self.itemChanged) self.connect( self.model(), SIGNAL("dataChanged(const QModelIndex&, const QModelIndex&)"), self.modelDataChanged) self.connect(self.model(), SIGNAL("notPopulated"), self.collapse)
def __init__(self, _=None, parent=None): QTreeView.__init__(self, parent) self.setAlternatingRowColors(True) self.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel) self.controller = None self.header().setResizeMode(QHeaderView.ResizeToContents) self.setDragEnabled(True)
def __init__(self, parent): QTreeView.__init__(self, parent) while not isinstance(parent, QDialog) and not isinstance(parent, QMainWindow): parent = parent.parent() self.setObjectName("TreeView" + str(len(parent.findChildren(TreeView)))) # self.setObjectName("TreeViewWidget") # self.hLayout = QHBoxLayout(self) # self.hLayout.setObjectName("hLayout") # # sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) # sizePolicy.setHorizontalStretch(0) # sizePolicy.setVerticalStretch(0) # sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) # self.setSizePolicy(sizePolicy) # # # self.frame = Frame() # self = QTreeView(self) # self.hLayout.addWidget(self) self.stdModel = QStandardItemModel() self.setModel(self.stdModel) self.hasObject = False self.treeNodeList = [] self.checkBoxList = [] self.setHeaderHidden(True)
def __init__ ( self, editor ): QTreeView.__init__( self ) self._editor = editor self.connect( self, SIGNAL( 'doubleClicked(QModelIndex)' ), editor._on_dclick )
def __init__( self, parent = None ): QTreeView.__init__( self, parent ) self.__parentDialog = parent self.__model = FindFileModel() self.__sortModel = FindFileSortFilterProxyModel() self.__sortModel.setDynamicSortFilter( True ) self.__sortModel.setSourceModel( self.__model ) self.setModel( self.__sortModel ) self.selectedIndex = None self.activated.connect( self.openCurrentItem ) self.setRootIsDecorated( False ) self.setAlternatingRowColors( True ) self.setUniformRowHeights( True ) self.setItemDelegate( NoOutlineHeightDelegate( 4 ) ) header = self.header() header.setSortIndicator( 0, Qt.AscendingOrder ) header.setSortIndicatorShown( True ) header.setClickable( True ) self.setSortingEnabled( True ) self.setSelectionMode( QAbstractItemView.SingleSelection ) self.setSelectionBehavior( QAbstractItemView.SelectRows ) self.layoutDisplay() return
def __init__(self, parent=None): QTreeView.__init__(self, parent) self.__parentDialog = parent self.__model = FindFileModel() self.__sortModel = FindFileSortFilterProxyModel() self.__sortModel.setDynamicSortFilter(True) self.__sortModel.setSourceModel(self.__model) self.setModel(self.__sortModel) self.selectedIndex = None self.activated.connect(self.openCurrentItem) self.setRootIsDecorated(False) self.setAlternatingRowColors(True) self.setUniformRowHeights(True) self.setItemDelegate(NoOutlineHeightDelegate(4)) header = self.header() header.setSortIndicator(0, Qt.AscendingOrder) header.setSortIndicatorShown(True) header.setClickable(True) self.setSortingEnabled(True) self.setSelectionMode(QAbstractItemView.SingleSelection) self.setSelectionBehavior(QAbstractItemView.SelectRows) self.layoutDisplay() return
def __init__(self, parent_widget): ''' Tree view for displaying data in a XmlModel @param parent_widget (QWidget): Parent widget ''' QTreeView.__init__(self, parent_widget) self.setAnimated(True) self.setMinimumHeight(200)
def __init__(self, parent=None, **kwargs): QTreeView.__init__(self, parent, **kwargs) self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding) self.__model = QStandardItemModel() self.__flattened = False self.__actionRole = Qt.UserRole self.__view = None self.__setupUi()
def __init__(self, parent_widget): ''' Tree view for displaying data in a XmlModel @param parent_widget (QWidget): Parent widget ''' QTreeView.__init__(self, parent_widget) self.setAnimated(True) self.setMinimumHeight(200) # handled by the controller: self.setExpandsOnDoubleClick(False)
def __init__(self): QTreeView.__init__(self) self.model = QDirModel() self.setModel(self.model) self.setSortingEnabled(True) i = self.model.index(os.getcwd()) self.scrollTo(i) self.expand(i) self.setCurrentIndex(i) for i in range(self.model.columnCount()): self.resizeColumnToContents(i)
def __init__(self, fileBrowser): QTreeView.__init__(self, fileBrowser) self._fileBrowser = fileBrowser self.setAttribute(Qt.WA_MacShowFocusRect, False) self.setAttribute(Qt.WA_MacSmallSize) self.setContextMenuPolicy(Qt.ActionsContextMenu) self.setHeaderHidden(True) self.setUniformRowHeights(True) self.setTextElideMode(Qt.ElideMiddle) # dir model self._dirsModel = _FileSystemModel(self) self._dirsModel.setNameFilterDisables(False) self._dirsModel.setFilter(QDir.AllDirs | QDir.AllEntries | QDir.CaseSensitive | QDir.NoDotAndDotDot) # self._dirsModel.directoryLoaded.connect(self.setFocus) TODO don't have this signal in my Qt version # create proxy model self._filteredModel = FileBrowserFilteredModel(self) self._filteredModel.setSourceModel(self._dirsModel) self.setModel(self._filteredModel) if not sys.platform.startswith('win'): self._dirsModel.setRootPath("/") else: self._dirsModel.setRootPath('') # shortcut accessible only when self._tree has focus self._upShortcut = QShortcut(QKeySequence("BackSpace"), self) self._upShortcut.setContext(Qt.WidgetShortcut) self._upShortcut.activated.connect(self.moveUp) # shortcut accessible only when self._tree has focus self._homeShortcut = QShortcut(QKeySequence("`"), self) self._homeShortcut.setContext(Qt.WidgetShortcut) self._homeShortcut.activated.connect(self._goUserHomeDir) # shortcut accessible only when self._tree has focus self._homeShortcut = QShortcut(QKeySequence("."), self) self._homeShortcut.setContext(Qt.WidgetShortcut) self._homeShortcut.activated.connect(self._goCurrentDir) self.activated.connect(self._onActivated) self._fileActivated.connect(fileBrowser.fileActivated) # QDirModel loads item asynchronously, therefore we need timer for setting focus to the first item self._setFocusTimer = QTimer() self._setFocusTimer.timeout.connect(self._setFirstItemAsCurrent) self._setFocusTimer.setInterval(50) self.destroyed.connect(self._setFocusTimer.stop) self._timerAttempts = 0
def __init__(self, fileBrowser): QTreeView.__init__(self, fileBrowser) self._fileBrowser = fileBrowser self.setAttribute( Qt.WA_MacShowFocusRect, False ) self.setAttribute( Qt.WA_MacSmallSize ) self.setContextMenuPolicy( Qt.ActionsContextMenu ) self.setHeaderHidden( True ) self.setUniformRowHeights( True ) self.setTextElideMode(Qt.ElideMiddle) # dir model self._dirsModel = _FileSystemModel( self ) self._dirsModel.setNameFilterDisables( False ) self._dirsModel.setFilter( QDir.AllDirs | QDir.AllEntries | QDir.CaseSensitive | QDir.NoDotAndDotDot ) # self._dirsModel.directoryLoaded.connect(self.setFocus) TODO don't have this signal in my Qt version # create proxy model self._filteredModel = FileBrowserFilteredModel( self ) self._filteredModel.setSourceModel( self._dirsModel ) self.setModel( self._filteredModel) if not sys.platform.startswith('win'): self._dirsModel.setRootPath( "/" ) else: self._dirsModel.setRootPath('') # shortcut accessible only when self._tree has focus self._upShortcut = QShortcut( QKeySequence( "BackSpace" ), self ) self._upShortcut.setContext( Qt.WidgetShortcut ) self._upShortcut.activated.connect(self.moveUp) # shortcut accessible only when self._tree has focus self._homeShortcut = QShortcut( QKeySequence( "`" ), self ) self._homeShortcut.setContext( Qt.WidgetShortcut ) self._homeShortcut.activated.connect(self._goUserHomeDir) # shortcut accessible only when self._tree has focus self._homeShortcut = QShortcut( QKeySequence( "." ), self ) self._homeShortcut.setContext( Qt.WidgetShortcut ) self._homeShortcut.activated.connect(self._goCurrentDir) self.activated.connect(self._onActivated) self._fileActivated.connect(fileBrowser.fileActivated) # QDirModel loads item asynchronously, therefore we need timer for setting focus to the first item self._setFocusTimer = QTimer() self._setFocusTimer.timeout.connect(self._setFirstItemAsCurrent) self._setFocusTimer.setInterval(50) self.destroyed.connect(self._setFocusTimer.stop) self._timerAttempts = 0
def __init__(self, parent=None): QTreeView.__init__(self, parent) # Connect self.connect(self, SIGNAL("customContextMenuRequested(QPoint)"), self.show_context_menu) self.connect(self, SIGNAL("doubleClicked(const QModelIndex&)"), self.item_double_clicked) self.ctx_menu_actions = {} for name, text in self.ctx_menu.items(): action = QAction(text, self) self.ctx_menu_actions[name] = action self.connect(action, SIGNAL("triggered()"), getattr(self, name))
def __init__(self, parent=None): QTreeView.__init__(self, parent) self.__root = TreeItem("ERT") self.__tree_model = TreeModel(self.__root) self.setModel(self.__tree_model) #: :type: dict of (str, TreeItem) self.__groups = {} self.header().hide()
def __init__(self, parent): QTreeView.__init__(self, parent) self.setObjectName("filetree") self.setSortingEnabled(True) self.setColumnWidth(0, 50) font = self.font() font.setPointSize(10) self.setFont(font) self.setHeaderHidden(True) self.setModel(QApplication.instance().filetree) for col in xrange(1, self.model().columnCount()): self.setColumnHidden(col, True) self.setRootIndex(self.model().index(os.path.expanduser('~'))) self.clicked.connect(self._select_file)
def __init__(self, parent=None, path=None): QTreeView.__init__(self, parent) self.ide = parent self.path = path self.model = explorerModel() self.setModel(self.model) self.setColumnHidden(3, True) self.setColumnHidden(2, True) self.setAnimated(False) self.setSortingEnabled(True) self.sortByColumn(0, Qt.AscendingOrder)
def __init__(self,parent): QTreeView.__init__(self,parent) newFileAction=QAction(QIcon.fromTheme("document-new"),"New File",self) newFileAction.triggered.connect(self.newFile) self.addAction(newFileAction) newFolderAction=QAction(QIcon.fromTheme("folder-new"),"New Folder",self) newFolderAction.triggered.connect(self.newFolder) self.addAction(newFolderAction) deleteAction=QAction(QIcon.fromTheme("edit-delete"),"Delete",self) deleteAction.setShortcut(QKeySequence.Delete) deleteAction.triggered.connect(self.deleteFile) self.addAction(deleteAction)
def __init__(self, name, btnCopy=None, btnRemove=None, btnCompare=None, parent=None): QTreeView.__init__(self, parent) self.name = name self.setObjectName('RuleTreeView') self.btnCopy = btnCopy self.btnRemove = btnRemove self.btnCompare = btnCompare for button in [self.btnCopy, self.btnRemove, self.btnCompare]: if button: button.setEnabled(False) self.header().setObjectName('RuleTreeViewHeader') self.setSelectionMode(QAbstractItemView.SingleSelection) self.ruleModel = None self.ruleModelTest = None self.rulesets = [] self.differs = []
def __init__(self): QTreeView.__init__(self) self.model = QDirModel() self.setModel(self.model) self.setSortingEnabled(True) self.setAlternatingRowColors(True) self.setEditTriggers(QAbstractItemView.NoEditTriggers) self.setContextMenuPolicy(Qt.CustomContextMenu) self.setAutoExpandDelay(500) i = self.model.index(os.getcwd()) self.scrollTo(i) self.expand(i) self.setCurrentIndex(i) for i in range(self.model.columnCount()): self.resizeColumnToContents(i) self.connect(self, SIGNAL("doubleClicked(QModelIndex)"), self.itemAction) self.connect(self, SIGNAL("customContextMenuRequested(QPoint)"), self.showContextMenu)
def __init__(self, mainWindow): QTreeView.__init__(self, mainWindow) self.mainWindow = mainWindow self.setModel( DBModel(self) ) self.setHeaderHidden(True) self.setEditTriggers(QTreeView.EditKeyPressed|QTreeView.SelectedClicked) self.setDragEnabled(True) self.setAcceptDrops(True) self.setDropIndicatorShown(True) self.connect(self.selectionModel(), SIGNAL("currentChanged(const QModelIndex&, const QModelIndex&)"), self.currentItemChanged) self.connect(self, SIGNAL("expanded(const QModelIndex&)"), self.itemChanged) self.connect(self, SIGNAL("collapsed(const QModelIndex&)"), self.itemChanged) self.connect(self.model(), SIGNAL("dataChanged(const QModelIndex&, const QModelIndex&)"), self.modelDataChanged) self.connect(self.model(), SIGNAL("notPopulated"), self.collapse)
def __init__(self, parent=None): QTreeView.__init__(self, parent) self.parent_widget = parent self.name_filters = None filters = QDir.AllDirs | QDir.Files | QDir.Drives | QDir.NoDotAndDotDot sort_flags = QDir.Name | QDir.DirsFirst | \ QDir.IgnoreCase | QDir.LocaleAware self.setModel(QDirModel(QStringList(), filters, sort_flags, self)) self.connect(self, SIGNAL('expanded(QModelIndex)'), lambda: self.resizeColumnToContents(0)) self.connect(self, SIGNAL('collapsed(QModelIndex)'), lambda: self.resizeColumnToContents(0)) self.setAnimated(False) self.setSortingEnabled(True) self.sortByColumn(0, Qt.AscendingOrder)
def __init__( self, parent, bpointsModel ): QTreeView.__init__( self, parent ) self.__model = None self.setModel( bpointsModel ) self.setItemsExpandable( False ) self.setRootIsDecorated( False ) self.setAlternatingRowColors( True ) self.setUniformRowHeights( True ) self.setSelectionMode( QAbstractItemView.SingleSelection ) self.setSelectionBehavior( QAbstractItemView.SelectRows ) self.setItemDelegate( NoOutlineHeightDelegate( 4 ) ) self.setContextMenuPolicy( Qt.CustomContextMenu ) self.customContextMenuRequested.connect( self.__showContextMenu ) self.doubleClicked.connect( self.__doubleClicked ) self.__createPopupMenus() return
def __init__(self, parent, wpointsModel): QTreeView.__init__(self, parent) self.__model = None self.setModel(wpointsModel) self.setItemsExpandable(False) self.setRootIsDecorated(False) self.setAlternatingRowColors(True) self.setUniformRowHeights(True) self.setSelectionMode(QAbstractItemView.SingleSelection) self.setSelectionBehavior(QAbstractItemView.SelectRows) self.setItemDelegate(NoOutlineHeightDelegate(4)) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.__showContextMenu) self.doubleClicked.connect(self.__doubleClicked) self.__createPopupMenus() return
def __init__( self, sourceModel, parent = None ): QTreeView.__init__( self, parent ) self.__model = sourceModel self.__sortModel = ObjectsBrowserSortFilterProxyModel() self.__sortModel.setDynamicSortFilter( True ) self.__sortModel.setSourceModel( self.__model ) self.setModel( self.__sortModel ) self.contextItem = None self.connect( self, SIGNAL( "activated(const QModelIndex &)" ), self._openItem ) self.connect( self, SIGNAL( "expanded(const QModelIndex &)" ), self._resizeColumns ) self.connect( self, SIGNAL( "collapsed(const QModelIndex &)" ), self._resizeColumns ) GlobalData().project.fsChanged.connect( self.onFSChanged ) self.connect( self.__model, SIGNAL( 'modelReset()' ), self.updateCounter ) self.setRootIsDecorated( True ) self.setAlternatingRowColors( True ) self.setUniformRowHeights( True ) self.setItemDelegate( NoOutlineHeightDelegate( 4 ) ) header = self.header() header.setSortIndicator( 0, Qt.AscendingOrder ) header.setSortIndicatorShown( True ) header.setClickable( True ) self.setSortingEnabled( True ) self.setSelectionMode( QAbstractItemView.SingleSelection ) self.setSelectionBehavior( QAbstractItemView.SelectRows ) self.layoutDisplay() GlobalData().project.projectChanged.connect( self.__onProjectChanged ) return
def __init__(self, parent=None): QTreeView.__init__(self) self.header().setHidden(True) self.setAnimated(True) # Modelo self.model = QFileSystemModel(self) path = QDir.toNativeSeparators(QDir.homePath()) self.model.setRootPath(path) self.setModel(self.model) self.model.setNameFilters(["*.c", "*.h", "*.s"]) self.setRootIndex(QModelIndex(self.model.index(path))) self.model.setNameFilterDisables(False) # Se ocultan algunas columnas self.hideColumn(1) self.hideColumn(2) self.hideColumn(3) # Conexion self.doubleClicked.connect(self._open_file) Edis.load_lateral("explorer", self)
def __init__( self, parent = None ): QTreeView.__init__( self, parent ) self.setAnimated( True ) self.setDragEnabled( True ) self.setRootIsDecorated( False ) self.setFrameShape( QFrame.NoFrame ) self.setIconSize( QSize( 22, 22 ) ) self.header().setStretchLastSection( True ) # background color palette = self.viewport().palette() palette.setColor( self.viewport().backgroundRole(), Qt.transparent ) palette.setColor( self.viewport().foregroundRole(), palette.color( QPalette.WindowText ) ) self.viewport().setPalette( palette ) # Model self._model = QStandardItemModel() self.proxy = FlowItemSortFilterProxyModel( self ) self.proxy.setSourceModel( self._model ) self.setModel( self.proxy ) self.header().hide()
def __init__(self, parent=None): QTreeView.__init__(self, parent) self.setAnimated(True) self.setDragEnabled(True) self.setRootIsDecorated(False) self.setFrameShape(QFrame.NoFrame) self.setIconSize(QSize(22, 22)) self.header().setStretchLastSection(True) # background color palette = self.viewport().palette() palette.setColor(self.viewport().backgroundRole(), Qt.transparent) palette.setColor(self.viewport().foregroundRole(), palette.color(QPalette.WindowText)) self.viewport().setPalette(palette) # Model self._model = QStandardItemModel() self.proxy = FlowItemSortFilterProxyModel(self) self.proxy.setSourceModel(self._model) self.setModel(self.proxy) self.header().hide()
def __init__(self, parent): QTreeView.__init__(self, parent) self.setAlternatingRowColors(True) self.setSelectionBehavior(QAbstractItemView.SelectRows) self.setSelectionMode(QAbstractItemView.SingleSelection) self.connect(self, SIGNAL("expanded(QModelIndex)"), self.expanded)
def __init__(self, data, choices): self.old_rows = [] self.data = data self.choices = choices self.single = False QTreeView.__init__(self)
def __init__(self, parent=None, **kwargs): QTreeView.__init__(self, **kwargs) self.win = parent
def __init__(self, parent=None): QTreeView.__init__(self, parent) self.setItemDelegate(ScoreItemDelegate(self))
def __init__(self, parent=None): QTreeView.__init__(self, parent) self.clicked.connect(self.checkSelection_clicked) self.expanded.connect(self.checkSelection_expanded) self.collapsed.connect(self.checkSelection_collapsed)
def __init__(self, signalproxy, parent=None): QTreeView.__init__(self, parent) self.signalproxy = signalproxy self.doubleClicked.connect(self.openEntry) self.setHeaderHidden(True)
def __init__(self, controller, parent=None): QTreeView.__init__(self, parent) self.setAlternatingRowColors(True) self.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel) self.controller = controller self.expanded.connect(self.resizeColumn)
def __init__(self, parent = None): QTreeView.__init__(self) self.setUniformRowHeights(True) self.setItemsExpandable(True) self.setExpandsOnDoubleClick(True) self.connect(self, SIGNAL("expanded(QModelIndex)"), self.indexExpanded)
def __init__(self, parent=None): QTreeView.__init__(self) self.setUniformRowHeights(True) self.setItemsExpandable(True) self.setExpandsOnDoubleClick(True) self.connect(self, SIGNAL("expanded(QModelIndex)"), self.indexExpanded)