Results 1 to 2 of 2

Thread: Find item index in QGraphicsLinearLayout

  1. #1
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Find item index in QGraphicsLinearLayout

    How i can find item index in QGraphicsLinearLayout, like findWidget in QLayout? And how i can remove stretch?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,332
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: Find item index in QGraphicsLinearLayout

    Write your own findItem:

    Qt Code:
    1. int findItem( QGraphicsLinearLayout * pLayout, QGraphicsItem * pItem )
    2. {
    3. for ( int nItem = 0; nItem < pLayout->count(); ++nItem )
    4. if ( pItem == pLayout->itemAt( nItem )->graphicsItem() )
    5. return nItem;
    6. return -1;
    7. }
    To copy to clipboard, switch view to plain text mode 

    As for removing stretch, I suppose it occupies an index in the QGraphicsLinearLayout, so QGraphicsLinearLayout::removeAt() should do it.

  3. The following user says thank you to d_stranz for this useful post:

    bmn (23rd May 2014)

Similar Threads

  1. Replies: 2
    Last Post: 13th March 2014, 19:11
  2. Replies: 2
    Last Post: 11th October 2013, 11:16
  3. How to find out row index of a QTableWidget.
    By Niamita in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2012, 15:32
  4. Replies: 8
    Last Post: 19th July 2011, 10:52
  5. Replies: 0
    Last Post: 3rd February 2010, 13:38

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.