[Qt-interest] How best to display arrows in a list?

Justin Noel justin at ics.com
Thu Mar 12 14:58:43 CET 2009


phil prentice wrote:
> HI friends
>   I'm a very stuck as to how go about using QT to display arrows as part of a 
> list.  I have attached a screen shot (.jpg) 
> which displays an old X11 GUI which I would very much like to move over to 
> QT.  What it displays is a list of arrows on the left and a list of arrows at 
> the bottom.  Does QT offer anything that might make its porting to QT 
> easier..I was hoping to use something like QListWidget to help me but I dont 
> think that it is capable?  I am really stuck here as to how I might proceed.  
> Can anybody help me?
>
> I would much appreciate any response even if its to say its back to basics 
> i.e. I cant use classes like QListWidget to help me out.
>   

I'll give you a couple of things you can try, but I think you need to
study up on Qt. Here are a few weblinks that can help you out:

ICS Webinars (Especially "Introduction to Qt"):
http://www.ics.com/learning/icsnetwork/

Qt Tutorials:
http://doc.trolltech.com/4.5/tutorials.html
http://sector.ynet.sk/qt4-tutorial/

ICS Whitepaper on porting Motif to Qt:
http://www.ics.com/learning/learning_center_downloads/

Popular book on Qt:
http://www.amazon.com/Programming-Prentice-Source-Software-Development/dp/0132354160/ref=sr_1_1?ie=UTF8&s=books&qid=1236865403&sr=8-1

You might also consider going to a training class hosted by ICS or KDAB.
For disclaimer purposes, I work for ICS. ;)

As for your problem. I suggest the following to recreate your screen:

Use a QScrollArea, a QVBoxLayout and regular widgets like push buttons
and labels.  If you require it to look more "list" like with selections
and such you could subclass QPushButton or QAbstractButton and re-impl
paintEvent() to draw your arrow pixmap, text and a selected background
color if your state happens to be "checked". You can then use a
QButtonGroup to make the buttons mutually exclusive.

If you need to scale the area to have lots of buttons or you need to
insert/remove buttons dynamically then, you might want to use
QList[View|Widget] with a custom delegate to do the fancy drawing. Check
out the Qt example under examples/itemviews/pixelator or ICS's
whitepaper on Qt Delegates.  It's a lot of work, but very scalable.

Good Luck!
--Justin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: justin.vcf
Type: text/x-vcard
Size: 233 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090312/487e8ce2/attachment.vcf 


More information about the Qt-interest-old mailing list