maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   How do I make a QDialog's view scrollable ? (https://talk.maemo.org/showthread.php?t=58102)

ahmadka 2010-07-09 10:45

How do I make a QDialog's view scrollable ?
 
Hey guys .. I had a simple question but one I've been unable to find a quick answer to .. I have a QDialog with many buttons and stuff in it ... A picture of it is shown here:

http://i26.tinypic.com/24gre9w.png

As you can see its very cluttered .. What I wanted to do was to make the controls layout scrollable, so that all the controls can be well sized, and to see the controls below, you simply scroll down .. That way it won't look so cluttered .. Can I set this setting using QDialog only preferably ?

Rob1n 2010-07-09 11:06

Re: How do I make a QDialog's view scrollable ?
 
With that much info, I'd be inclined to use a normal QWidget with Qt::WA_Maemo5StackedWindow set, rather than a QDialog.

Either way, I don't think you can make it scrollable as is - you'll need to put all the buttons, etc. onto another QWidget, and then interpose a QScrollArea between the top-level QWidget/QDialog and the QWidget with the buttons on.

ahmadka 2010-07-09 22:36

Re: How do I make a QDialog's view scrollable ?
 
Alright, well I tried adding a QScrollArea for now and adding on the widgets on the left side of the screen into that, and then adding that to the same QDialog .. But the situation has gotten worse now ..

Firstly, here's the code I was using (only the ending portion relating to adding widgets to layouts, etc ..):

Code:

mainSaveQualityModeRadioButtonsLayout = new QHBoxLayout();

    mainSaveQualityModeRadioButtonsLayout->addWidget(mainSaveUseDefaultSaveQualityRadioButton);
    mainSaveQualityModeRadioButtonsLayout->addWidget(mainSaveUseCustomSaveQualityRadioButton);

    mainSaveSliderLayout = new QHBoxLayout();
    mainSaveSliderLayout->addWidget(mainSaveQualitySlider);
    mainSaveSliderLayout->addWidget(mainSaveSliderValueLabel);

    mainSaveButtonsLayout = new QVBoxLayout();

    mainSaveButtonsLayout->addWidget(mainSaveFileNameText);
    mainSaveButtonsLayout->addWidget(mainSaveLocationButton);
    mainSaveButtonsLayout->addWidget(mainSaveFormatButton);
    mainSaveButtonsLayout->addWidget(mainSaveQualityModeLabel);
    mainSaveButtonsLayout->addLayout(mainSaveQualityModeRadioButtonsLayout);
    mainSaveButtonsLayout->addLayout(mainSaveSliderLayout);
    mainSaveButtonsLayout->addWidget(mainSaveMakeDefaultSaveSettingCheckBox);

    mainSaveScrollArea = new QScrollArea();
    mainSaveScrollArea->setLayout(mainSaveButtonsLayout);

    mainSaveMainButtonLayout = new QVBoxLayout();
    mainSaveMainButtonLayout->addWidget(mainSaveButton);

    mainSaveOverallLayout = new QHBoxLayout();
    mainSaveOverallLayout->addWidget(mainSaveScrollArea);
    mainSaveOverallLayout->addLayout(mainSaveMainButtonLayout);


    mainSaveDialog = new QDialog();
    mainSaveDialog->setLayout(mainSaveOverallLayout);

    mainSaveDialog->show();

And here is the result I achieved, with no scroll bar in view ..

http://i27.tinypic.com/2s6v4sx.png

Any suggestions .. ?

Rob1n 2010-07-11 19:40

Re: How do I make a QDialog's view scrollable ?
 
Quote:

Originally Posted by ahmadka (Post 746640)
Any suggestions .. ?

I think you'll need to put the layout onto a QWidget, then put that in the QScrollArea. You can then set a minimum size for the QWidget.


All times are GMT. The time now is 07:18.

vBulletin® Version 3.8.8