dialog button boxes at run time are not the same as at design time.
-
wrote on 17 Jun 2024, 03:45 last edited by
-
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.
Thank you.
@ntos Why do you have a spacer between the two buttons? That spacer is the reason for the big gap between the buttons.
-
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.
Thank you.
wrote on 17 Jun 2024, 05:43 last edited by@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.
-
wrote on 17 Jun 2024, 08:17 last edited by 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. -
@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.wrote on 17 Jun 2024, 09:39 last edited by@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/6