其他分享
首页 > 其他分享> > Qt_给菜单栏选项添加图标,添加到工具栏中

Qt_给菜单栏选项添加图标,添加到工具栏中

作者:互联网

//设置工具栏,添加图标
    ui.action_New->setIcon(QIcon(IMAGE_PATH("new.png")));
    ui.action_Import->setIcon(QIcon(IMAGE_PATH("open.png")));
    ui.action_Save->setIcon(QIcon(IMAGE_PATH("save.png")));
    ui.action_Stop->setIcon(QIcon(IMAGE_PATH("close.png")));
    ui.action_Start->setIcon(QIcon(IMAGE_PATH("start.png")));
    
    ui.toolBar->addAction(ui.action_New);
    ui.toolBar->addAction(ui.action_Import);
    ui.toolBar->addAction(ui.action_Save);
    ui.toolBar->addSeparator();
    ui.toolBar->addAction(ui.action_Start);
    ui.toolBar->addAction(ui.action_Stop);
    ui.toolBar->setIconSize(QSize(40, 40));

 

标签:addAction,工具栏,Qt,IMAGE,添加,ui,action,setIcon,toolBar
来源: https://www.cnblogs.com/RedWetPlace/p/16400141.html