QToolButton *button = new QToolButton(); button->setMinimumSize(100, button->minimumHeight());
QToolButton *button = new QToolButton(); button->setMinimumSize(button->minimumWidth(), 50);In both examples, we create a new QToolButton object and use the setMinimumSize method to set the minimum size of the button. The first example sets the minimum width of the button to 100 pixels while preserving the current minimum height. The second example does the same for minimum height. The Qt library is required to use QToolButton and its methods, including setMinimumSize.