一.效果
二.实现
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QStandardItemModel>
#include <QFont>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
QFont font("Microsoft YaHei", 16);
qApp->setFont(font);
QStandardItemModel *model = new QStandardItemModel();
for (int i = 0; i < 200; ++i)
{
QString icon = QString(":/icons/%1.jpg").arg(i % 3);
QString text;
if (i % 3 == 0)
{
text = "蒙奇D路飞\n草帽团船长";
}
else if(i % 3 == 1)
{