[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt]  Determine size of a button
From:       Joe M <j.moudrik () gmail ! com>
Date:       2011-10-14 9:39:49
Message-ID: 32648218.post () talk ! nabble ! com
[Download RAW message or body]


Hello,

I am writing an application (a songbook). In one of the parts, I have a
custom widget, that displays some information in lines. One line looks like
this 

QLabel (with fixed size) QPushButton QPushButton ....
an instance looks like
Genre: Rock Folk Metal
(genre = label, Rock = first button, ..)
I'd like to find appropriate songs when user clicks e.g. Rock)

This panel is embedded in a widget whose size determined by user (by
splitter). Because sometimes, there are a lot of genres for a song, the
panel gets too big and it results in resize that changes the user-defined
size. I've come up with a solution: if there are more than 3 buttons
(genres) I merge the rest into a button with pop-up menu. This looks nice,
but I'd like to base the merging on size of the genre buttons rather that on
their number. (because sometimes the number is large, but the genres
themself are short)

I've come up with another solution, which I do not like at all: Create the
buttons, catch the parent's resize event (if any) and merge the buttons
afterwards.

The question is: is there a way in which I can tell how big the buttons will
be without having to create them in the first place? Or any other hints?

Thanks!
-- 
View this message in context: http://old.nabble.com/Determine-size-of-a-button-tp32648218p32648218.html
Sent from the PyQt mailing list archive at Nabble.com.

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic