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. dialog button boxes at run time are not the same as at design time.
Forum Updated to NodeBB v4.3 + New Features

dialog button boxes at run time are not the same as at design time.

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 265 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.
  • N Offline
    N Offline
    ntos
    wrote on last edited by
    #1

    Hi,

    I put two dialog button boxes in a horizontal layout as in the picture. Each box contains a single button set as a centerbutton. On the form they are close together, but at runtime they are wide apart. What should I do so they look as designed.

    Screenshot from 2024-06-17 10-44-46.png

    Thank you.

    jsulmJ C 2 Replies Last reply
    0
    • N ntos

      Hi,

      I put two dialog button boxes in a horizontal layout as in the picture. Each box contains a single button set as a centerbutton. On the form they are close together, but at runtime they are wide apart. What should I do so they look as designed.

      Screenshot from 2024-06-17 10-44-46.png

      Thank you.

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

      @ntos Why do you have a spacer between the two buttons? That spacer is the reason for the big gap between the buttons.

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

      1 Reply Last reply
      0
      • N ntos

        Hi,

        I put two dialog button boxes in a horizontal layout as in the picture. Each box contains a single button set as a centerbutton. On the form they are close together, but at runtime they are wide apart. What should I do so they look as designed.

        Screenshot from 2024-06-17 10-44-46.png

        Thank you.

        C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        @ntos Further to @jsulm's query, if you want individual buttons why use a QDialogButtonBox at all? One QDialogButtonBox, containing both OK and Cancel, placed directly in the vertical layout will do the right thing. If it does not sit to the right (platform dependent behaviour IIRC) then the same single QDialogButtonBox with a spacer to the left arranged like you have it now.

        If that spaced arranged is a deal breaker then single buttons with a fixed size spacer between them.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          ntos
          wrote on last edited by ntos
          #4

          @jsulm . Thank you. The spacer makes no difference whether it is there between the buttons or not. At run time there is always this big gap. I have tried fixing the width of this middle spacer at various values and deleting this spacer in vain. There is always this big gap.
          @ChrisW67 . Thank you. I want to use two separate Dialog Button Boxes because one box looks so ugly: The OK and Cancel buttons are always so close together. I want to have some space between them, but it seems there is no way you can control this gap width.

          M 1 Reply Last reply
          0
          • N ntos

            @jsulm . Thank you. The spacer makes no difference whether it is there between the buttons or not. At run time there is always this big gap. I have tried fixing the width of this middle spacer at various values and deleting this spacer in vain. There is always this big gap.
            @ChrisW67 . Thank you. I want to use two separate Dialog Button Boxes because one box looks so ugly: The OK and Cancel buttons are always so close together. I want to have some space between them, but it seems there is no way you can control this gap width.

            M Offline
            M Offline
            mpergand
            wrote on last edited by
            #5

            @ntos said in dialog button boxes at run time are not the same as at design time.:

            The OK and Cancel buttons are always so close together. I want to have some space between them, but it seems there is no way you can control this gap width.

            Set the layout spacing the buttons are in, the value you want, as well as the margins.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              ntos
              wrote on last edited by
              #6

              @mpergand . Thanks a bunch. the layout spacing does the trick.

              1 Reply Last reply
              0
              • N ntos has marked this topic as solved on

              • Login

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