Qt 小知识

一: 内置资源icon
内置图标的枚举变量大家可在Qt助手索引中输入QStyle::StandardPixmap即可查看详细描述。

QGridLayout *layout = qobject_cast(mpUi->centralWidget->layout());
int IconIndex = 0;
for (int row = 0; row < 7; row++){
for (int col = 0; col < 10; col++){
enum QStyle::StandardPixmap Icon = (enum QStyle::StandardPixmap)IconIndex;
layout->addWidget(new QPushButton(QApplication::style()->standardIcon(Icon),
QString::number(IconIndex)), row, col);
IconIndex++;
}
}
(发帖不贴图是
————————————————
版权声明:本文为CSDN博主「福尔摩斯·柯南」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wh_19931117/java/article/details/80444107

你可能感兴趣的:(Qt 小知识)