PDA

View Full Version : Which is the best way to make a fluid user interface in QT?



Kevin Hoang
9th March 2010, 05:47
I make a program with many buttons on it, I created a main widget, on this widget I created 3 widgets to split them to 3 parts: Header, Footer, and Body; I’m using Horizontal Layouts on each widget to align to center and auto correct size of the buttons. Each button I use an image instead default QT button.

When the form resizing, I use a function to resize image of each button and the result feel good to this point. But, I can’t resize the buttons bigger than original image size, such as: My original image size is 20 by 20 px, I can’t resize the button bigger than 20 by 20 px.

Help me resolve this problem. Thanks!

high_flyer
9th March 2010, 08:45
But, I can’t resize the buttons bigger than original image size, such as: My original image size is 20 by 20 px, I can’t resize the button bigger than 20 by 20 px.
Why not?
How are you resizing?
QPixmap::scaled() should do that.
It probably wont look good, but you certainly can resize the image beyond its original size.
Why not use images with the maximal size that you will need, this way it will also look good.

Cruz
9th March 2010, 08:45
Can you make do without those images somehow? You can design really good looking buttons using style sheets and they will continue to behave nicely in layouts.

Kevin Hoang
9th March 2010, 09:56
Why not?
How are you resizing?
QPixmap::scaled() should do that.
It probably wont look good, but you certainly can resize the image beyond its original size.
Why not use images with the maximal size that you will need, this way it will also look good.


The problem is my buttons added to a layout (I set image as button icon), I don’t need to write any functions to resize them, they will auto resize with layout.

My program has to run well on different biggest monitor as full screen. So I don’t know which maximum size for it.

Can you give me any idea to make fluid UI on QT for this case?


Can you make do without those images somehow? You can design really good looking buttons using style sheets and they will continue to behave nicely in layouts.

Yeah. I have CSS experiments, but depend on graphic design, I can’t do like you said.

high_flyer
9th March 2010, 11:15
My program has to run well on different biggest monitor as full screen. So I don’t know which maximum size for it.
Ok, but there is some maximal size that you can be sure that the application wont exceed.
Use images in that maximal size, and it will also solve your problem with resizing.

Kevin Hoang
9th March 2010, 12:37
Thank you very much! For now, that is good way I can do.