[Qt-interest] Why do Qt collection classes not offer signals and slots?
Ross Driedger
ross at earz.ca
Thu Dec 17 17:37:35 CET 2009
On Thu, 17 Dec 2009 10:49:40 -0500, <qt-interest-request at trolltech.com>
wrote:
> Message: 5
> Date: Thu, 17 Dec 2009 16:42:57 +0100
> From: Hendrik Fu? <fuss at molecular-machines.com>
> Subject: [Qt-interest] Why do Qt collection classes not offer signals
> and slots?
> To: <qt-interest at trolltech.com>
> Message-ID:
> <7C1BB5B31B5E6F4B81ED35F230BEC43F07CC1E at sbserver.MMI.local>
> Content-Type: text/plain; charset="iso-8859-1"
> Hi folks,
> I was just wondering, I thought this was the most obvious thing to
> have... If Qt containers supported signals and slots, you could write
> e.g.:
> QVector<int> * myVector = new QVector<int>();
> connect(myVector, SIGNAL(elementAdded(int)), this, updateList());
> Is there a reason for the lack of signals in Qt's collection classes? Or
> am I missing something?
Hi Hendrick,
From a design point of view, it would make little sense to add this kind
of support to a container: the idea of these classes is to make them as
light-weight as possible.
That said, is there anything stopping you from writing your own class that
is multiply derived from QVector<int> and QObject, and adding your own
signals? I wouldn't want to use a class like this all the time, but for
the instances where signals are a good idea, it should be useful.
R.
--
"Without music to decorate it, time is just a bunch of boring production
deadlines or dates by which bills must be paid."
Frank Zappa
Ross Driedger
ross_at_earz.ca
More information about the Qt-interest-old
mailing list