go canal kirjoitti lauantai 21 elokuu 2010 17:23:15:
> really appreciate if you could tell me which button I can use to anchor the 
> layout/widget. I have installed Qt Designer but could not figure out which 
> one.
>  thanks,
> canal
> 
> 
> 
> 
> ________________________________
> From: Samu Voutilainen <[email protected]>
> To: [email protected]
> Sent: Sat, August 21, 2010 7:15:16 PM
> Subject: Re: [Qt-jambi-interest] how to define widget resizable
> 
> Sorry, I don’t really know the eclipse integration. If it works like the 
> designer works, there’s buttons you can use to align the widgets horizontally 
> and vertically. You can use those to have them to binded to window.
> 
> go canal kirjoitti lauantai 21 elokuu 2010 13:46:15:
> > I only use the GUI Designer plugin for Eclipse, did not modify anything, 
> > but 
> > still the same, here is the very original full source code generated by the 
> > designer - still the same.
> > 
> > This is what I did:
> > - create a new Qt project
> >    File -> New -> Others -> Qt Jambi -> Qt Jambi Project (Using Designer 
> > Form)
> > - Drag and drop the Horizontal Layout to the main window, resize it to fill 
> > the 
> >
> > whole area
> > - Drag and drop the ScrollArea to the layout, change to 'always show scroll 
> >bar'
> > - Save and Run
> > 
> > 
> > public class Ui_Main implements com.trolltech.qt.QUiForm<QMainWindow>
> > {
> >     public QWidget centralwidget;
> >     public QWidget horizontalLayoutWidget;
> >     public QHBoxLayout horizontalLayout;
> >     public QScrollArea scrollArea;
> >     public QWidget scrollAreaWidgetContents;
> >     public QMenuBar menubar;
> >     public QStatusBar statusbar;
> > 
> >     public Ui_Main() { super(); }
> > 
> >     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
> > 
> >     void retranslateUi(QMainWindow Main)
> >     {
> >        
> >  
> > Main.setWindowTitle(com.trolltech.qt.core.QCoreApplication.translate("Main",
> >  
> > "MainWindow", null));
> >     } // retranslateUi
> > 
> > }
> > 
> > thanks,
> > canal
> > 
> > 
> > 
> > 
> > ________________________________
> > From: Samu Voutilainen <[email protected]>
> > To: [email protected]
> > Sent: Sat, August 21, 2010 6:20:30 PM
> > Subject: Re: [Qt-jambi-interest] how to define widget resizable
> > 
> > First of all, Jambi uses Java naming convention, so ”Main ” should be 
> ”main”...
> > 
> > You should try as simple example as possible, it looks like those size 
> > constraints you have and I mentioned in first reply are causing your 
> > problems.
> > 
> > go canal kirjoitti lauantai 21 elokuu 2010 13:13:31:
> > > 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...
> > > 
> > 
> > 
> 
> 

There is at top bar buttons ”lay out horizontally” and ”lay out vertically”. Qt 
should have proper tutorial about that somewhere, though.
-- 
Terveisin,
Samu Voutilainen
http://smar.fi

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

Reply via email to