[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Usage of QComboBox::insertItem() in Qt4
From: Andreas Pakulat <apaku () gmx ! de>
Date: 2006-04-19 16:28:03
Message-ID: 20060419162803.GA5704 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]
On 19.04.06 19:46:00, Dmitry Suzdalev wrote:
> I have some difficulties with true understanding of how Qt4's
> QComboBox::insertItem works, so I'm here with the Question :).
First I'd like to point you to the qt-interest list at trolltech.com,
this is probably better suited for general-qt-related problems. Also
some TT-folks tend to read that list and you might get help "from the
source".
> void QComboBox::insertItem ( int index, const QString & text, ... )
> Inserts the text and userData into the combobox at the given index.
>
> What I miss in docs is that it isn't explained how it'll behave if
> there is no 'given index' in the combobox.
> What happens if I call insertItem(10, "hi, QComboBox!") on empty
> QComboBox?
> Will it insert 9 empty items?
> Will it resize at all?
> Will it assert on me?
> Of course, I can test it by writing some code, but I'd rather read this
> info in docs :).
Then please report this to TT as a bug in the documenation. You are
right that this should be mentioned somewhere.
> And what's the right way to populate the combobox in a 'for' loop?
> In Qt3 that was done like this
>
> for(int i...)
> combo->insertItem("item");
>
> Qt3's QComboBox::insertItem had "-1" as default value of 'index' - it
> appended to bottom in this case.
> It was very convinient to use, what's the reasoning behind its removal?
> I miss a-simple-append-to-buttom kind of insertItem() :).
How about QComboBox::addItem ;-)
> So now I should do
> for(int i...)
> combo->insertItem(i, "item");
>
> Right?
No, do the addItem() or maybe even addItems() if you already have a list
of strings at hand.
> combo->insertItem( currentIndex(), "bla 3 times" );
>
> Right?
Again no: use addItem ;-)
Andreas
--
You will overcome the attacks of jealous associates.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic