What does the embedded widget consist of?
What does the embedded widget consist of?
The base is QFrame, on that frame there is 3-4 QLabels with CSS styling, thats all.![]()
Did the embedded widget changed its size ever when you resized the tree widget?
Yogesh M
http://sparklemedia.sourceforge.net/
When you set an index widget, the item background shines through. If the content is transparent (like labels and frames are), it will shine through unless you do one of two things:
1. Make sure the delegate doesn't paint anything while the index widget is set
2. Make the frame paint its background.
@yogeshm02 The QTreeWidget automatically resize my QFrame widget when I resize the QTreeWidget and sinse I use the QFrame resize event I can position the widget inside in correct but it seems that QTreeWidget isn't resizing the QFrame correct and the little smile of the item shows up.
@wysota
1. I don't use QItemDelegate, I use setItemWidget() function but if you meant other thing just tell me.
2. I use setAutofillBackground(true) to my QFrame widget if it's that whats you meant but no change...![]()
Of course you do. Each cell is painted using a delegate and the default delegate is QItemDelegate or QStyledItemDelegate since Qt 4.4.
Try changing the palette of the frame (especially the Window role) to see if the background of the frame gets painted.2. I use setAutofillBackground(true) to my QFrame widget if it's that whats you meant but no change...![]()
Yes. You can see that the frame doesn't span across the whole item. Could you show us the code for the widget you set as the index widget?
Remove the icon when you set the index widget.and how can I be sure that this QItemDelegate doesn't paint anything while there is widget on it.
Here's the code
Qt Code:
ContactWidget *pContactWidget = new ContactWidget(); pContactWidget->setAutoFillBackground(true); /* Setting some data to the QLabels inside the pContactWidget */ pContactView->setItemWidget(selectedItem, 0, pContactWidget);To copy to clipboard, switch view to plain text mode
ContactWidget - my class that inherits QFrame
pContactView - this is the QTreeWidget
Sure removing of the icon from the item before setting the widget fix the problem but this was the thing I want to avoid because when the user click on other contact from the list I must set the icon of the item again and sinse my code is not very well constructed this is ugly task to be done but if there is no other way I will remove that icon before setting the widget.![]()
Do you have a hierarchy of items or is your data model flat? Did you modify any properties in ContactWidget? What does the constructor look like?
I don't use model, I'm directly creating new items, I do nothing in to my class that inherits QFrame, thats are future plans but I will show.
Qt Code:
{ Q_OBJECT public: ~ContactWidget() {}; };To copy to clipboard, switch view to plain text mode
It's flat structure, there is no childs.![]()
Bookmarks