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. scrollbar in QGroupBox
Qt 6.11 is out! See what's new in the release blog

scrollbar in QGroupBox

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 2 Posters 10.2k Views 1 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.
  • A Offline
    A Offline
    Apeksha
    wrote on last edited by Apeksha
    #7

    Hi raven-worx,

    QHBoxLayout *ConfigurationLayout = new QHBoxLayout;
    QScrollArea* scrollArea = new QScrollArea();
    scrollArea->setStyleSheet("QScrollArea {background-color:gray;}");
    ConfigurationLayout->addWidget(ui->configurationBox);////ui->configurationbox is QGroupBox.
    mainBoxLayout->addLayout(ConfigurationLayout);
    

    This is correctway or anything wrong I am doing.

    raven-worxR 1 Reply Last reply
    0
    • A Apeksha

      Hi raven-worx,

      QHBoxLayout *ConfigurationLayout = new QHBoxLayout;
      QScrollArea* scrollArea = new QScrollArea();
      scrollArea->setStyleSheet("QScrollArea {background-color:gray;}");
      ConfigurationLayout->addWidget(ui->configurationBox);////ui->configurationbox is QGroupBox.
      mainBoxLayout->addLayout(ConfigurationLayout);
      

      This is correctway or anything wrong I am doing.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #8

      @Apeksha
      you dont add any widget to the scroll-area, i dont see any group-box widget and i don't see any setWidgetResizable() call.
      Hard to say if you are doing all right, when you just post half of the code.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Apeksha
        wrote on last edited by
        #9

        QHBoxLayout *ConfigurationLayout = new QHBoxLayout;
        QScrollArea *scrollArea = new QScrollArea;
        scrollArea->setStyleSheet("QScrollArea {background-color:gray;}");
        // ui->scrollArea->widgetResizable(true);
        // scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
        // scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
        scrollArea->setWidget(ui->configurationBox);
        ConfigurationLayout->addWidget(ui->configurationBox);
        scrollArea->setWidgetResizable(true);
        // ConfigurationLayout->addWidget(ui->scrollArea);
        mainBoxLayout->addLayout(ConfigurationLayout);

        raven-worxR 1 Reply Last reply
        0
        • A Apeksha

          QHBoxLayout *ConfigurationLayout = new QHBoxLayout;
          QScrollArea *scrollArea = new QScrollArea;
          scrollArea->setStyleSheet("QScrollArea {background-color:gray;}");
          // ui->scrollArea->widgetResizable(true);
          // scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
          // scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
          scrollArea->setWidget(ui->configurationBox);
          ConfigurationLayout->addWidget(ui->configurationBox);
          scrollArea->setWidgetResizable(true);
          // ConfigurationLayout->addWidget(ui->scrollArea);
          mainBoxLayout->addLayout(ConfigurationLayout);

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #10

          @Apeksha
          so still no setMinimumSize() call...
          Beside that, are there any questions left from your side?!

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Apeksha
            wrote on last edited by
            #11

            Hi

            I am little bit confusing, Can you please post lines of code.

            raven-worxR 1 Reply Last reply
            0
            • A Apeksha

              Hi

              I am little bit confusing, Can you please post lines of code.

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #12

              @Apeksha

              QWidget* contentWidget = ...
                   contentWidget->setMinimumSize( 500,500 );
              
              QScrollArea *scrollArea = new QScrollArea;
                  scrollArea->setStyleSheet("QScrollArea {background-color:gray;}");
                  scrollArea->setWidget( contentWidget );
                  scrollArea->setWidgetResizable(true);
              
              QVBoxLayout* groupBoxLayout = new QVBoxLayout;
                    groupBoxLayout->addWidget( scrollArea );
              QGroupBox* groupBox = ...
                    groupBox->setLayout( groupBoxLayout );
              

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Apeksha
                wrote on last edited by
                #13

                QHBoxLayout *ConfigurationLayout = new QHBoxLayout;
                QScrollArea *scrollArea = new QScrollArea;
                scrollArea->setStyleSheet("QScrollArea {background-color:rgb(215,214,213);}");
                scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
                scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
                scrollArea->setWidget(ui->configurationBox);
                //ConfigurationLayout->addWidget(ui->configurationBox);
                scrollArea->setWidgetResizable(true);
                scrollArea->setMinimumSize(811,50);
                ConfigurationLayout->addWidget(scrollArea);
                mainBoxLayout->addLayout(ConfigurationLayout);

                raven-worxR 1 Reply Last reply
                1
                • A Apeksha

                  QHBoxLayout *ConfigurationLayout = new QHBoxLayout;
                  QScrollArea *scrollArea = new QScrollArea;
                  scrollArea->setStyleSheet("QScrollArea {background-color:rgb(215,214,213);}");
                  scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
                  scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
                  scrollArea->setWidget(ui->configurationBox);
                  //ConfigurationLayout->addWidget(ui->configurationBox);
                  scrollArea->setWidgetResizable(true);
                  scrollArea->setMinimumSize(811,50);
                  ConfigurationLayout->addWidget(scrollArea);
                  mainBoxLayout->addLayout(ConfigurationLayout);

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #14

                  @Apeksha
                  yes...and?
                  Do you have a question?? Does it work for you or not?!

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  1
                  • A Offline
                    A Offline
                    Apeksha
                    wrote on last edited by
                    #15

                    No, when I minimized, scrollbar is not coming.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      Apeksha
                      wrote on last edited by
                      #16

                      Hi raven-worx,

                      Thank you for help, it's working fine.

                      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