42 |
42 |
43 self.activated.connect(self.__activated) |
43 self.activated.connect(self.__activated) |
44 self.setStatusBarTextRole(BookmarksModel.UrlStringRole) |
44 self.setStatusBarTextRole(BookmarksModel.UrlStringRole) |
45 self.setSeparatorRole(BookmarksModel.SeparatorRole) |
45 self.setSeparatorRole(BookmarksModel.SeparatorRole) |
46 |
46 |
47 self.setContextMenuPolicy(Qt.CustomContextMenu) |
47 self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) |
48 self.customContextMenuRequested.connect(self.__contextMenuRequested) |
48 self.customContextMenuRequested.connect(self.__contextMenuRequested) |
49 |
49 |
50 def createBaseMenu(self): |
50 def createBaseMenu(self): |
51 """ |
51 """ |
52 Public method to get the menu that is used to populate sub menu's. |
52 Public method to get the menu that is used to populate sub menu's. |
75 """ |
75 """ |
76 Private slot handling the activated signal. |
76 Private slot handling the activated signal. |
77 |
77 |
78 @param idx index of the activated item (QModelIndex) |
78 @param idx index of the activated item (QModelIndex) |
79 """ |
79 """ |
80 if self._keyboardModifiers & Qt.ControlModifier: |
80 if self._keyboardModifiers & Qt.KeyboardModifier.ControlModifier: |
81 self.newTab.emit( |
81 self.newTab.emit( |
82 idx.data(BookmarksModel.UrlRole), |
82 idx.data(BookmarksModel.UrlRole), |
83 idx.data(Qt.DisplayRole)) |
83 idx.data(Qt.ItemDataRole.DisplayRole)) |
84 elif self._keyboardModifiers & Qt.ShiftModifier: |
84 elif self._keyboardModifiers & Qt.KeyboardModifier.ShiftModifier: |
85 self.newWindow.emit( |
85 self.newWindow.emit( |
86 idx.data(BookmarksModel.UrlRole), |
86 idx.data(BookmarksModel.UrlRole), |
87 idx.data(Qt.DisplayRole)) |
87 idx.data(Qt.ItemDataRole.DisplayRole)) |
88 else: |
88 else: |
89 self.openUrl.emit( |
89 self.openUrl.emit( |
90 idx.data(BookmarksModel.UrlRole), |
90 idx.data(BookmarksModel.UrlRole), |
91 idx.data(Qt.DisplayRole)) |
91 idx.data(Qt.ItemDataRole.DisplayRole)) |
92 self.__updateVisitCount(idx) |
92 self.__updateVisitCount(idx) |
93 |
93 |
94 def postPopulated(self): |
94 def postPopulated(self): |
95 """ |
95 """ |
96 Public method to add any actions after the tree. |
96 Public method to add any actions after the tree. |
138 continue |
138 continue |
139 |
139 |
140 if i == 0: |
140 if i == 0: |
141 self.openUrl.emit( |
141 self.openUrl.emit( |
142 child.data(BookmarksModel.UrlRole), |
142 child.data(BookmarksModel.UrlRole), |
143 child.data(Qt.DisplayRole)) |
143 child.data(Qt.ItemDataRole.DisplayRole)) |
144 else: |
144 else: |
145 self.newTab.emit( |
145 self.newTab.emit( |
146 child.data(BookmarksModel.UrlRole), |
146 child.data(BookmarksModel.UrlRole), |
147 child.data(Qt.DisplayRole)) |
147 child.data(Qt.ItemDataRole.DisplayRole)) |
148 self.__updateVisitCount(child) |
148 self.__updateVisitCount(child) |
149 |
149 |
150 def __contextMenuRequested(self, pos): |
150 def __contextMenuRequested(self, pos): |
151 """ |
151 """ |
152 Private slot to handle the context menu request. |
152 Private slot to handle the context menu request. |
207 """ |
207 """ |
208 idx = self.index(act) |
208 idx = self.index(act) |
209 |
209 |
210 self.openUrl.emit( |
210 self.openUrl.emit( |
211 idx.data(BookmarksModel.UrlRole), |
211 idx.data(BookmarksModel.UrlRole), |
212 idx.data(Qt.DisplayRole)) |
212 idx.data(Qt.ItemDataRole.DisplayRole)) |
213 self.__updateVisitCount(idx) |
213 self.__updateVisitCount(idx) |
214 |
214 |
215 def __openBookmarkInNewTab(self, act): |
215 def __openBookmarkInNewTab(self, act): |
216 """ |
216 """ |
217 Private slot to open a bookmark in a new browser tab. |
217 Private slot to open a bookmark in a new browser tab. |
221 """ |
221 """ |
222 idx = self.index(act) |
222 idx = self.index(act) |
223 |
223 |
224 self.newTab.emit( |
224 self.newTab.emit( |
225 idx.data(BookmarksModel.UrlRole), |
225 idx.data(BookmarksModel.UrlRole), |
226 idx.data(Qt.DisplayRole)) |
226 idx.data(Qt.ItemDataRole.DisplayRole)) |
227 self.__updateVisitCount(idx) |
227 self.__updateVisitCount(idx) |
228 |
228 |
229 def __openBookmarkInNewWindow(self, act): |
229 def __openBookmarkInNewWindow(self, act): |
230 """ |
230 """ |
231 Private slot to open a bookmark in a new window. |
231 Private slot to open a bookmark in a new window. |