Results 1 to 4 of 4

Thread: problem with QStackedwidget

  1. #1
    Join Date
    Apr 2010
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default problem with QStackedwidget

    My problem is the following:
    suppose that I set two windows; I'd like to switch from one to each other using a Pushbutton.
    First, I set QStackedWidget with the default two pages: in every page I set my switch button.
    My final application must be 800x480 because I use it on a 7" touchscreen LCD.
    First windows opened when my application starts, has no problem; when I pressed the button, the second window appeared horizontally truncated after 640 pixel.
    I close my application and start it again using my second window as first visible window: this appears correct and when I press the button to switch to the other one, this last appears horizontally truncated exactly after 640 pixel (same as previously observed on the other window).
    It seems starting window is OK, meanwhile the second one selected pressing the button is wrong.
    I tried to set size policy to expand: nothing to do!
    I tried to set size policy to maximum: nothing to do!!
    At the end my first appearance is correctly 800x480, meanwhile when I switch to the following stacked window the new appearance is 640x480.
    Last annotation: coming back to the first starting window dimension is still 800x480.
    So I'm losting in the deeper Qt ocean!!! SaveMySoul!!
    What can I should do?
    Paolo
    Qt 4.6.2 on Ubuntu Karmic Koala

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: problem with QStackedwidget

    What can I should do?
    First of all, show us your code so we can see what have you already tried.

  3. #3
    Join Date
    Apr 2010
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: problem with QStackedwidget

    I developed my application using Qt Creator 1.3.1. I could include some files. In my opinion problem could be located in ui file, so I could show ui_myfile.h or myfile.ui.
    Wait for your question
    Paolo

  4. #4
    Join Date
    Apr 2010
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: problem with QStackedwidget

    Solved! I set SetGeometry() property inside my code. See the code:
    void MiaQStackedWidget:n_pushButton_pressed()
    {
    ui->page_1->hide();
    ui->page_2->setGeometry(0,0,800,480);
    ui->page_2->show();
    }
    I tought Geometry was already set inside QtCreator, but it wasn't so. I tried and all my pages now are correctly sized as I like.
    I don't know if it's the best method, there're further ways to obtain same result, but I see It works and I'm ok.
    Paolo

Similar Threads

  1. QStackedLayout / QStackedWidget
    By morraine in forum Newbie
    Replies: 15
    Last Post: 12th July 2013, 09:16
  2. Help with QStackedWidget
    By onírico in forum Newbie
    Replies: 6
    Last Post: 12th November 2009, 16:34
  3. QStackedWidget layout problem
    By Banjo in forum Qt Programming
    Replies: 9
    Last Post: 15th May 2008, 00:15
  4. QStackedWidget question
    By hgedek in forum Qt Programming
    Replies: 3
    Last Post: 20th August 2007, 16:36
  5. QStackedWidget fill Postscript image And scroll problem
    By patrik08 in forum Qt Programming
    Replies: 11
    Last Post: 22nd April 2007, 09:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.