Robert Wood | 23 Mar 18:36 2011
Picon

How to make a dialogue box with scroll bars?

I've been playing round for the last several hours trying to get a 
dialogue box with lots of large buttons on it so that it has scroll bars 
so you can see all the buttons.

There are forty-five of these large buttons so the dialogue will need to 
scroll a a long way down for the user to select the appropriate button 
at times.

I have tried all sorts of thins like putting all the buttons in a 
QScrollArea on Qt Designer, putting the buttons in a QFrame and then 
following the Image Viewer Example, but rather than putting the imagine 
in a QScrollArea I put the frame in it. (This latter one just makes all 
the buttons disappear. I tried it like this in my config_dialogue 
constructor (where config_dialogue is my dialogue!).

	scrollArea = new QScrollArea;
	scrollArea->setBackgroundRole(QPalette::Dark);
	scrollArea->setWidget(ui->pictureFrame);

Where pictureFrame is a QFrame on which I place the [large] buttons.

I have seen other suggestions Googling around to do similar things to 
the above bit of code, but this just doesn't work.

My gut feeling is that this should be a piece of cake in Designer and I 
shouldn't have to write code to do it, but I am stuck. Would be very 
grateful for a pointer on how I can do this.

Many thanks. :~)
(Continue reading)

Anton Chernov | 23 Mar 22:16 2011
Picon

Re: How to make a dialogue box with scroll bars?

Very annoying thing - be sure that you have ALWAYS a parent on
whatever widget in the constructor (where it is not explicitly
required). Even with the generated ui files. Check them too. Believe
me - it helps! :)

2011/3/23 Robert Wood <robert.wood <at> apostrophe.co.uk>:
> I've been playing round for the last several hours trying to get a
> dialogue box with lots of large buttons on it so that it has scroll bars
> so you can see all the buttons.
>
> There are forty-five of these large buttons so the dialogue will need to
> scroll a a long way down for the user to select the appropriate button
> at times.
>
> I have tried all sorts of thins like putting all the buttons in a
> QScrollArea on Qt Designer, putting the buttons in a QFrame and then
> following the Image Viewer Example, but rather than putting the imagine
> in a QScrollArea I put the frame in it. (This latter one just makes all
> the buttons disappear. I tried it like this in my config_dialogue
> constructor (where config_dialogue is my dialogue!).
>
>        scrollArea = new QScrollArea;
>        scrollArea->setBackgroundRole(QPalette::Dark);
>        scrollArea->setWidget(ui->pictureFrame);
>
> Where pictureFrame is a QFrame on which I place the [large] buttons.
>
> I have seen other suggestions Googling around to do similar things to
> the above bit of code, but this just doesn't work.
>
(Continue reading)

Tony Rietwyk | 24 Mar 00:21 2011
Picon

Re: How to make a dialogue box with scroll bars?

Hi Robert, 

> Sent: Thursday, 24 March 2011 04:37
> 
> I've been playing round for the last several hours trying to get a 
> dialogue box with lots of large buttons on it so that it has 
> scroll bars 
> so you can see all the buttons.
> 
> There are forty-five of these large buttons so the dialogue 
> will need to 
> scroll a a long way down for the user to select the 
> appropriate button 
> at times.
> 
> I have tried all sorts of thins like putting all the buttons in a 
> QScrollArea on Qt Designer, putting the buttons in a QFrame and then 
> following the Image Viewer Example, but rather than putting 
> the imagine 
> in a QScrollArea I put the frame in it. (This latter one just 
> makes all 
> the buttons disappear. I tried it like this in my config_dialogue 
> constructor (where config_dialogue is my dialogue!).
> 
> 	scrollArea = new QScrollArea;
> 	scrollArea->setBackgroundRole(QPalette::Dark);
> 	scrollArea->setWidget(ui->pictureFrame);
> 
> Where pictureFrame is a QFrame on which I place the [large] buttons.
> 
(Continue reading)

Robert Wood | 24 Mar 12:18 2011
Picon

Re: How to make a dialogue box with scroll bars?

On 23/03/11 23:21, Tony Rietwyk wrote:
> I created the attached by these steps in 4.6.0 designer:
>
> - Create the dialog
> - Drag a scroll area onto the dialog
> - Set the dialog layout to vertical
> - Drag a frame onto the scroll area widget
> - Set the scroll area layout to vertical (which actually sets it on the
> internal scroll area widget).
> - Dragged several buttons onto the frame
> - Changed their minimum height to 100
> - Set the frame layout to vertical
>
> Voila!
>
> Hope that helps,
>
> Tony

Hi Tony,

That looks like the sort of thing I am after, thanks! Am frustrated to 
say that I can't even work out how to set the layouts to be "vertical". 
I can see things like "Vertical Policy" in the "size Policy" setting. 
Problem with setting that is there is no way to stretch anything to 
place the nine rows of five buttons!

I'm obviously missing something and don't understand what setting area 
layouts be vertical means.

(Continue reading)

Robert Wood | 24 Mar 13:07 2011
Picon

Re: How to make a dialogue box with scroll bars?

Ahhh, got it! Was looking in the wrong place for set vertical. Been a 
year or so since I used Designer and had forgotten about that way of 
setting up widgets. .

Many thanks again. :~) Designer is actually pretty complex in its own 
right, I find a lot of the layout stuff really hard to get right.

On 24/03/11 11:18, Robert Wood wrote:
> On 23/03/11 23:21, Tony Rietwyk wrote:
>> I created the attached by these steps in 4.6.0 designer:
>>
>> - Create the dialog
>> - Drag a scroll area onto the dialog
>> - Set the dialog layout to vertical
>> - Drag a frame onto the scroll area widget
>> - Set the scroll area layout to vertical (which actually sets it on the
>> internal scroll area widget).
>> - Dragged several buttons onto the frame
>> - Changed their minimum height to 100
>> - Set the frame layout to vertical
>>
>> Voila!
>>
>> Hope that helps,
>>
>> Tony
>
> Hi Tony,
>
> That looks like the sort of thing I am after, thanks! Am frustrated to
(Continue reading)

K. Frank | 24 Mar 19:30 2011
Picon

Re: How to make a dialogue box with scroll bars?

Hi Robert!

On Thu, Mar 24, 2011 at 8:07 AM, Robert Wood
<robert.wood <at> apostrophe.co.uk> wrote:
> Ahhh, got it! Was looking in the wrong place for set vertical. Been a
> year or so since I used Designer and had forgotten about that way of
> setting up widgets. .
>
> Many thanks again. :~) Designer is actually pretty complex in its own
> right, I find a lot of the layout stuff really hard to get right.

