Results 1 to 4 of 4

Thread: How to iterate a QList of structs and modify struct elements directly?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2016
    Posts
    10
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to iterate a QList of structs and modify struct elements directly?

    I put something in m_fireButton with line #6:
    Qt Code:
    1. bs->pb = new QPushButton(m_centralWidget);
    To copy to clipboard, switch view to plain text mode 
    bs->pb is a pointer to m_fireButton.

    At least I thought so, I think a copy is occurring somewhere instead of the pointer itself.

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to iterate a QList of structs and modify struct elements directly?

    Quote Originally Posted by bobbayribs View Post
    I put something in m_fireButton with line #6:
    Qt Code:
    1. bs->pb = new QPushButton(m_centralWidget);
    To copy to clipboard, switch view to plain text mode 
    bs->pb is a pointer to m_fireButton.

    At least I thought so, I think a copy is occurring somewhere instead of the pointer itself.
    1. After this line bs->pb is pointing to new QPushButton no to m_fireButton.
    2. bs->pb is NOT a pointer to m_fireButton. It is a pointer to QPushButton with the same value as m_fireButton.

    Sorry, these are the basics of C ++ - nothing to Qt.

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

    bobbayribs (27th December 2017)

Similar Threads

  1. Can't compile QList<struct>
    By mikrocat in forum Qt Programming
    Replies: 5
    Last Post: 4th November 2015, 06:04
  2. QList<struct>
    By Axsis in forum Newbie
    Replies: 11
    Last Post: 12th October 2015, 07:48
  3. How to fill a QList<struct> ?
    By falconium in forum Newbie
    Replies: 1
    Last Post: 1st March 2011, 21:59
  4. Use QXmlStreamWriter to modify existing elements
    By rhf417 in forum Qt Programming
    Replies: 8
    Last Post: 25th June 2009, 02:23
  5. memset struct with QString elements
    By Timewarp in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 01:48

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
  •  
Qt is a trademark of The Qt Company.