PDA

View Full Version : Highlighting on Click and call a Function on Double Click for Q*BoxLayout



xerionn
8th January 2009, 07:11
Hello everyone,
I would like to implement something like what i am mentionning in the title of this thread !
I have a QFrame that contains an Image and a QLabel that contains some text...
These two are in a Vertical Layout. So here comes my question !

Can i make this vertical layout selectable for the user meaning on click to become highlighted (Like when you select a file in a file manager) ? Also how can i make it so that if the user double clicks on it to call for a funcation (i wanna show another widget actually)

If this is not possible with the way that i have it implemented my stuff i am more than happy to change it so i can achieve this functionality that i want. I have been reading the documentation for layout and qwidget but i could not find anything about select on click or double click etc so i need your help to point me to the correct direction.

Thank you in advance !

wysota
8th January 2009, 08:40
A layout is not a widget - it is not "visible", so you can't "paint" it. Maybe what you want is QListWidget?

xerionn
11th January 2009, 23:24
List Widget was indeed something that i have thought but i was wondering if it was possible to do something like what i said :)

Thank you for your answer though i appreciate it !
Now something more. Is there a way to make QList Widget have always lets say 2 lines of Text ? Cause if you have 1 and put no wrap of text its to small i think but with 2 and no wrap its all i need i think. So i was wondering if there is a way to do this.