部分代码如下
QAction *openFile = new QAction(QIcon(QString(":/Res/open.png")), tr("打开文件"), this);
connect(openFile, SIGNAL(triggered()), this, SLOT(openFileSource()));
QAction *showSet = new QAction(QIcon(QString(":/Res/set.png")), tr("设置"), this);
connect(showSet, SIGNAL(triggered()), this, SLOT(showSet()));
m_labelcount = new QLabel(this);
m_labelcount->setText(" 0:0:0");
m_labelTotal = new QLabel(this);
m_labelTotal->setText("/ 0:0:0");
QPalette pl = m_labelcount->palette();
p.setColor(QPalette::WindowText , Qt::green);
m_labelTotal->setPalette(pl);
connect( mediaObject, SIGNAL(totalTimeChanged(qint64)), this, SLOT(toolTimeSet(qint64)) );
connect( mediaObject, SIGNAL(tick(qint64)), this, SLOT(tickTimeSet(qint64)) );
QVBoxLayout *mainLayout = new QVBoxLayout;
videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
mainLayout->addWidget(videoWidget);
mainLayout->addWidget(seekSlider);
mainLayout->addWidget(toolBar);
mainLayout->addWidget(ui->frame);
setLayout(mainLayout);
ui->frame->hide();
videoWidget->setBackgroundRole(QPalette::Dark);
setContextMenuPolicy(Qt::CustomContextMenu);
videoWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(videoWidget, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(showContextMenu(const QPoint &)));
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(showContextMenu(const QPoint &)));
createContextMenu();
this->setWindowTitle(tr("wmv player "));
resize(1290, 840);