Results 1 to 6 of 6

Thread: QGraphicsTextItem focus problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QGraphicsTextItem focus problem

    How about enabling/disabling the action on the fly, more or less like this:
    Qt Code:
    1. class MyTextItem : public QGraphicsTextItem // QGraphicsTextItem inherits QObject
    2. {
    3. Q_OBJECT
    4. ...
    5.  
    6. signals:
    7. void editing(bool);
    8.  
    9. protected:
    10. void focusInEvent(QFocusEvent* event) {
    11. QGraphicsTextItem::focusInEvent(event);
    12. emit editing(true);
    13. }
    14.  
    15. void focusOutEvent(QFocusEvent* event) {
    16. QGraphicsTextItem::focusOutEvent(event);
    17. emit editing(false);
    18. }
    19. };
    20.  
    21. connect(textItem, SIGNAL(editing(bool)), deleteAction, SLOT(setDisabled(bool)));
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    Gopala Krishna (26th June 2007)

Similar Threads

  1. QGraphicsTextItem size
    By Angelo Moriconi in forum Qt Programming
    Replies: 1
    Last Post: 26th January 2007, 08:34
  2. Tab/Enter focus problem
    By b1 in forum Qt Programming
    Replies: 4
    Last Post: 23rd October 2006, 23:34
  3. Replies: 3
    Last Post: 26th September 2006, 12:16
  4. Replies: 16
    Last Post: 7th March 2006, 15:57

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.