Hi,
Right now i have a QListWidget with a few QListWidgetItem in it,
and i would like to connect the ItemClicked function to get the string or the row number of the clicked row.
Thank you for any help
Shiran
Hi,
Right now i have a QListWidget with a few QListWidgetItem in it,
and i would like to connect the ItemClicked function to get the string or the row number of the clicked row.
Thank you for any help
Shiran
so, what's the problem? use QListWidget::itemClicked signal and then process pointer to QListWidgetItem which has QListWidgetItem::text. for row determination use QListWidget::row.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
as an addendum to the private mail:
You also can use QListWidget::selectedItems() to determinate the selected items at any time without using the itemClicked signal.
The problem is that i cant build the connect command
My QListWidget called List
Can anyone help me with the connect command,
I just want to get the string or int of the clicked line by the user
Thanks,
shiran
What did you try till now ?The problem is that i cant build the connect command
Qt Code:
//h ... class QListWidget; class QListWidgetItem; { Q_OBJECT public: private slots: private: QListWidget *m_myListWidget; }; ... //cpp { ... connect(myListWidget, SIGNAL(itemClicked(QListWidgetItem *)), SLOT(itemClicked (QListWidgetItem *))); ... } ... { if (!item) return; qDebug() << "row [" << m_myListWidget->row(item) << "] == " << item->text(); }To copy to clipboard, switch view to plain text mode
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Ok GREAT
Thanks i will try it
Bookmarks