dialog.cpp:
#include "dialog.h"
#include<QLabel>
#include<QStackedWidget>
#include<QListWidget>
#include<QImage>
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
QStackedWidget *stack=new QStackedWidget(this);
QListWidget *shipname =new QListWidget(this);
QLabel *henry=new QLabel("亨利四世");
QImage image1(":/resource/1.jpg");
henry->setPixmap(QPixmap::fromImage(image1));
henry->setGeometry(0,0,1000,800);
QLabel *Missouri=new QLabel("密苏里");
QImage image3(":/resource/3.jpg");
Missouri->setPixmap(QPixmap::fromImage(image3));
Missouri->setGeometry(0,0,1000,800);
QLabel *Roman=new QLabel("罗马");
QImage image2(":/resource/2.jpg");
Roman->setPixmap(QPixmap::fromImage(image2));
Roman->setGeometry(0,0,1000,800);
QLabel *KGV=new QLabel("英王乔治五世");
QImage image4(":/resource/4.png");
KGV->setPixmap(QPixmap::fromImage(image4));
KGV->setGeometry(0,0,1000,800);
stack->addWidget(henry);
stack->addWidget(Missouri);
stack->addWidget(Roman);
stack->addWidget(KGV);
shipname->addItem("亨利四世");
shipname->addItem("衣阿华-密苏里");
shipname->addItem("维内托-罗马");
shipname->addItem("英王乔治五世");
shipname->setGeometry(10,10,150,400);
stack->setGeometry(200,10,1000,800);
resize(1300,900);
connect(shipname,SIGNAL(currentRowChanged(int)),stack,SLOT(setCurrentIndex(int)));
}
Dialog::~Dialog()
{
}