源代码包含七个源文件main.cpp是主函数。ex65.h和ex65.cpp,还有ex65.ui是主窗体文件,splashwindow.h, splashwindow.cpp和splashwindow.ui是Splash窗口。
在启动时,Splash窗口先出现,在用户点击用鼠标在窗口上点击一下后,Splash窗口消失,主窗口显示。
main.cpp
#include <QtGui/QApplication>
#include "ex65.h"
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    ex65 w;
    //w.show();
    a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
    return a.exec();
}
ex65.h
#ifndef EX65_H
#define EX65_H
#include <QtGui/QWidget>
#include "ui_ex65.h"
#include "splashwindow.h"
class ex65 : public QWidget
{
    Q_OBJECT
public:
    ex65(QWidget *parent = 0);
    ~ex65();
private:
    Ui::ex65Class ui;
       SplashWindow *sp;
};
#endif // EX65_H
ex65.cpp
#include "ex65.h"
#include "splashwindow.h"
ex65::ex65(QWidget *parent)
    : QWidget(parent)
{
       ui.setupUi(this);
       sp = new SplashWindow(this);
       sp->show();
}
ex65::~ex65()
{
       delete sp;
}
splashwindow.h
#ifndef SPLASHWINDOW_H
#define SPLASHWINDOW_H
#include <QDialog>
#include <QMouseEvent>
#include "ui_splashwindow.h"
using namespace Ui;
class SplashWindow : public QDialog, public SplashWindowClass
{
    Q_OBJECT
public:
    SplashWindow(QWidget *parent = 0);
    ~SplashWindow();
private:
       void mousePressEvent(QMouseEvent *);
};
#endif // SPLASHWINDOW_H
splashwindow.cpp
#include <QImage>
#include <QPixmap>
#include "splashwindow.h"
SplashWindow::SplashWindow(QWidget *parent)
: QDialog(parent)
{
    setupUi(this);
       QImage image("splash.png");
       label->setPixmap(QPixmap::fromImage(image));
       resize(500, 375);
       setWindowFlags(Qt::SplashScreen);
}
SplashWindow::~SplashWindow()
{
}
void SplashWindow::mousePressEvent(QMouseEvent *e)
{
       close();
       QWidget *parent = this->parentWidget();
       parent->show();
}
ex65.ui
<UI version="4.0" stdSetDef="1" >
 <class>ex65Class</class>
 <widget class="QWidget" name="ex65Class" >
  <property name="objectName" >
   <cstring>ex65Class</cstring>
  </property>
  <property name="geometry" >
   <rect>
    <x>0</x>
    <y>0</y>
    <width>600</width>
    <height>482</height>
   </rect>
  </property>
  <property name="windowTitle" >
   <string>ex65</string>
  </property>
 </widget>
 <layoutDefault spacing="6" margin="11" />
</UI>
splashwindow.ui
<ui version="4.0" >
 <author></author>
 <comment></comment>
 <exportmacro></exportmacro>
 <class>SplashWindowClass</class>
 <widget class="QWidget" name="SplashWindowClass" >
  <property name="geometry" >
   <rect>
    <x>0</x>
    <y>0</y>
    <width>382</width>
    <height>266</height>
   </rect>
  </property>
  <property name="windowTitle" >
   <string>SplashWindow</string>
  </property>
  <layout class="QGridLayout" >
   <property name="margin" >
    <number>8</number>
   </property>
   <property name="spacing" >
    <number>6</number>
   </property>
   <item row="0" column="0" >
    <widget class="QLabel" name="label" />
   </item>
  </layout>
 </widget>
 <layoutdefault spacing="6" margin="11" />
 <pixmapfunction></pixmapfunction>
 <resources/>
 <connections/>
</ui>
附件中是源代码和截图