[Qt-interest] QTree* with custom widgets

Bernhard Friedreich friesoft at gmail.com
Wed Mar 18 20:10:52 CET 2009


André Somers schrieb:
> Hi,
>
> "Bernhard Friedreich" <friesoft at gmail.com> schreef in bericht 
> news:49BFB69F.80608 at googlemail.com...
>   
>> Andre Somers schrieb:
>>     
>
>   
>>> What I do if I want to use custom widgets in a view is that I use a
>>> small piece of KDE technology that was introduced as Goya.
>>>       
>
>   
>> Did that.. altough it didn't work out as expected. I've "ported the
>> class to pure Qt", subclassed it and tried to use it.. although the tree
>> looks totally f****** up because the widgets sit anywhere/nowhere, text
>> appears and disapperas as it likes to.. not comparable to a standard
>> table with setIndexWidget/setItemWidget from look and feel (you can also
>> feel that when using Goya in the Kwin Settings Dialog.. the buttons
>> somehow don't feel like real ones).
>>     
> Hmmm... This feels like you did not subclass properly and implemented the 
> memberfunctions correctly. Could you post some code that goes wrong, or even 
> better, a minimal example? I am using it myself without problems, but I must 
> admit that my widgets are simpler than yours.
>   
Maybe.. this whole widget painting thingy is really new to me :-( .... 
but doesn't matter anymore.. found another "solution" -- see below
>   
>> Also my requirements are much higher than anything Goya could satisfy ..
>> as far as I remember the limitations, back then when Goya was initially
>> designed.
>>     
> Of course there are limitations, but I am not sure that's what you are 
> hitting... Then again: I did not design Goya, I just happen to use it at 
> some places, especially if I need clickable links in my list items. Just 
> inserting a QLabel with some HTML through Goya works perfectly for that.
>
>   
As far as I remember each widget had to be implemented/customized to be 
ready to use with Goya.. That's just too much work for my usecase.
I've now switched over to a much simler approach with nearly the same 
effect:

QScrollArea + Buttons on the left for showing/hiding the widgets, on the 
right the widgets -- perfect for my usecase ^^ -- with the right icons 
and styles it will just fit :-)

Still: THANKS for your help :-)
>> In the attachement you can find a picture of how the QWidget in the tree
>> should look like (picture was made with a QTreeView and setIndexWidget
>> after expanding the tree again (after adding the second row) it was
>> perfectly fine.
>>
>> Would still appreciate any other comments about how to solve this issues 
>> :-)
>>     
> It does seem like you only need this fancy widget if you are actually 
> editing your booking, right? Would it be an option to create a custom 
> delegate that can draw the data in a non-editable way, and only replace it 
> with an editable, widget-based version if you actually want to modify the 
> contents? In that case, you could use the standard Qt methods I would think. 
> That would perhaps simplify your problems.
>
> André
>
>  
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090318/47a0e304/attachment.html 


More information about the Qt-interest-old mailing list