Results 1 to 20 of 22

Thread: Custom Widget in QListWidget doesn't show correct in list

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #15
    Join Date
    Oct 2012
    Location
    The land of pain (NY)
    Posts
    99
    Thanks
    7
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Windows Android

    Default Re: Custom Widget in QListWidget doesn't show correct in list

    Quote Originally Posted by anda_skoa View Post
    I am not sure I understand, the slot should only get called once per receiver object.

    Do something like this in the slot

    Qt Code:
    1. qDebug() << Q_FUNC_INFO << "this=" << this;
    To copy to clipboard, switch view to plain text mode 
    and check if "this" is the same twice per emit.

    Cheers,
    _
    I will try this but in the meantime look at the slot in Controls.cpp It contains a debug statement:
    Qt Code:
    1. qDebug() << "ID Value = " << value;
    To copy to clipboard, switch view to plain text mode 

    For every instance the slot gets called the number of entries in the list. All the code for this small sample is posted. Maybe you can load it and run it to see what I mean. A UI which isn't posted will have to be created to have the three controls that is supposed to be in the custom widget.

    Update:

    The results of your suggestion is as follows:

    Qt Code:
    1. ID Value = 268
    2. void __thiscall Controls::WriteInfoNumber(int) this= Controls(0x389ef0, name = "Controls")
    3. ID Value = 147
    4. void __thiscall Controls::WriteInfoNumber(int) this= Controls(0x389ef0, name = "Controls")
    5. ID Value = 147
    6. void __thiscall Controls::WriteInfoNumber(int) this= Controls(0x389ef0, name = "Controls")
    7. ID Value = 627
    8. void __thiscall Controls::WriteInfoNumber(int) this= Controls(0x389ef0, name = "Controls")
    9. ID Value = 627
    10. void __thiscall Controls::WriteInfoNumber(int) this= Controls(0x389ef0, name = "Controls")
    11. ID Value = 627
    12. void __thiscall Controls::WriteInfoNumber(int) this= Controls(0x389ef0, name = "Controls")
    To copy to clipboard, switch view to plain text mode 

    That's when calling on_actionFile_triggered() 3 times!
    Last edited by astodolski; 20th February 2014 at 17:56.

Similar Threads

  1. Replies: 4
    Last Post: 18th October 2013, 17:15
  2. Replies: 8
    Last Post: 21st May 2010, 11:26
  3. QListWidget doesn't show icons
    By franco.amato in forum Qt Programming
    Replies: 8
    Last Post: 16th March 2010, 14:15
  4. Custom Widget doesn t show.
    By Frej in forum Qt Tools
    Replies: 12
    Last Post: 11th March 2010, 10:48
  5. QMainWindow and custom widget doesn't show
    By Peppy in forum Qt Programming
    Replies: 9
    Last Post: 26th December 2009, 15:09

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.