QComboBox::addItem(QStringList foo); geht nicht?!



  • ich bekomme wegen der box immer ein:

    class foo : public QWidget
    {
    private:
    	QStringList str_list;
    public:
    	foo(QWidget *parent = 0, QStringList lst = 0);
    };
    
    foo::foo(QWidget *parent, QStringList units) : QWidget(parent), str_list(lst)
    {
    	QComboBox *box = new QComboBox(this);
    	box->addItem(str_list);
    }
    
    error: no matching function for call to ‘QComboBox::addItem(QStringList&)’
    

    allerdings steht doch im qt-assi:

    void QComboBox::addItems ( const QStringList & texts )
    Adds each of the strings in the given texts to the combobox. Each item is appended to the list of existing items in turn.

    und warum darf ich der liste



  • In so einer Liste sind meistens mehrere Items und nicht nur ein Item.



  • mmh, ich seh grad hatte den textfetzen vergessen. egal!
    erst mal zur stringlist...

    Ponto schrieb:

    In so einer Liste sind meistens mehrere Items und nicht nur ein Item.

    sorry ich verstehe dich nicht...

    QStringList foo;
    	foo<<"hallo"<<"salut"<<"hi";
    	combobox->addItem(foo);
    

    ich verstehe nicht ganz was ich falsch mache 😞 in der assistent-beschreibung war das doch auch so erwähnt. 🙄



  • Vergleiche nochmal ganz genau:

    addItem
    addItems



  • mmh, sowas passiert mir dauernd 😞 , sry


Anmelden zum Antworten