View Full Version : Layout drives me up the wall!

9th September 2012, 12:45
Hi all,

I have two desktop apps, second app I created by copying first app into new folder and doing some changes in code. A few days ago I played with layout on one of the QStackedWidget pages in forms (created in designer) in app number 2. Now when I display certain page in app 2 application increase in height so much i goes beyond a scope of the screen (its getting higher than screen height) and refuses to shrink. I copied form (mainwindow.ui) from app number 1, but when I clear project and compile it result is the same.
What is strange, when I clear and compile app number 1 - there is no problem with layout, app is not getting higher than a screen, and I can even shrink it to 2/3 of the screen height.
App number 2 (that is using now form mainwindow.ui from app 1) after I clear and compile gets higher than screen always when I display certain page.

So I thought that there should be no difference between this two apps because I'm using the same form file.
Question is what is wrong? Where are the sizes of the mainwindow written? Or how can I debug this problem, what may cause my second application to increase in height.
I'm developing on Linux with Qt 4.8.1.

best regards

9th September 2012, 15:21
Between Clear and Rebuild All did you Run qmake too?

9th September 2012, 22:02

Just to be sure, I tested this now, both projects use the same mainwindow.ui file, on both of them I did: clear, run qmake, rebuild project.
Project number 1 has proper resizable window, second project resize itself beyond the scope of the screen as soon as I switch QStackedWindget to certain page.
Don't know whats going on ????


9th September 2012, 23:18
If the UI files are the same then the problem is not in the UI file. You say you copied the:

first app into new folder and doing some changes in code
My prediction is that the problem is in here. We cannot see your code or read your mind, so we cannot really help.

10th September 2012, 09:11
Sure You are right, I didn't provide the code because app is working with server and during start up its reading data from server, so I will have to prepare stand alone version to illustrate my problem if I don't find something in my code. I just wanted the confirmation that dimensions of main window or other stuff related to size are hidden inside UI files, and not in some other magic files, system wide preferences, or else...


10th September 2012, 13:53
I've found the problem. The problem was layout on different page. My app consist of a few pages with QStackedWidget. Let's say I thought I have problem with page number 6, because as soon as I switched to this page app stretched itself beyond the screen. Until I stayed on pages 1,2,3,4 - everything was fine. On page number 5 there were presented data obtained from server during initialization (app number 1 was getting 2 items from server, app number 2 was getting 20 items from server - and it was to much for a single page to display, so it was stretched). However, page number 5 was never displayed because I did not make a button to switch QStackedWidget to this page. What is also strange only switching to page 6 triggered the resize of the page 5, until I stayed on pages 1,2,3,4 - there was no problem. I was trying to debug this by settings traps, but all I could see was execution of the main event loop in line " return app.exec();" in main.cpp when application was stretched. Looks like when I display certain page of the QStackedWidget all pages created before this page are triggered to update their size. I can't see any other explanation.