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. calculate dimension of groupBox

calculate dimension of groupBox

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 4 Posters 1.3k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I wrote in the show Event:

     MainWindow::setFixedSize(QSize(width_primo_schermo,available_height_first_screen));
               qDebug()<<"Massima";
               qDebug()<<this->size().width();
               qDebug()<<ui->groupBox_9->size().width();
               qDebug()<<ui->GroupBox1_Acquisizione->size().width();
    

    but the dimension of groupBox isn't right, the others are right

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Try
      ui->groupBox->width();
      instead.

      ? 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        Try
        ui->groupBox->width();
        instead.

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @mrjj it's the same, maybe it's beacuse the groupBox_9 isn't fixed, it adapts to the dimension of MainWindow, but if I write in this way the dimension of groupBox isn't right

        mrjjM 1 Reply Last reply
        0
        • ? A Former User

          @mrjj it's the same, maybe it's beacuse the groupBox_9 isn't fixed, it adapts to the dimension of MainWindow, but if I write in this way the dimension of groupBox isn't right

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @vale88
          Hi
          Normally it just works
          if i do

          void MainWindow::showEvent(QShowEvent *event)
          {
              qDebug() << ui->groupBox->width();
          }
          
          

          its exactly the width i see in Designer.
          So you must be doing other stuff to the groupBox.

          ? 1 Reply Last reply
          0
          • mrjjM mrjj

            @vale88
            Hi
            Normally it just works
            if i do

            void MainWindow::showEvent(QShowEvent *event)
            {
                qDebug() << ui->groupBox->width();
            }
            
            

            its exactly the width i see in Designer.
            So you must be doing other stuff to the groupBox.

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            @mrjj what's other stuff?

            ? 1 Reply Last reply
            0
            • ? A Former User

              @mrjj what's other stuff?

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              @vale88 it's a groupbox in gridlayout inside the mainWindow and inside the groupBox there is a layout

              J.HilkJ 1 Reply Last reply
              0
              • ? A Former User

                @vale88 it's a groupbox in gridlayout inside the mainWindow and inside the groupBox there is a layout

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                @vale88 is the groupbox also shown, together with the mainwindow?

                for whatever reason, resize events of hidden widgets seem to be delayed until they are shown.

                Had some serious trouble with that as well.


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                ? 2 Replies Last reply
                1
                • J.HilkJ J.Hilk

                  @vale88 is the groupbox also shown, together with the mainwindow?

                  for whatever reason, resize events of hidden widgets seem to be delayed until they are shown.

                  Had some serious trouble with that as well.

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  @J.Hilk so how must I write?

                  1 Reply Last reply
                  0
                  • J.HilkJ J.Hilk

                    @vale88 is the groupbox also shown, together with the mainwindow?

                    for whatever reason, resize events of hidden widgets seem to be delayed until they are shown.

                    Had some serious trouble with that as well.

                    ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #9

                    @J.Hilk yes is shown with mainWindow

                    jsulmJ 1 Reply Last reply
                    0
                    • ? A Former User

                      @J.Hilk yes is shown with mainWindow

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @vale88 Is the size of GroupBox1_Acquisizione correct (I assume it is a QGroupBox as well)?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      ? 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @vale88 Is the size of GroupBox1_Acquisizione correct (I assume it is a QGroupBox as well)?

                        ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #11

                        @jsulm yes, but it's fixed, the other groupBox isn't fixed

                        J.HilkJ 1 Reply Last reply
                        0
                        • ? A Former User

                          @jsulm yes, but it's fixed, the other groupBox isn't fixed

                          J.HilkJ Offline
                          J.HilkJ Offline
                          J.Hilk
                          Moderators
                          wrote on last edited by
                          #12

                          @vale88 is the other one in a layout or how do you define it's pos and size?


                          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                          Q: What's that?
                          A: It's blue light.
                          Q: What does it do?
                          A: It turns blue.

                          ? 1 Reply Last reply
                          0
                          • J.HilkJ J.Hilk

                            @vale88 is the other one in a layout or how do you define it's pos and size?

                            ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #13

                            @J.Hilk the other one in a lyout but its dimension is fixed

                            J.HilkJ 1 Reply Last reply
                            0
                            • ? A Former User

                              @J.Hilk the other one in a lyout but its dimension is fixed

                              J.HilkJ Offline
                              J.HilkJ Offline
                              J.Hilk
                              Moderators
                              wrote on last edited by
                              #14

                              @vale88
                              let me rephrase that,

                              the one that does not report the expected size back,

                              is that in a layout or not.
                              Do you resize it automatically or by hand
                              have you set a fixedSize on it,
                              what is the sizePolicy
                              what is max and min size


                              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                              Q: What's that?
                              A: It's blue light.
                              Q: What does it do?
                              A: It turns blue.

                              ? 1 Reply Last reply
                              0
                              • J.HilkJ J.Hilk

                                @vale88
                                let me rephrase that,

                                the one that does not report the expected size back,

                                is that in a layout or not.
                                Do you resize it automatically or by hand
                                have you set a fixedSize on it,
                                what is the sizePolicy
                                what is max and min size

                                ? Offline
                                ? Offline
                                A Former User
                                wrote on last edited by
                                #15

                                @J.Hilk 0_1555574780617_Cattura.PNG 0_1555574787016_Cattura1.PNG
                                the groupBox is inside the stacked widget, between the mainWindow and the layout red, and the mainWindow and the stacked have a layout in grid, and I put the value of the groupBox

                                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