QToolBar *toolbar = new QToolBar(); toolbar->setIconSize(QSize(32, 32));
QToolBar *toolbar = new QToolBar(); toolbar->setIconSize(QApplication::style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton).availableSizes().last());In the first example, we create a new QToolBar object and set the icon size to 32x32 pixels using the setIconSize function. In the second example, we create a new QToolBar object and set the icon size to the maximum available size. We do this by retrieving the available sizes for the horizontal extension button using QApplication::style() and the QStyle::SP_ToolBarHorizontalExtensionButton constant. Then we select the last size in the list, which should be the maximum available size, and use it to set the toolbar icon size.