The QTabWidget class provides a stack of tabbed widgets. More...
The QListWidget class provides an item-based list widget. More...
QStringList strlist;
strlist<<"系统"<<"外观"<<"截图"<<"贴图";
for (int i = 0;i<strlist.size();i++) {
//ui->listWidget->insertItem(i,strlist.at(i));
QListWidgetItem *pItem = new QListWidgetItem();
pItem->setSizeHint(QSize(100,100));
pItem->setTextAlignment(Qt::AlignCenter);
pItem->setText(strlist.at(i));
ui->listWidget->insertItem(i,pItem);
}
QStackedWidget这类似于一个卡片堆,其中只有最上面的卡片是可见的。
QStringList strlist;
strlist<<"系统"<<"外观"<<"截图"<<"贴图";
for (int i = 0;i<strlist.size();i++) {
//ui->listWidget->insertItem(i,strlist.at(i));
QListWidgetItem *pItem = new QListWidgetItem();
pItem->setSizeHint(QSize(100,100));
pItem->setTextAlignment(Qt::AlignCenter);
pItem->setText(strlist.at(i));
ui->listWidget->insertItem(i,pItem);
}
ui->stackedWidget->setCurrentIndex(0);//设置默认显示页
//void currentRowChanged(int currentRow);
connect(ui->listWidget,&QListWidget::currentRowChanged,[=](int index){
ui->stackedWidget->setCurrentIndex(index);
});