SHARE
TWEET

Untitled

a guest May 19th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2.  
  3. from PyQt5 import QtWidgets
  4. from PySide2.QtWidgets import *
  5. from PySide2 import QtGui
  6. from PySide2 import QtCore
  7. from PySide2.QtGui import QIcon
  8. # from PySide2.QtWidgets import QMainWindow, QMdiArea, QTabWidget, QToolBar, QAction, QTextEdit, QMenu
  9.  
  10.  
  11.  
  12. from QTreeViewExample.src.model.Node import Node
  13. from QTreeViewExample.src.view.HierarchyTreeModel import HierarchyTreeModel
  14. from QTreeViewExample.src.view.HierarchyTreeView import HierarchyTreeView
  15.  
  16.  
  17. class MainWindow():
  18.     def __init__(self):
  19.  
  20.         app = QtWidgets.QApplication(sys.argv)
  21.  
  22.         window = QtWidgets.QWidget()
  23.  
  24.         # windo2 = QtWidgets.QMainWindow.
  25.  
  26.         window.setWindowTitle("Frka44")
  27.  
  28.  
  29.  
  30.         window.setGeometry(40,40,500,500)
  31.  
  32.         window.show()
  33.  
  34.         sys.exit(app.exec_())
  35.  
  36.  
  37. class TreeView():
  38.     def __init__(self):
  39.         app = QApplication(sys.argv)
  40.  
  41.         rootNode = Node("Workspace")
  42.         project1 = Node("Project1")
  43.         project2 = Node("Project2")
  44.         package11 = Node("Package11")
  45.  
  46.         rootNode.addChild(project1)
  47.         rootNode.addChild(project2)
  48.         project1.addChild(package11)
  49.  
  50.         treeModel = HierarchyTreeModel(rootNode)
  51.  
  52.         tree = HierarchyTreeView()
  53.         tree.setModel(treeModel)
  54.         tree.show()
  55.  
  56.         sys.exit(app.exec_())
  57.  
  58.  
  59.  
  60. class Example4(QtWidgets.QMainWindow):
  61.  
  62.     def __init__(self):
  63.         super(Example4, self).__init__()
  64.         self.initUI()
  65.  
  66.     def initUI(self):
  67.         textEdit = QtWidgets.QTextEdit()
  68.         # self.setCentralWidget(textEdit)
  69.  
  70.         exitAction = QtWidgets.QAction('Exit', self)
  71.         exitAction.setShortcut('Ctrl+Q')
  72.         exitAction.setStatusTip('Exit application')
  73.         exitAction.triggered.connect(self.close)
  74.  
  75.         newFile = QtWidgets.QAction('New File', self)
  76.         newFile.setShortcut('Ctrl+N')
  77.         newFile.setStatusTip('Create New File')
  78.         newFile.triggered.connect(self.close)
  79.  
  80.         openFile = QtWidgets.QAction('Open File', self)
  81.         openFile.setShortcut('Ctrl+O')
  82.         openFile.setStatusTip('Open New File')
  83.         openFile.triggered.connect(self.close)
  84.  
  85.  
  86.  
  87.  
  88.         self.statusBar()
  89.  
  90.         rootNode = Node("Workspace")
  91.         project1 = Node("Project1")
  92.         # project2 = Node("Project2")
  93.         # package11 = Node("Package11")
  94.         #
  95.         rootNode.addChild(project1)
  96.         # rootNode.addChild(project2)
  97.         # project1.addChild(package11)
  98.  
  99.         tre = QtWidgets.QWidget()
  100.         layout = QtWidgets.QVBoxLayout(tre)
  101.         # tre.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable)
  102.         # tre.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea)
  103.         treeModel = HierarchyTreeModel(rootNode)
  104.         tree = TreeView()
  105.         tree.setModel(treeModel)
  106.         tre.setWidget(tree)
  107.         # self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, tre)
  108.         layout.addWidget(tre)
  109.         tre.show()
  110.         self.setCentralWidget(layout)
  111.  
  112.         #STA JE QTDOCKWIDGETAREA JOS SA "="
  113.  
  114.  
  115.         menubar = self.menuBar()
  116.         fileMenu = menubar.addMenu('&File')
  117.         fileMenu.addAction(newFile)
  118.         fileMenu.addAction(openFile)
  119.         fileMenu.addAction(exitAction)
  120.  
  121.  
  122.         toolbar = self.addToolBar('Exit')
  123.         toolbar.addAction(exitAction)
  124.  
  125.         self.setGeometry(300, 300, 350, 250)
  126.         self.setWindowTitle('Main window')
  127.         self.show()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top