Yes, I have to agree with you about Designer, especially with the
layouts.  Sometimes when I can't figure out how to insert a new
component into an existing set of nested layouts I resort to editing
the xml .ui file.

I've also been confused by the fact that Designer presents splitters
as if they're just a kind of layout, but they're not, and they behave
differently.

> ...

Best.

K. Frank
Till Oliver Knoll | 25 Mar 11:19 2011
Picon

Re: How to make a dialogue box with scroll bars?


Am 24.03.2011 um 13:07 schrieb Robert Wood <robert.wood <at> apostrophe.co.uk>:

> Many thanks again. :~) Designer is actually pretty complex in its own 
> right, I find a lot of the layout stuff really hard to get right.
> 

Au contraire! Layouts in Qt are very easy and intuitive! And Qt Designer makes them intuitive and even
easier to apply: simply select the widgets you want to layout (or the container widget), choose a suitable
layout (the intuitive "Grid layout" covers most of my needs), et voilà!

Add "spacers" as needed and you get your desired layout in no time!

If you have used "Card Layouts", "NorthEastSouthWest" layouts, "Gridbag" layouts and tried to figure out
their proper parameters, you know what I am talking about! And I have yet to find a good GUI designer for Java
which is free, performant, intuitive and most importantly, does not touch my OWN code in any way!

Cheers, Oliver
_______________________________________________
Qt-interest mailing list
Qt-interest <at> qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
Robert Wood | 25 Mar 11:40 2011
Picon

Re: How to make a dialogue box with scroll bars?

I can only speak from my experience! ;~)

Around eighteen months ago I knocked a database front end for my little 
company. I found accessing the mysql database and getting the data in 
and out much more straightforward than getting the layouts right! Even 
now I am not quite happy with the way it looks. I find it impossible to 
get some of the boxes I want a fixed size (yet some I get right), 
widgets in exactly the right place and I find spacers just impossible to 
understand. I played for hours with all this stuff, looked at little 
youtube videos and read my Qt book!

I will grant you I am poor at graphics and spacial awareness in general, 
but intuitive is the last word I would use for Designer.

I think sometimes you (one) forget(s), once you've been using a system 
for a long while, just how much knowledge you've picked up and how much 
of a learning curve you had at the start. When you just dip in and out 
of Designer (and Creator) like me, I think these difficult kinds of 
things take even more learning.

Either that or I'm just thick! ;~)

Cheers,

Rob

On 25/03/11 10:19, Till Oliver Knoll wrote:
>
>
> Am 24.03.2011 um 13:07 schrieb Robert Wood<robert.wood <at> apostrophe.co.uk>:
(Continue reading)

Malyushytsky, Alex | 24 Mar 00:43 2011

Re: How to make a dialogue box with scroll bars?

First of all user will mostly likely find need to scroll to find a button annoying.
So I would recommend to change the design so it does not have hundred of buttons on the single page.
It may be achieved by grouping them using tabwidget or any other alternative.

If this does not work approach with QScrollArea will work.
I recall made it work when I had to place group of large controls (QTableWidget, etc ) on QDockWidget which
allowed me not to limit dockwidget resizing.

In case of buttons,  it should be simple. Make sure you placed all the buttons in the layout.
This should ensure that the size hint of the child widget is set to a suitable value.

Alex




-----Original Message-----
From: qt-interest-bounces+alex=wai.com <at> qt.nokia.com
[mailto:qt-interest-bounces+alex=wai.com <at> qt.nokia.com] On Behalf Of Robert Wood
Sent: Wednesday, March 23, 2011 10:37 AM
To: qt-interest <at> qt.nokia.com
Subject: [Qt-interest] How to make a dialogue box with scroll bars?

I've been playing round for the last several hours trying to get a
dialogue box with lots of large buttons on it so that it has scroll bars
so you can see all the buttons.

There are forty-five of these large buttons so the dialogue will need to
scroll a a long way down for the user to select the appropriate button
at times.
(Continue reading)


Gmane