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. Toolbar spacer does not expand to the right corner
Forum Updated to NodeBB v4.3 + New Features

Toolbar spacer does not expand to the right corner

Scheduled Pinned Locked Moved Unsolved General and Desktop
34 Posts 5 Posters 5.2k 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.
  • T TommyTLC

    @mrjj This is where my spacer is located/its size: QRect(0,0 1180x480)

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

    @TommyTLC
    so its at o,0 and 1180 wide o.O and almost 500 in height.
    but we clearly dont see that.
    can you try
    qDebug() << "vis" << spacer->isVisible();

    i was wondering if this happens due to
    spacer->setMinimumWidth(1180);
    as i have seen widgets do odd stuff when not room enough.

    T 1 Reply Last reply
    0
    • mrjjM mrjj

      @TommyTLC
      so its at o,0 and 1180 wide o.O and almost 500 in height.
      but we clearly dont see that.
      can you try
      qDebug() << "vis" << spacer->isVisible();

      i was wondering if this happens due to
      spacer->setMinimumWidth(1180);
      as i have seen widgets do odd stuff when not room enough.

      T Offline
      T Offline
      TommyTLC
      wrote on last edited by
      #22

      @mrjj vis false

      mrjjM 1 Reply Last reply
      0
      • T TommyTLC

        @mrjj vis false

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

        @TommyTLC
        ok so its get hidden for some odd reason.
        do you use the do anything to the spacer variable after it has been inserted ?
        also try
        spacer->show();
        after its gone. ( like via a button)
        and lets see what happens.

        T 1 Reply Last reply
        0
        • mrjjM mrjj

          @TommyTLC
          ok so its get hidden for some odd reason.
          do you use the do anything to the spacer variable after it has been inserted ?
          also try
          spacer->show();
          after its gone. ( like via a button)
          and lets see what happens.

          T Offline
          T Offline
          TommyTLC
          wrote on last edited by
          #24

          @mrjj This is all I do with the spacer:

          QWidget* spacer = new QWidget();
          spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
          spacer->setMinimumWidth(1180);
          m_fileToolBar->addWidget(spacer);
          

          it gets created, I set the SizePolicy and the minimumWidth and then I assign it to the toolBar.

          mrjjM 1 Reply Last reply
          0
          • T TommyTLC

            @mrjj This is all I do with the spacer:

            QWidget* spacer = new QWidget();
            spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
            spacer->setMinimumWidth(1180);
            m_fileToolBar->addWidget(spacer);
            

            it gets created, I set the SizePolicy and the minimumWidth and then I assign it to the toolBar.

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

            @TommyTLC
            Ok so its not hidden by user code.
            Could you try a smaller minimum and see like
            spacer->setMinimumWidth(200);

            I know its not the goal but just to see if it still happens.

            VRoninV T 2 Replies Last reply
            0
            • T TommyTLC

              @mrjj in the >> I only see my m_aboutAction. It looks like the spacer disappears when the application is not in full screen.

              VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #26

              @TommyTLC said in Toolbar spacer does not expand to the right corner:

              in the >> I only see my m_aboutAction

              you do not see the style combo either?

              Did you overload resizeEvent?

              Does the "Configuration" label on the left have something special?

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              T 1 Reply Last reply
              0
              • mrjjM mrjj

                @TommyTLC
                Ok so its not hidden by user code.
                Could you try a smaller minimum and see like
                spacer->setMinimumWidth(200);

                I know its not the goal but just to see if it still happens.

                VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #27

                @mrjj said in Toolbar spacer does not expand to the right corner:

                Ok so its not hidden by user code.

                If it goes into >> then it will be hidden. I'm not sure this test is conclusive

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                1 Reply Last reply
                1
                • mrjjM mrjj

                  @TommyTLC
                  Ok so its not hidden by user code.
                  Could you try a smaller minimum and see like
                  spacer->setMinimumWidth(200);

                  I know its not the goal but just to see if it still happens.

                  T Offline
                  T Offline
                  TommyTLC
                  wrote on last edited by
                  #28

                  @mrjj By changing the minimum size I see the spacer:

                  visible spacer.PNG

                  But the items to the right can still be hidden by resizing the window:

                  not visible spacer.PNG

                  1 Reply Last reply
                  0
                  • VRoninV VRonin

                    @TommyTLC said in Toolbar spacer does not expand to the right corner:

                    in the >> I only see my m_aboutAction

                    you do not see the style combo either?

                    Did you overload resizeEvent?

                    Does the "Configuration" label on the left have something special?

                    T Offline
                    T Offline
                    TommyTLC
                    wrote on last edited by
                    #29

                    @VRonin Correct, the only thing I see by clicking the ">>" is the m_aboutAction.
                    The configuration label is an action. When clicked it generates a dialog you can interact with.
                    I am not sure what overlading the resizeEvent means.

                    mrjjM 1 Reply Last reply
                    0
                    • T TommyTLC

                      @VRonin Correct, the only thing I see by clicking the ">>" is the m_aboutAction.
                      The configuration label is an action. When clicked it generates a dialog you can interact with.
                      I am not sure what overlading the resizeEvent means.

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

                      Hi

                      • I am not sure what overlading the resizeEvent means.

                      Like for MainWindow, you have that function implemented in your code.

                      I have a feeling it the
                      setMinimumWidth that is the culprit of this.

                      T 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        Hi

                        • I am not sure what overlading the resizeEvent means.

                        Like for MainWindow, you have that function implemented in your code.

                        I have a feeling it the
                        setMinimumWidth that is the culprit of this.

                        T Offline
                        T Offline
                        TommyTLC
                        wrote on last edited by
                        #31

                        @mrjj Getting rid of the minimumWidth only leaves a small gap between the items in the toolBar. I don’t know what else I could try :(

                        mrjjM 1 Reply Last reply
                        0
                        • T TommyTLC

                          @mrjj Getting rid of the minimumWidth only leaves a small gap between the items in the toolBar. I don’t know what else I could try :(

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

                          @TommyTLC
                          Ok so it dont grow ?

                          Hmm. What version of Qt are you using ?

                          the code VRonin works perfectly in 5.15

                          alt text

                          But you get another result ?

                          T 1 Reply Last reply
                          0
                          • mrjjM mrjj

                            @TommyTLC
                            Ok so it dont grow ?

                            Hmm. What version of Qt are you using ?

                            the code VRonin works perfectly in 5.15

                            alt text

                            But you get another result ?

                            T Offline
                            T Offline
                            TommyTLC
                            wrote on last edited by
                            #33

                            @mrjj I’m working on the 5.15. His code DOES work perfectly, but for some reasons it has issues with my project. The spacer does not push the items all the way to the right. That’s why I was trying to set its minimumWidth.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #34

                              Hi,

                              Then you should start by using @VRonin's code in place of yours. Once you confirm it's working, you can step by step replace the widgets with the ones you are using until it breaks again.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              2

                              • Login

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