Search code examples
c++qtqpushbutton

link QPushButton width to another QPushButton


I created a GUI width Qt Creator (Qt 5.0.1), of course also making use of layouts. For aesthetical reasons, I would like a QPushButton to be of the same width as another QPushButton placed in some other corner of the GUI. This other button changes the size dynamically when changing the window size, which is desired behavior.

Is there a way to (dynamically) link the sizes of these buttons without changing the layouts? If possible I'd like to avoid fixed sizes.


Solution

  • You can override the resizeEvent of first and send signal(with size) to second.