Results 1 to 4 of 4

Thread: signal when QList is not empty

  1. #1
    Join Date
    Aug 2011
    Location
    Germany
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default signal when QList is not empty

    How can I create a signal, when a QList is not empty?
    So when I append an item, the signal should be emitted.

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: signal when QList is not empty

    where are you stuck? It should be very easy. Check QList::isEmpty() and emit the signal.

  3. #3
    Join Date
    Aug 2011
    Location
    Germany
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: signal when QList is not empty

    So you tell me I manually have to check, if my QList is empty. In other words: every append should then emit the signal.
    But is there no automatic way to connect this append to a signal?

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: signal when QList is not empty

    there is no automatic way to have a qlist emit a signal. It isnt even a QObject so has no ability to 'emit'.

    And why would every append have to emit a signal? Check for size()==1, then signal. It's a trivial problem...
    Last edited by amleto; 2nd November 2011 at 20:38. Reason: empty -> size == 1
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. Cast QList<Foo*> to QList<const Foo*>
    By vfernandez in forum Qt Programming
    Replies: 0
    Last Post: 4th October 2010, 17:04
  2. Replies: 4
    Last Post: 20th August 2010, 14:54
  3. Replies: 2
    Last Post: 19th September 2008, 06:21
  4. remove directory empty or not empty
    By raphaelf in forum Newbie
    Replies: 12
    Last Post: 27th October 2006, 08:30
  5. queued signal/slot connection with QList<int>
    By smalls in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 15:32

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.