问题描述:
当QToolbutton 用于QToolBar时用 setIconSize()设置图标大小没有作用;
解决方法:
QToolbutton按钮设置图标大小,根据帮助手册查询如下:
The button’s look and dimension is adjustable with setToolButtonStyle() and setIconSize(). When used inside a QToolBar in a QMainWindow, the button automatically adjusts to QMainWindow’s settings (see QMainWindow::setToolButtonStyle() and QMainWindow::setIconSize()). Instead of an icon, a tool button can also display an arrow symbol, specified with arrowType.
当QToolButton被设置为QToolBar时,此时调用** setIconSize() **函数设置无法设置图标大小,此时应该设置QMainWindow的setIconSize()才能进行设置大小;具体实现代码如下:
bool MainWindowUI::makeToolButton(QToolButton*& toolbutton, QWidget* parent, QString tip, QString icon)
{
bool ret = true;
toolbutton = new QToolButton();
if(toolbutton !&