PDA

View Full Version : signal when QList is not empty



Markus_AC
2nd November 2011, 14:27
How can I create a signal, when a QList is not empty?
So when I append an item, the signal should be emitted.

nish
2nd November 2011, 14:55
where are you stuck? It should be very easy. Check QList::isEmpty() and emit the signal.

Markus_AC
2nd November 2011, 15:02
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?

amleto
2nd November 2011, 20:22
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...