I can not figure out why. My main window is:

public class Main extends QMainWindow {
}

I use Eclipse, add a horizontal layout, then add a scroll area to it. Here is 
the generated UI code:
---
    public void setupUi(QMainWindow Main)
    {
        Main.setObjectName("Main");
        Main.resize(new QSize(571, 222).expandedTo(Main.minimumSizeHint()));
        QSizePolicy sizePolicy = new 
QSizePolicy(com.trolltech.qt.gui.QSizePolicy.Policy.Expanding, 
com.trolltech.qt.gui.QSizePolicy.Policy.Expanding);
        sizePolicy.setHorizontalStretch((byte)0);
        sizePolicy.setVerticalStretch((byte)0);
        sizePolicy.setHeightForWidth(Main.sizePolicy().hasHeightForWidth());
        Main.setSizePolicy(sizePolicy);
        centralwidget = new QWidget(Main);
        centralwidget.setObjectName("centralwidget");
        horizontalLayoutWidget = new QWidget(centralwidget);
        horizontalLayoutWidget.setObjectName("horizontalLayoutWidget");
        horizontalLayoutWidget.setGeometry(new QRect(0, 20, 571, 161));
        horizontalLayout = new QHBoxLayout(horizontalLayoutWidget);
        horizontalLayout.setObjectName("horizontalLayout");
        scrollArea = new QScrollArea(horizontalLayoutWidget);
        scrollArea.setObjectName("scrollArea");
        scrollArea.setWidgetResizable(true);
        scrollAreaWidgetContents = new QWidget();
        scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents");
        scrollAreaWidgetContents.setGeometry(new QRect(0, 0, 567, 157));
        scrollArea.setWidget(scrollAreaWidgetContents);

        horizontalLayout.addWidget(scrollArea);

        Main.setCentralWidget(centralwidget);
        menubar = new QMenuBar(Main);
        menubar.setObjectName("menubar");
        menubar.setGeometry(new QRect(0, 0, 571, 21));
        Main.setMenuBar(menubar);
        statusbar = new QStatusBar(Main);
        statusbar.setObjectName("statusbar");
        Main.setStatusBar(statusbar);
        retranslateUi(Main);

        Main.connectSlotsByName();
    } // setupUi
----

I do now what property I need to set so that the scroll area can follow the 
main 
window.
 thanks,
canal




________________________________
From: Samu Voutilainen <[email protected]>
To: [email protected]
Sent: Sat, August 21, 2010 5:43:09 PM
Subject: Re: [Qt-jambi-interest] how to define widget resizable

go canal kirjoitti lauantai 21 elokuu 2010 10:25:02:
> Hello,
> I am using Eclipse. Would like to know how to define a scrollable area such 
>that 
>
> when the main window is resized, the area is also resized. 
> 
> I tried to set the horizontal policy to Expand, or Maximize, but no effect.
>  thanks,
> canal
> 
> 
> 
>      

I can’t currently provide an example, but doesn’t just creating a layout, 
inserting the area inside it and then inserting it to the widget. And widget 
will take care of resizing it. This works unless you have other calls that 
restricts size of the area, but...
-- 
Terveisin,
Samu Voutilainen
http://smar.fi

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest



      
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to