Results 1 to 2 of 2

Thread: Problem on set QGraphicsTextItem write protect.

  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 Problem on set QGraphicsTextItem write protect.

    I fill my QGraphicsTextItem with QTextDocument text image and all style i rotate this floating text and image like other paint. Now i like to lock the text and on qmenu , i swap QGraphicsTextItem to other flag ...
    Why the parent can write inside? and paint this objekt? parent is only QGraphicsScene..!

    how i can solve this?

    My enum is valid and display correct¨!

    Qt Code:
    1. /* class FloatDiagram : public QGraphicsTextItem */
    2. /* FloatDiagram( const GenAttribute &p , QMenu *Diss , QGraphicsItem *parent, QGraphicsScene *scene ) */
    3.  
    4. void FloatDiagram::FloatLock()
    5. {
    6. setOpenExternalLinks(true);
    7. setTextInteractionFlags(Qt::NoTextInteraction);
    8. setTextInteractionFlags(Qt::LinksAccessibleByMouse);
    9. setTextInteractionFlags(Qt::TextBrowserInteraction);
    10. modus = MODUS_LOCK; /* enum write protect not move only click link */
    11. }
    12.  
    13. void FloatDiagram::FloatUnLock()
    14. {
    15. setFlag(QGraphicsItem::ItemIsMovable, true);
    16. setFlag(QGraphicsItem::ItemIsSelectable, true);
    17. setTextInteractionFlags(Qt::NoTextInteraction); /* edit on double click if not lock */
    18. modus = MODUS_MOVE; /* enum to move and edit */
    19. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problem on set QGraphicsTextItem write protect.

    This seems ok. Are you using setTextInteractionFlags anywhere else in code ?
    If so do verify(if possible post) whether they are modifying the flags or not.
    Also make sure the functions(FloatLock and FloatUnLock) are being called (double check this!)

    BTW calling setTextIntetactionFlags multiple times doesn't have the effect you need. It just sets the flag to the value passed to the last function call. You need to use an OR combination in a single call instead of calling multiple times individually.
    I mean , in your case the final value of textInteractionFlags will be Qt::TextBrowserInteraction and not combination of all three. Actually i still dont understand your intention of multiple calls.
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

Similar Threads

  1. QGraphicsTextItem focus problem
    By Gopala Krishna in forum Qt Programming
    Replies: 5
    Last Post: 26th June 2007, 17:25

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.