|
|||||||
| Qt Programming General Qt programming issues. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Related to: Qt4
Hello
I have a QStackedWidget with four pages all of which have layouts. I have created this using Designer. What I am finding though is that when the application is run, the stacked widget takes on the dimensions of whatever page was current when the ui file was created. Ideally I would like all the pages to be the same size. They look the same size in designer, just not when the application is run. Any help with this?? |
|
#2
|
|||
|
|||
|
Hello
Is anyone able to help me - I seem to remember a post on this problem before but have been unable to find it. Thanks |
|
#3
|
|||
|
|||
|
What you describe is not a natural behaviour - the stacked widget should have the size of the largest of its widgets and all the other widgets should adjust to it. If you observe a different behaviour, it might mean you forgot to apply a layout somewhere (for instance in the parent of the stacked widget).
|
|
#4
|
|||
|
|||
|
Hello
Thanks for that. I have looked for missing layouts but can't see any. I've attached a copy of the ui file and would appreciate it if you would have a look. I am using Designer to contruct the basic interface. Thanks |
|
#5
|
|||
|
|||
|
I don't see the effect you experience. For me the stacked widget remains the same regardless of which page is currently being displayed.
|
|
#6
|
|||
|
|||
|
Thanks for looking at it - must be a problem with my Python code.
Given that I am stumped on this, can you give me any general pointers as to how to find the offending bit. I do not specify/delete layouts in my Python code. I am adding dock widgets top, right and bottom. Thanks again |
|
#7
|
|||
|
|||
|
I have explored a little further and found the following:
1) The pages all size correctly in Designer 2) I have cut my Python code right down and the same problem still occurs when the application is run - ie the only page that shows correctly is the page that was current when saving the ui file (and then using pyuic4 to create the python file). Here is my cut down code. class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self, parent=None): super(MainWindow,self).__init__(parent) self.setupUi(self) self.pgSurvey.show() # non current page in stacked widget def main(): app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_()) main() so I am assuming that the ui file is correct as Wysota says. Any suggestions as I am stumped on this. Thanks |
|
#8
|
|||
|
|||
|
Hello again
I found my problem - I was not setting currentIndex of the stackwidget for each page. Works a treat now ! |
|
#9
|
|||
|
|||
|
"self.pgSurvey.show()" - this is wrong. Let the stacked widget control the visibility of its widgets.
|
| The following user says thank you to wysota for this useful post: | ||
Banjo (15th May 2008) | ||
|
#10
|
|||
|
|||
|
Yes thanks Wysota - I discovered that after rereading the documentation!!
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Layout Problem | sabonis | Qt Designer | 4 | 3rd March 2008 20:57 |
| problem with Tool button n Layout | arjunasd | Qt Designer | 11 | 24th July 2007 21:14 |
| QStackedWidget fill Postscript image And scroll problem | patrik08 | Qt Programming | 11 | 22nd April 2007 09:30 |
| Grid Layout Problem | Seema Rao | Qt Programming | 2 | 4th May 2006 12:45 |
| Layout Problem | Seema Rao | Qt Programming | 4 | 19th April 2006 11:08 |