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. How to get the real size of a scrollable Widget
QtWS25 Last Chance

How to get the real size of a scrollable Widget

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 881 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.
  • R Offline
    R Offline
    rakor
    wrote on last edited by
    #1

    Hi there!
    I would like to put 2 QTableWidgets, which are much bigger than the screen is, inside a QScrollArea. I want the QTableWidgets to be placed with their maximum size inside the QScrollArea so that I can scroll them only with the scrollbars of the QScollArea.

    So I did the following:

    @ QFrame* frame = new QFrame(this);
    QVBoxLayout* layout = new QVBoxLayout(frame);
    QScrollArea scroll = new QScrollArea(this);
    MyTabeWidget
    jt1 = new MyTabeWidget(this);
    MyTabeWidget* jt2 = new MyTabeWidget(this);
    frame->setLayout(layout);
    layout->addWidget(jt1);
    layout->addWidget(jt2);
    scroll->setWidget(frame);
    this->setCentralWidget(scroll);@

    MyTabeWidget is derived from QTableWidget.
    But if I do so I have a large QMainWindow which holds my QScrollArea, which has no scrollbars, and there are 2 tiny MyTabeWidgets in it having both scrollbars.

    How can I insert the MyTabeWidgets with their maximum sizo, so that they dont have any scrollbars by their own.

    Thank you!

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Hi,

      Put both QTableWidgets in a vertical layout in a QScrollArea.

      Then set them :
      fixed size
      AdjustToContents
      ScrollBarAlwaysOff

      that should do the trick.

      hope it helps

      Qt Certified Specialist
      www.edalsolutions.be

      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