Hi,
i have QListWidget and QStackedWidget.
I want when select some item from the list to change the widget loaded in Stacked Widget.
Probably i should use currentIndex() signal in order to trigger the change.
Any ideas?
Hi,
i have QListWidget and QStackedWidget.
I want when select some item from the list to change the widget loaded in Stacked Widget.
Probably i should use currentIndex() signal in order to trigger the change.
Any ideas?
QListWidget has signals that give you both the new selected QListWidgetItem and the new selected text so you can use one of those (depending on your needs).
Thank you.
Is there any error in this, because it still doesn't work:
Qt Code:
connect(ui->listWidget_settings, SIGNAL(currentTextChanged ( const QString & currentText )),this, SLOT(changeWidget()));To copy to clipboard, switch view to plain text mode
The connect statement is incorrect: you don't put signal/slot parameter name in the connect statement (so just const QString& remove currentText) and a second stuff is that most likely you would like the changeWidget() to take that string that changed in the QLisWidget and create/modify the widget accordingly with that QString: so you can create void changeWidget(const QString& changedText) (if you didn't put it now, don't forget to add public slots: access specifier) and use the text (changed from the QListWidget) into definition to create/update the widget so the connect will become:
Qt Code:
connect(ui->listWidget_settings, SIGNAL(currentTextChanged ( const QString& )),this, SLOT(changeWidget(const QString&))); //at connect you write just the type of parametersTo copy to clipboard, switch view to plain text mode
Thank you!
Problem solved
Bookmarks