Helpviewer/History/HistoryMenu.py

changeset 488
4174c2707dba
parent 454
d28d558f7484
child 501
5c615a85241a
equal deleted inserted replaced
487:4d41d03d3d00 488:4174c2707dba
205 205
206 @signal openUrl(const QUrl&, const QString&) emitted to open a URL in the current 206 @signal openUrl(const QUrl&, const QString&) emitted to open a URL in the current
207 tab 207 tab
208 @signal newUrl(const QUrl&, const QString&) emitted to open a URL in a new tab 208 @signal newUrl(const QUrl&, const QString&) emitted to open a URL in a new tab
209 """ 209 """
210 openUrl = pyqtSignal(QUrl, str)
211 newUrl = pyqtSignal(QUrl, str)
212
210 def __init__(self, parent = None): 213 def __init__(self, parent = None):
211 """ 214 """
212 Constructor 215 Constructor
213 216
214 @param parent reference to the parent widget (QWidget) 217 @param parent reference to the parent widget (QWidget)
219 self.__historyMenuModel = None 222 self.__historyMenuModel = None
220 self.__initialActions = [] 223 self.__initialActions = []
221 224
222 self.setMaxRows(7) 225 self.setMaxRows(7)
223 226
224 self.connect(self, SIGNAL("activated(const QModelIndex&)"), self.__activated) 227 self.activated.connect(self.__activated)
225 self.setStatusBarTextRole(HistoryModel.UrlStringRole) 228 self.setStatusBarTextRole(HistoryModel.UrlStringRole)
226 229
227 def __activated(self, idx): 230 def __activated(self, idx):
228 """ 231 """
229 Private slot handling the activated signal. 232 Private slot handling the activated signal.
230 233
231 @param idx index of the activated item (QModelIndex) 234 @param idx index of the activated item (QModelIndex)
232 """ 235 """
233 if self._keyboardModifiers & Qt.ControlModifier: 236 if self._keyboardModifiers & Qt.ControlModifier:
234 self.emit(SIGNAL("newUrl(const QUrl&, const QString&)"), 237 self.newUrl.emit(
235 idx.data(HistoryModel.UrlRole), 238 idx.data(HistoryModel.UrlRole),
236 idx.data(HistoryModel.TitleRole)) 239 idx.data(HistoryModel.TitleRole))
237 else: 240 else:
238 self.emit(SIGNAL("openUrl(const QUrl&, const QString&)"), 241 self.openUrl.emit(
239 idx.data(HistoryModel.UrlRole), 242 idx.data(HistoryModel.UrlRole),
240 idx.data(HistoryModel.TitleRole)) 243 idx.data(HistoryModel.TitleRole))
241 244
242 def prePopulated(self): 245 def prePopulated(self):
243 """ 246 """
288 """ 291 """
289 Private slot to show the history dialog. 292 Private slot to show the history dialog.
290 """ 293 """
291 dlg = HistoryDialog(self) 294 dlg = HistoryDialog(self)
292 dlg.setAttribute(Qt.WA_DeleteOnClose) 295 dlg.setAttribute(Qt.WA_DeleteOnClose)
293 self.connect(dlg, SIGNAL("newUrl(const QUrl&, const QString&)"), 296 dlg.newUrl.connect(self.newUrl)
294 self, SIGNAL("newUrl(const QUrl&, const QString&)")) 297 dlg.openUrl.connect(self.openUrl)
295 self.connect(dlg, SIGNAL("openUrl(const QUrl&, const QString&)"),
296 self, SIGNAL("openUrl(const QUrl&, const QString&)"))
297 dlg.show() 298 dlg.show()
298 299
299 def __clearHistoryDialog(self): 300 def __clearHistoryDialog(self):
300 """ 301 """
301 Private slot to clear the history. 302 Private slot to clear the history.

eric ide

mercurial