Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, February 2007
Delegate size issue.


Message 1 in thread

Hey guys,

I'm using a delegate for my own QListView,

I've reimplemented the paint and the sizeHint function
I'm trying to display two types of cell depending on the "option.state".

- If the list item is clicked it has to be big.
- If the list item is not clicked it's smaller.

But for some reason I can't call the sizeHint function dynamicaly (each time
I click on an item)
or resize anything in the paint delegate function.

Any idea?

Thanks,
Ben.


--
 [ signature omitted ] 

Message 2 in thread

bunjeee wrote:
> - If the list item is clicked it has to be big.
> - If the list item is not clicked it's smaller.
I did this too. It's a bit of a hack. Here's what you have to do:

Connect whatever appropriate signal for item selection to a slot that 
does this to your tree view:

       treeView->setRootIndex(QModelIndex());

This will cause sizeHint() to be called on the selected QItemDelegate 
(and all others too). The result is that the tree repaints and your item 
delegate can resize its cell if it's selected.

You can accomplish the same thing by calling reset() also.

--Dave

--
 [ signature omitted ] 

Message 3 in thread

bunjeee schrieb:
> But for some reason I can't call the sizeHint function dynamicaly (each 
> time
> I click on an item)
> or resize anything in the paint delegate function.
> 
> Any idea?

Just a wild guess: Try emitting dataChanged() for your cell, and care 
for uniformItemSizes = false.

Martin

-- 
 [ signature omitted ] 

Message 4 in thread

Hello,

such a question:

I have code that is based on "QX11EmbedContainer" is there a  
replacement for it on a mac ?


---------------------
thanks,
Yong.

--
 [ signature omitted ]