我改成这样子了
#include <QtGui>
#include "mdi.h"
MdiWindow::MdiWindow()
{
    mdiArea = new QMdiArea;
    setCentralWidget(mdiArea);
    //this not work 
    //connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindw *)), this, SLOT(updateActions()));
    aLabel = new QLabel(tr("标签 a"));
    bLabel = new QLabel(tr("标签 b"));
    statusLabel = new QLabel(tr(""));
    count = 0;
    //create actions
    aAction = new QAction(tr("标签 a"), this);
    aAction->setCheckable(true);
    connect(aAction, SIGNAL(triggered()), aLabel, SLOT(show()));
    connect(aAction, SIGNAL(triggered()), aLabel, SLOT(setFocus()));
    bAction = new QAction(tr("标签 b"), this);
    bAction->setCheckable(true);
    connect(bAction, SIGNAL(triggered()), bLabel, SLOT(show()));
    connect(bAction, SIGNAL(triggered()), bLabel, SLOT(setFocus()));
    //create menus
    windowMenu = menuBar()->addMenu(tr("&Window"));
    windowMenu->addAction(aAction);
    windowMenu->addAction(bAction);
    lActionGroup = new QActionGroup(this);
    lActionGroup->addAction(aAction);
    lActionGroup->addAction(bAction);
    //create toolbars
    //create context menu
    //create statusbar
    statusBar()->addWidget(statusLabel);
    //add sub window
    aSubWindow = mdiArea->addSubWindow(aLabel);
    connect(aSubWindow, SIGNAL(aboutToActivate()), this, SLOT(updateActions()));
    bSubWindow = mdiArea->addSubWindow(bLabel);
    connect(bSubWindow, SIGNAL(aboutToActivate()), this, SLOT(updateActions()));
    mdiArea->cascadeSubWindows();    //Arranges all the child windows in a cascade pattern.
    //mdiArea->activateNextSubWindow();
    //setWindowIcon(QPixmap(":/images/hx.png"));
    setWindowTitle(tr("mdi 程序"));
}
void MdiWindow::updateActions()
{
    statusLabel->setText(tr("window activated %1 times").arg(++count));
    
    aAction->setChecked(aSubWindow->windowState() & Qt::WindowActive);
    bAction->setChecked(bSubWindow->windowState() & Qt::WindowActive);
}