Re: QListWidget Custom item is not there
I've created a QListWidget, And I also Created a TaskItem.
In Main Window I have a layout. When i add TaskItem to the layout - I can see it. When i Add QListWidget to the layout I can see it. But when i try to add TaskItem to the QListWidget and then show that QListWidget, The TaskItem is not displayed. here is the relevant code:
Code:
item = new TaskItem;
list->insertItem(0, "asdsa");
list->setItemWidget(list->item(0), item);
layout->addWidget(list);
If i compile this code, I see the ListWidget with one item "asdsa" inside, when i should see TaskItem...
Added after 27 minutes:
Hm... I'm an idiot :)
I had to set TaskItem's widget size bigger...
Now I have another question:
I created a QScrollArea, in which I placed the QListWidget.
Everything works, but i want the scrollbar to move smooth (right now it jumps from first item to the second if i move the scrollbar)...
Now I found out that the problem is not in QScrollArea, but in the QListWidget itself (i can use QListWidget Without QScrollArea, but it still does not move smooth, but in jumps...
Solved this one also.
Had to use
Now is the biggest Question: How do i catch a signal, that the button of one TaskItem in the QListWidget has been pressed?
Re: QListWidget Custom item is not there
Your widget has to emit this signal by itself. It is not tied to the QListWidget in any way other than that it occupies space meant for a list item.
Re: QListWidget Custom item is not there
Ok, but how do u catch the signal from anyone of those TaskItems?