×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    27

    Qt Designer and scroll area

    I am attempting to use Qt Designer exclusively for the user interface. Everything works as expected in portrait mode (except for scrolling) but I have been unable to properly implement landscape mode. Testing is on an N8 which automatically switches as the phone is rotated. When rotating to landscape, the bottom of the screen is lost because the scroll bar was not implemented properly. Assistance will be appreciated! Thanks.
    The automatically generated code is:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }
    and the ui file is:

    <?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
    <class>MainWindow</class>
    <widget class="QMainWindow" name="MainWindow">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>360</width>
    <height>640</height>
    </rect>
    </property>
    <property name="windowTitle">
    <string>MainWindow</string>
    </property>
    <widget class="QWidget" name="centralWidget">
    <widget class="QWidget" name="gridLayoutWidget">
    <property name="geometry">
    <rect>
    <x>10</x>
    <y>10</y>
    <width>341</width>
    <height>621</height>
    </rect>
    </property>
    <layout class="QGridLayout" name="gridLayout"/>
    </widget>
    <widget class="QScrollArea" name="scrollArea">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>361</width>
    <height>641</height>
    </rect>
    </property>
    <property name="widgetResizable">
    <bool>true</bool>
    </property>
    <widget class="QWidget" name="scrollAreaWidgetContents">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>359</width>
    <height>639</height>
    </rect>
    </property>
    <widget class="QPushButton" name="pushButton">
    <property name="geometry">
    <rect>
    <x>70</x>
    <y>20</y>
    <width>201</width>
    <height>111</height>
    </rect>
    </property>
    <property name="text">
    <string>PushButton</string>
    </property>
    </widget>
    etc

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Qt Designer and scroll area

    Code:
    <width>360</width>
    <height>640</height>
    I've found that both dimensions of the main window need to be (initially) no larger than the screen dimensions to display properly when maximized. I haven't tried your specific senario (everything is locked to landscape on the stuff I've worked with), but I suspect if you made height=360 then things would work fine in both directions.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    58

    Re: Qt Designer and scroll area

    This doesn't seem to completely answer the question, particularly the scrolling issue. I'm running into the exact same problem. I'm using Qt Designer (actually the designer screen in Creator) and scrolling isn't enabled/working/activated. I'm specifically talking about vertical scrolling when the window contents exceed the height of the screen, regardless of device orientation. If scrolling has to be explicitly specified, how do you do it?
    Last edited by pgarofalo; 2011-01-15 at 22:45.

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Qt Designer and scroll area

    Scrolling should default to "auto", but you can explicitly set it using the interface you'll easily find if you look at the documentation.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    58

    Re: Qt Designer and scroll area

    I wasn't using a scroll area. Not that easy to find in the doc. Once I discovered it (it's also deep in the XML code in the first post) that solved my problem.

Similar Threads

  1. How to make a scroll area work?
    By nuthon in forum Qt
    Replies: 1
    Last Post: 2010-10-06, 08:20
  2. Qt Designer / Qt Creator : Adding custom layout
    By daudrain in forum [Archived] Qt SDKs and Tools
    Replies: 0
    Last Post: 2010-09-29, 11:28
  3. QT Designer and USB
    By de.Alphawolf in forum Qt
    Replies: 3
    Last Post: 2010-09-08, 23:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×