okay, so I figured it out... With the help of another QT programmer.
You can't mess with the type (I am not too sure as to why but that is why it isn't working.)
here is the solution we found:
// make the ListWidgetItems, and assign them to the list_widget
// add a QVariant to the LIstWidgetItem
add1.
setData(Qt
::UserRole,
QVariant(1));
add2.
setData(Qt
::UserRole,
QVariant(2));
add3.
setData(Qt
::UserRole,
QVariant(3));
add4.
setData(Qt
::UserRole,
QVariant(4));
// to get that number back out
list_widget->item(selected_list_widget)->data(Qt::UserRole).toInt());
// make the ListWidgetItems, and assign them to the list_widget
QListWidgetItem add1("item 1", list_widget);
QListWidgetItem add2("item 2", list_widget);
QListWidgetItem add3("item 3", list_widget);
QListWidgetItem add4("item 4", list_widget);
// add a QVariant to the LIstWidgetItem
add1.setData(Qt::UserRole, QVariant(1));
add2.setData(Qt::UserRole, QVariant(2));
add3.setData(Qt::UserRole, QVariant(3));
add4.setData(Qt::UserRole, QVariant(4));
// to get that number back out
list_widget->item(selected_list_widget)->data(Qt::UserRole).toInt());
To copy to clipboard, switch view to plain text mode
Long live the QT
Bookmarks