Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QScrollArea, QTabWidget, .ui form opened in MainWindow
QtWS25 Last Chance

QScrollArea, QTabWidget, .ui form opened in MainWindow

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    angelicaP
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      angelicaP
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved