| 72 | self.ui.ganttView.setConstraintModel(self.constraintModel) |
| 73 | |
| 74 | def initActions(self): |
| 75 | self.newEntryAction = QAction("New entry", self) |
| 76 | self.newEntryAction.setShortcut(QKeySequence.New) |
| 77 | self.newEntryAction.triggered.connect(self.addNewEntry) |
| 78 | |
| 79 | self.removeEntryAction = QAction("Remove entry", self) |
| 80 | self.removeEntryAction.setShortcut(QKeySequence.Delete) |
| 81 | self.removeEntryAction.triggered.connect(self.removeEntry) |
| 82 | |
| 83 | self.demoAction = QAction("Demo entry", self) |
| 84 | self.demoAction.triggered.connect(self.addDemoEntry) |
| 85 | |
| 86 | self.printAction = QAction("Print Preview...", self) |
| 87 | self.printAction.triggered.connect(self.printPreview) |
| 88 | |
| 89 | self.zoomInAction = QAction("Zoom In", self) |
| 90 | self.zoomInAction.setShortcut(QKeySequence.ZoomIn) |
| 91 | self.zoomInAction.triggered.connect(self.zoomIn) |
| 92 | |
| 93 | self.zoomOutAction = QAction("Zoom Out", self) |
| 94 | self.zoomOutAction.setShortcut(QKeySequence.ZoomOut) |
| 95 | self.zoomOutAction.triggered.connect(self.zoomOut) |
| 96 | |
| 97 | self.ui.ganttView.leftView().setContextMenuPolicy(Qt.CustomContextMenu) |
| 98 | self.ui.ganttView.leftView().addAction(self.newEntryAction) |
| 99 | self.ui.ganttView.leftView().addAction(self.removeEntryAction) |
| 100 | |
| 101 | menuBar = QMenuBar(self) |
| 102 | self.setMenuBar(menuBar) |
| 103 | entryMenu = menuBar.addMenu("Entry") |
| 104 | entryMenu.addAction(self.newEntryAction) |
| 105 | entryMenu.addAction(self.removeEntryAction) |
| 106 | entryMenu.addSeparator() |
| 107 | entryMenu.addAction(self.demoAction) |
| 108 | entryMenu.addSeparator() |
| 109 | entryMenu.addAction(self.printAction) |
| 110 | |
| 111 | zoomMenu = menuBar.addMenu("Zoom") |
| 112 | zoomMenu.addAction(self.zoomInAction) |
| 113 | zoomMenu.addAction(self.zoomOutAction) |
| 114 | |
| 115 | # self.enableActions(QItemSelection()) |
| 116 | |
| 117 | def initItemDelegate(self): |
| 118 | delegate = EntryDelegate(self.constraintModel, self) |