Ignore:
Timestamp:
01/16/13 18:32:53 (15 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Children:
11265:698f59d642c2, 11289:4f67585127bc
Message:

Providing help for widgets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/gui/quickhelp.py

    r11243 r11264  
    11from collections import Callable 
    22 
    3 from PyQt4.QtGui import QTextBrowser, QStatusTipEvent 
    4 from PyQt4.QtCore import QObject, QCoreApplication, QEvent, QTimer 
     3from PyQt4.QtGui import QTextBrowser, QStatusTipEvent, QWhatsThisClickedEvent 
     4from PyQt4.QtCore import QObject, QCoreApplication, QEvent, QTimer, QUrl 
    55from PyQt4.QtCore import pyqtSignal as Signal 
    66 
     
    2020        self.__timer = QTimer(self, timeout=self.__on_timeout, 
    2121                              singleShot=True) 
     22        self.anchorClicked.connect(self.__on_anchorClicked) 
    2223 
    2324    def showHelp(self, text, timeout=0): 
     
    6869            self.textChanged.emit() 
    6970 
     71    def __on_anchorClicked(self, anchor): 
     72        ev = QuickHelpDetailRequestEvent(anchor.toString(), anchor) 
     73        QCoreApplication.postEvent(self, ev) 
     74 
    7075 
    7176class QuickHelpTipEvent(QStatusTipEvent): 
     
    8691    def timeout(self): 
    8792        return self.__timeout 
     93 
     94 
     95class QuickHelpDetailRequestEvent(QWhatsThisClickedEvent): 
     96    def __init__(self, href, url): 
     97        QWhatsThisClickedEvent.__init__(self, href) 
     98        self.__url = QUrl(url) 
     99 
     100    def url(self): 
     101        return QUrl(self.__url) 
    88102 
    89103 
Note: See TracChangeset for help on using the changeset viewer.