PDA

View Full Version : How to change the app resolution



roseicollis
20th January 2015, 11:22
Hi!

I'm making a new GUI app and I want it to show up with a especific resolution, so when in main.cpp I say w.show() it runs in 550x300. I've tried w.resize() but it just shows a little part of the screen instead of change its resolution so if I put an element like this:


QRect rec = QApplication::desktop()->screenGeometry();
int h= rec.height()/8;
int w= rec.width();

button->setMinimumSize(w,h); //this button will fit inside the screen with full width
button->setMaximumSize(w,h);

with the resize I just see a part of the button and I should see it complety.

Thanks.

anda_skoa
20th January 2015, 11:36
So what is your question?

How is setting a fixes size on a button related to resizing any window?

Cheers,
_

roseicollis
20th January 2015, 11:39
No,

My question is:

if my ui size its 300,300 and I put w.show() it will show up as 300 300. If I put a w.showFullScreen() it will be 1920x1080 which is my actual computer screen. What I want is to set that screen at 550x300 when showing it and I know that w.resize isn't the answer.

anda_skoa
20th January 2015, 11:50
Hmm, resize should work. When you resize(550, 300) how large does the window appear?

Cheers,
_

roseicollis
20th January 2015, 11:54
[edited]

w.show()
result: 300x300 which is the ui size


w.resize(550,300);
w.show();
result: 550 300 with just a little part shown of the buttons and things inside

BUT when I change to the next page (its a wizard structure with wizardpages) then the next page became full screen on the width ... dunno if its because the buttons inside are like I said in the first post.

anda_skoa
20th January 2015, 14:14
[edited]

w.show()
result: 300x300 which is the ui size


w.resize(550,300);
w.show();
result: 550 300 with just a little part shown of the buttons and things inside

So, do I understand this correctly: then it shows by itself in 300x300 all "things inside" fit, but when you make it larger it no longer does?

Cheers,
_

stampede
20th January 2015, 14:31
result: 550 300 with just a little part shown of the buttons and things inside
Does the widget have a layout ?

roseicollis
20th January 2015, 14:35
Nop XD Sorry for my bad explanation. If I resize its like if I had the fullscreen with all the elements in their right place and size and I cut a square of 550, 330 more or less so I just see a part of a label, and a part of a button. And when I change to the next page, the app becames 1920x300 (the same high but the computer screen max width).

yes stampede

wysota
20th January 2015, 16:10
Show us your widget layout definition, please. And maybe show us a screenshot of what the problem is about.

roseicollis
23rd January 2015, 11:03
Hi, I just found a way to do it:

I jsut fix it with setFixedSize(), and then change the sizes.

thank you for all :)

wysota
23rd January 2015, 11:11
Hi, I just found a way to do it:

I jsut fix it with setFixedSize(), and then change the sizes.

thank you for all :)

I don't know what this is supposed to accomplish but it's probably a very bad approach. I'm still suspecting you don't have a proper layout setup.