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. Scroll bars does not work properly

Scroll bars does not work properly

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 141 Views 2 Watching
  • 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.
  • M Offline
    M Offline
    Marcus Barnet
    wrote on last edited by Marcus Barnet
    #1

    I've lost the last two days trying to figure out how to solve my problem.
    I hope you can help and support me to solve it.

    I have a list of several comboboxes and I would like to display them by using a scroll bar so I can fill all the controls in a fixed window which is already at full screen: the idea is that the user uses the scrollbar to scroll the content while the main window size is fixed.

    I added the QScrollArea the my QWdiget, but the bars only show when I resize pretty much the main window and they hide part of the content (the scroll bars can show only a partial content).
    So, even if I scroll the bars, I cannot see the full content since it is cut somehow.

    This is the code of my Form named "schede" (I cannot post all the code since the forum has a limited number of character per topic):

    <?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
     <class>Schede</class>
     <widget class="QWidget" name="Schede">
      <property name="geometry">
       <rect>
        <x>0</x>
        <y>0</y>
        <width>1465</width>
        <height>1050</height>
       </rect>
      </property>
      <property name="windowTitle">
       <string>Form</string>
      </property>
      <layout class="QVBoxLayout" name="verticalLayout">
       <item>
        <widget class="QWidget" name="" native="true">
         <layout class="QHBoxLayout" name="horizontalLayout">
          <property name="spacing">
           <number>10</number>
          </property>
          <property name="leftMargin">
           <number>10</number>
          </property>
          <property name="rightMargin">
           <number>10</number>
          </property>
          <property name="bottomMargin">
           <number>10</number>
          </property>
          <item>
           <widget class="QScrollArea" name="scrollArea">
            <property name="widgetResizable">
             <bool>true</bool>
            </property>
            <widget class="QWidget" name="scrollAreaWidgetContents">
             <property name="geometry">
              <rect>
               <x>0</x>
               <y>0</y>
               <width>1425</width>
               <height>1019</height>
              </rect>
             </property>
             <widget class="QWidget" name="verticalLayoutWidget_4">
              <property name="geometry">
               <rect>
                <x>310</x>
                <y>0</y>
                <width>273</width>
                <height>1021</height>
               </rect>
              </property>
              <layout class="QVBoxLayout" name="verticalLayoutA_3" stretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">
               <property name="spacing">
                <number>5</number>
               </property>
               <item>
                <widget class="QComboBox" name="combo_gruppo_muscolare1_4">
                 <property name="font">
                  <font>
                   <pointsize>12</pointsize>
                   <weight>75</weight>
                   <bold>true</bold>
                  </font>
                 </property>
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <property name="maxVisibleItems">
                  <number>10</number>
                 </property>
                 <item>
                  <property name="text">
                   <string>R IP</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_3"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_4"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_2"/>
               </item>
               <item>
                <widget class="QComboBox" name="combo_gruppo_muscolare2_4">
                 <property name="font">
                  <font>
                   <pointsize>12</pointsize>
                   <weight>75</weight>
                   <bold>true</bold>
                  </font>
                 </property>
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>RIP</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_8"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_5"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_6"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_7"/>
               </item>
               <item>
                <widget class="QComboBox" name="combo_gruppo_muscolare12_4">
                 <property name="font">
                  <font>
                   <pointsize>12</pointsize>
                   <weight>75</weight>
                   <bold>true</bold>
                  </font>
                 </property>
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>RIP</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_10"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_12"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_9"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_11"/>
               </item>
               <item>
                <widget class="QComboBox" name="combo_gruppo_muscolare16_4">
                 <property name="font">
                  <font>
                   <pointsize>12</pointsize>
                   <weight>75</weight>
                   <bold>true</bold>
                  </font>
                 </property>
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>RIP</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_13"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_15"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_14"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_16"/>
               </item>
               <item>
                <widget class="QComboBox" name="combo_gruppo_muscolare17_4">
                 <property name="font">
                  <font>
                   <pointsize>12</pointsize>
                   <weight>75</weight>
                   <bold>true</bold>
                  </font>
                 </property>
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>RIP</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_18"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_17"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_19"/>
               </item>
               <item>
                <widget class="QLineEdit" name="lineEdit_20"/>
               </item>
              </layout>
             </widget>
             <widget class="QWidget" name="verticalLayoutWidget_3">
              <property name="geometry">
               <rect>
                <x>241</x>
                <y>0</y>
                <width>59</width>
                <height>1021</height>
               </rect>
              </property>
              <layout class="QVBoxLayout" name="verticalLayoutA_2" stretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">
               <property name="spacing">
                <number>0</number>
               </property>
               <item>
                <widget class="QComboBox" name="combo_gruppo_muscolare1_3">
                 <property name="font">
                  <font>
                   <pointsize>12</pointsize>
                   <weight>75</weight>
                   <bold>true</bold>
                  </font>
                 </property>
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <property name="maxVisibleItems">
                  <number>10</number>
                 </property>
                 <item>
                  <property name="text">
                   <string>SET</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="comboBox_41">
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>1</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>2</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>3</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>4</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>5</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="comboBox_42">
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>1</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>2</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>3</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>4</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>5</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="comboBox_43">
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>1</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>2</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>3</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>4</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>5</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="comboBox_44">
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>1</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>2</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>3</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>4</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>5</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="combo_gruppo_muscolare2_3">
                 <property name="font">
                  <font>
                   <pointsize>12</pointsize>
                   <weight>75</weight>
                   <bold>true</bold>
                  </font>
                 </property>
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>SET</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="comboBox_45">
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>1</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>2</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>3</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>4</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>5</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="comboBox_46">
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>1</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>2</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>3</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>4</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>5</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="comboBox_47">
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>1</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>2</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>3</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>4</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>5</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="comboBox_48">
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>1</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>2</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>3</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>4</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>5</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="combo_gruppo_muscolare12_3">
                 <property name="font">
                  <font>
                   <pointsize>12</pointsize>
                   <weight>75</weight>
                   <bold>true</bold>
                  </font>
                 </property>
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>SET</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
                <widget class="QComboBox" name="comboBox_49">
                 <property name="editable">
                  <bool>true</bool>
                 </property>
                 <item>
                  <property name="text">
                   <string>1</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>2</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>3</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>4</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
                   <string>5</string>
                  </property>
                 </item>
                </widget>
               </item>
               <item>
    

    and this is the code of the related cpp file:

    #include "schede.h"
    #include "ui_schede.h"
    
    Schede::Schede(QWidget *parent) :
        QWidget(parent),
        ui(new Ui::Schede)
    {
        ui->setupUi(this);
    
    }
    
    Schede::~Schede()
    {
        delete ui;
    }
    
    

    The Form named "schede" is loaded into QTabWoidget from a main Frame:

    void Pump::on_pushButton_5_clicked()
    {
    
    
       ui->tabWidget->addTab(new Schede(), QString("Scheda %0").arg(ui->tabWidget->count() +1));
       ui->tabWidget->setCurrentIndex(ui->tabWidget->count()-1);
       ui->stackedWidget->setCurrentIndex(8);
    }
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi did you also put the QScrollArea in a layout so it follow its parent ?

      1 Reply Last reply
      1

      • Login

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