QScrollArea, QTabWidget, .ui form opened in MainWindow



  • hi,

    just to continue my previous thread from "here":http://qt-project.org/forums/viewthread/28893/#130337

    after I inserted the .ui form in the TabWidget, I would like to have the form scrollable, meaning if the
    MainWindog is resized to have the scroll bars available on the bottom and right side.

    for this i tried to implement in my form addA.cpp the following code:

    @#include <QScrollArea>
    #include <QMainWindow>

    addA::addA(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::addA)
    {
    ui->setupUi(this);

    QScrollArea * scrollArea = new QScrollArea();
    QMainWindow::setCentralWidget(scrollArea);
    scrollArea->setWidget(addA);
    }@

    this code didn't work to make my addA.ui form scrollable.

    than i tried in my mainwindow.cpp the following code:

    @QTabWidget *tabWidget = new QTabWidget;
    addA *nA = new addA();
    tabWidget->addTab (nA, tr("Test"));
    QScrollArea * scrollArea = new QScrollArea();
    scrollArea->setWidget(tabWidget);
    setCentralWidget(tabWidget);@

    what i'm doing wrong?



  • hi,

    I was looking in Qt Creator Help manual installed on machine, local, and under User Guide, FAQ, i found the following statement:

    "Why does Qt Creator not use tabs for editors?

    This question comes up from time to time, so we have considered it carefully. Here are our main reasons for not using tabs:

    • Tabs do not scale. They work fine if you have 5 to 6 editors open, they become cumbersome with 10, and if you need more horizontal space than the tab bar, the interface does not work at all.
    • Tabs do not adapt to your working set.
    • The common solution is to give the user the ability to reorder tabs. Now user has to manage tabs instead of writing code.
    • Tabs force you to limit the amount of open editors, because otherwise you get confused."

    I have one misunderstandings:

    1. "* Tabs do not scale. " does this means that as soon as I use QTabWidget in my mainwindow and i would like to change the size of the window from maximized to any custom size, my QTabWidget will not scale? meaning my window can't be scrollable? meaning I shouldn't expect to have a ScrollArea on QTabWidgets?

    where could I find more details about these issues? the QTabWidget class details doesn't specify anything.

    thank for your input.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.