1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/test/svgtest/mainwindow.cpp

60 lines
1.8 KiB
C++
Raw Normal View History

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "qqtsvgwidget.h"
#include "qqtsvgpushbutton.h"
2017-11-18 10:50:48 +08:00
#include "qqt-qt.h"
#include <QObject>
2018-05-01 20:45:05 +08:00
#include <qqtframe.h>
2017-11-18 10:50:48 +08:00
MainWindow::MainWindow ( QWidget* parent ) :
QMainWindow ( parent ),
ui ( new Ui::MainWindow )
{
2017-11-18 10:50:48 +08:00
ui->setupUi ( this );
2018-05-01 20:45:05 +08:00
QString svg = QString ( qrc ( "aa.svg" ) );
2017-11-18 10:50:48 +08:00
ui->w->setSvgFile ( svg );
2018-05-01 20:45:05 +08:00
ui->b0->iconTable() [BTN_NORMAL] = qrc ( "bt_stir.svg" );
ui->b0->iconTable() [BTN_HOVER] = qrc ( "bt_stir.svg" );
ui->b0->iconTable() [BTN_PRESS] = qrc ( "bt_stir_press.svg" );
ui->b0->renderToVariable();
2018-05-01 20:45:05 +08:00
ui->c0->iconTable() [BTN_NORMAL] = qrc ( "bt_stir.svg" );
ui->c0->iconTable() [BTN_HOVER] = qrc ( "bt_stir.svg" );
ui->c0->iconTable() [BTN_PRESS] = qrc ( "bt_stir_press.svg" );
ui->c0->renderToVariable();
2018-05-01 20:45:05 +08:00
ui->r0->iconTable() [BTN_NORMAL] = qrc ( "bt_stir.svg" );
ui->r0->iconTable() [BTN_HOVER] = qrc ( "bt_stir.svg" );
ui->r0->iconTable() [BTN_PRESS] = qrc ( "bt_stir_press.svg" );
ui->r0->renderToVariable();
2018-05-01 20:45:05 +08:00
ui->r1->iconTable() [BTN_NORMAL] = qrc ( "bt_stir.svg" );
ui->r1->iconTable() [BTN_HOVER] = qrc ( "bt_stir.svg" );
ui->r1->iconTable() [BTN_PRESS] = qrc ( "bt_stir_press.svg" );
ui->r1->renderToVariable();
2017-11-18 10:50:48 +08:00
2018-05-01 20:45:05 +08:00
ui->p0->setSvgFile ( qrc ( "bk_progress_background.svg" ),
qrc ( "bk_progress_trunk.svg" ) );
2017-11-18 10:50:48 +08:00
ui->p0->setRange ( 0, 100 );
ui->p0->setValue ( 60 );
2017-11-18 11:38:00 +08:00
2017-11-18 10:50:48 +08:00
QTimer* timer = new QTimer ( this );
timer->setInterval ( 100 );
timer->setSingleShot ( false );
2017-11-18 11:38:00 +08:00
QObject::connect ( timer, SIGNAL ( timeout() ),
this, SLOT ( updateProgress() ) ) ;
2017-11-18 10:50:48 +08:00
timer->start();
}
MainWindow::~MainWindow()
{
delete ui;
}
2017-11-18 11:38:00 +08:00
void MainWindow::updateProgress()
{
static int i = 0;
ui->p0->setValue ( i++ % 100 );
}