作者:cql QQ:609162385
动画效果主要通过:QPropertyAnimation实现
#ifndef NAVIGATIONWIDGET_H
#define NAVIGATIONWIDGET_H
#include "gaugeprogressbar/gaugeprogressbar.h"
#include "qxmessagebox/qxmessagebox.h"
#include "animationbutton/animationbuttonb.h"
#include "animationbutton/animationbuttona.h"
#include "mainmenuwidget.h"
#include <QWidget>
namespace Ui {
class NavigationWidget;
}
class NavigationWidget : public QWidget
{
Q_OBJECT
public:
explicit NavigationWidget(QWidget *parent = 0);
~NavigationWidget();
void initFrom();
private slots:
void onbtn_menu_clicked();
void onbtn_standBy_clicked();
private:
Ui::NavigationWidget *ui;
GaugeProgressBar *m_gaugeProbarA;
GaugeProgressBar *m_gaugeProbarB;
GaugeProgressBar *m_gaugeProbarC;
GaugeProgressBar *m_gaugeProbarD;
GaugeProgressBar *m_gaugeProbarE;
GaugeProgressBar *m_gaugeProbarF;
GaugeProgressBar *m_gaugeProbarG;
AnimationButtona *m_menuButton;
AnimationButtona *m_standByButton;
};
#endif // NAVIGATIONWIDGET_H
#include "navigationwidget.h"
#include "ui_navigationwidget.h"
NavigationWidget::NavigationWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::NavigationWidget)
{
ui->setupUi(this);
initFrom();
}
NavigationWidget::~NavigationWidget()
{
delete ui;
}
void NavigationWidget::initFrom()
{
m_gaugeProbarA = new GaugeProgressBar(this);
m_gaugeProbarB = new GaugeProgressBar(this);
m_gaugeProbarC = new GaugeProgressBar(this);
m_gaugeProbarD = new GaugeProgressBar(this);
m_gaugeProbarE = new GaugeProgressBar(this);
m_gaugeProbarF = new GaugeProgressBar(this);
m_gaugeProbarG = new GaugeProgressBar(this);
m_gaugeProbarA->setGeometry(10,40,105,80);
m_gaugeProbarB->setGeometry(120,40,105,80);
m_gaugeProbarC->setGeometry(230,40,105,80);
m_gaugeProbarD->setGeometry(340,40,105,80);
m_gaugeProbarE->setGeometry(450,40,105,80);
m_gaugeProbarF->setGeometry(560,40,105,80);
m_gaugeProbarG->setGeometry(670,40,105,80);
m_gaugeProbarA->setProgressColor(QColor(200,200,200));
m_gaugeProbarB->setProgressColor(QColor(200,200,200));
m_gaugeProbarC->setProgressColor(QColor(200,200,200));
m_gaugeProbarD->setProgressColor(QColor(200,200,200));
m_gaugeProbarE->setProgressColor(QColor(200,200,200));
m_gaugeProbarF->setProgressColor(QColor(200,200,200));
m_gaugeProbarG->setProgressColor(QColor(200,200,200));
m_menuButton = new AnimationButtona(this);
m_standByButton = new AnimationButtona(this);
m_menuButton->setGeometry(910,10,110,110);
m_standByButton->setGeometry(790,10,110,110);
m_menuButton->setNormalImage(":/image/clean.png");
m_menuButton->setEnterImage(":/image/clean_enter.png");
m_menuButton->setLeaveImage(":/image/clean_leave.png");
m_standByButton->setNormalImage(":/image/safe.png");
m_standByButton->setEnterImage(":/image/safe_enter.png");
m_standByButton->setLeaveImage(":/image/safe_leave.png");
connect(m_menuButton,SIGNAL(onClicked()),this,SLOT(onbtn_menu_clicked()));
connect(m_standByButton,SIGNAL(onClicked()),this,SLOT(onbtn_standBy_clicked()));
}
void NavigationWidget::onbtn_menu_clicked()
{
MainMenuWidget m_mainMenuWidget;
m_mainMenuWidget.exec();
}
void NavigationWidget::onbtn_standBy_clicked()
{
QXMessageBox msgbx;
msgbx.exec();
}