VirtualBox

Changeset 1467 in vbox for trunk


Ignore:
Timestamp:
Mar 14, 2007 11:38:46 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
19526
Message:

Hypertext references support added into QIRichLabel extension.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/QIRichLabel.h

    r1017 r1467  
    9595   void         drawContents ( QPainter * );
    9696   void         fontChange ( const QFont & );
     97   void         mouseMoveEvent (QMouseEvent *);
     98   void         mousePressEvent (QMouseEvent *);
    9799   void         resizeEvent ( QResizeEvent* );
    98100   void         focusInEvent ( QFocusEvent* );
     
    102104signals:
    103105   void         textChanged();
     106   void         clickedOnLink (const QString&);
    104107
    105108private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/QIRichLabel.cpp

    r1213 r1467  
    4242#include <qaction.h>
    4343#include <qclipboard.h>
     44#include <qcursor.h>
    4445
    4546class QLabelPrivate
     
    115116   popupMenu = new QPopupMenu (this, "contextMenu");
    116117   copyAction->addTo (popupMenu);
     118
     119   setMouseTracking (true);
    117120}
    118121
     
    369372   d->msh = sz;
    370373   return sz;
     374}
     375
     376
     377void QIRichLabel::mouseMoveEvent (QMouseEvent *aEvent)
     378{
     379    if (!doc) return;
     380
     381    QString link = doc->anchorAt (aEvent->pos());
     382    if (!link.isEmpty()) /* Mouse cursor above link */
     383        setCursor (QCursor (Qt::PointingHandCursor));
     384    else /* Mouse cursor above non-link */
     385        setCursor (QCursor (Qt::ArrowCursor));
     386}
     387
     388
     389void QIRichLabel::mousePressEvent (QMouseEvent *aEvent)
     390{
     391    if (!doc) return;
     392
     393    QString link = doc->anchorAt (aEvent->pos());
     394    if (!link.isEmpty()) /* Mouse clicked on the link */
     395        emit clickedOnLink (link);
    371396}
    372397
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette