Results 1 to 5 of 5

Thread: QGraphicsTextItem dont open Link /bug?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QGraphicsTextItem dont open Link /bug?

    Why QGraphicsTextItem dont open link? is this a bug?

    or is here other method to append QGraphicsTextItem to scene?

    a minimal build main.cpp is attach here.

    Qt Code:
    1. /* load central widget */
    2. void Load_Connector()
    3. {
    4. view = new QGraphicsView(this); /* QMainWindow */
    5. Vbar = view->verticalScrollBar();
    6. Hbar = view->horizontalScrollBar();
    7. QGraphicsScene *scene = new QGraphicsScene(view);
    8. scene->setSceneRect( 0, 0, 1000, 1000 );
    9. view->setScene(scene);
    10. setCentralWidget(view);
    11. /* set tag xhtml to projekt xml tag */
    12. QString qthtml = "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\"><span style=\" font-family:'Impact'; font-size:26pt; color:#5555ff;\">H</span>"
    13. "<span style=\" font-family:'Impact'; font-size:26pt; color:#0000ff;\">e</span>"
    14. "<span style=\" font-family:'Impact'; font-size:26pt; color:#ff0000;\">l</span>"
    15. "<span style=\" font-family:'Impact'; font-size:26pt; color:#ffff00;\">l</span>"
    16. "<span style=\" font-family:'Impact'; font-size:26pt; color:#ffaa7f;\">o</span>"
    17. "<span style=\" font-family:'Impact'; font-size:26pt;\"> </span>"
    18. "<span style=\" font-family:'Impact'; font-size:26pt; color:#00ff00;\">color</span>"
    19. "<span style=\" font-family:'Impact'; font-size:26pt; color:#ff0000;\"> world</span>"
    20. "<span style=\" font-family:'Impact'; font-size:26pt;\">!</span>"
    21. "<a href=\"http://wiki.qtcentre.org/index.php?title=QGraphicsTextItem\"><span style=\" text-decoration: underline; color:#0000ff;\">link</span></a> </p> ";
    22.  
    23. QGraphicsTextItem* txtarea = scene->addText("");
    24. txtarea->setHtml(qthtml);
    25. txtarea->setOpenExternalLinks(true); /* set clickable */
    26. txtarea->setFlag(QGraphicsItem::ItemIsMovable);
    27. ViewPoint(0); /* scroll area stay 0 to init! */
    28. }
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

Similar Threads

  1. add link that open web browser on unix
    By asafb in forum Qt Programming
    Replies: 7
    Last Post: 25th January 2009, 21:55
  2. How to open external page link using tabwidget
    By jyoti in forum Qt Programming
    Replies: 2
    Last Post: 13th November 2006, 10:43
  3. LINK : fatal error LNK1181: can't open 'delayimp.lib'
    By fcamlar in forum Installation and Deployment
    Replies: 10
    Last Post: 7th July 2006, 13:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.