Results 1 to 3 of 3

Thread: Hide the focus rectangle of a QGraphicsLineItem

  1. #1
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Hide the focus rectangle of a QGraphicsLineItem

    I'm deriving a class from QGraphicsLineItem, where I've set it to be selectable, i.e.,

    class Link : public QGraphicsLineItem
    {
    // constructor
    Link() { ...
    setFlags (QGraphicsItem::ItemIsSelectable);
    }
    }


    How can I make it's focus rectangle either transparent or turn it off with a flag?

    Thanks,
    Ron

  2. #2
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Hide the focus rectangle of a QGraphicsLineItem

    where you using line object?
    use setFocus
    e.g:
    Line ln;
    ln.setVisible();
    ln.setFocus();

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Hide the focus rectangle of a QGraphicsLineItem

    Next time please try to use our search engine first, because that issue has discussed sometimes before:

    Qt Code:
    1. void Link::paint(QPainter *p, const QStyleOptionGraphicsItem *o, QWidget *w)
    2. {
    3. QStyleOptionGraphicsItem *_o = const_cast<QStyleOptionGraphicsItem*>(o);
    4. _o->state &= ~QStyle::State_Selected;
    5. QGraphicsLineItem::paint(p,_o,w);
    6. }
    To copy to clipboard, switch view to plain text mode 

  4. The following user says thank you to Lykurg for this useful post:

    ronno (17th June 2009)

Similar Threads

  1. Window focus issues (How to force focus to a window?)
    By montylee in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2009, 02:00
  2. Force focus to a QTabWidget page's widget
    By thomaspu in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2008, 07:54
  3. Preventing blue focus rectangle
    By MrGarbage in forum Qt Programming
    Replies: 2
    Last Post: 21st December 2007, 16:36

Tags for this Thread

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.