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

fix svg widget qt4 build

This commit is contained in:
tianduanrui 2017-11-18 11:38:00 +08:00
parent 55897af10d
commit b1c56960a6
12 changed files with 56 additions and 39 deletions

View File

@ -36,15 +36,12 @@ MainWindow::MainWindow ( QWidget* parent ) :
"/Users/abel/Develop/d1-product/App/skin/default/bt_stir_press.svg" ); "/Users/abel/Develop/d1-product/App/skin/default/bt_stir_press.svg" );
ui->p0->setRange ( 0, 100 ); ui->p0->setRange ( 0, 100 );
ui->p0->setValue ( 60 ); ui->p0->setValue ( 60 );
QTimer* timer = new QTimer ( this ); QTimer* timer = new QTimer ( this );
timer->setInterval ( 100 ); timer->setInterval ( 100 );
timer->setSingleShot ( false ); timer->setSingleShot ( false );
QObject::connect ( timer, &QTimer::timeout, QObject::connect ( timer, SIGNAL ( timeout() ),
[this] this, SLOT ( updateProgress() ) ) ;
{
static int i = 0;
ui->p0->setValue ( i++ % 100 );
} ) ;
timer->start(); timer->start();
} }
@ -52,3 +49,9 @@ MainWindow::~MainWindow()
{ {
delete ui; delete ui;
} }
void MainWindow::updateProgress()
{
static int i = 0;
ui->p0->setValue ( i++ % 100 );
}

View File

@ -15,6 +15,9 @@ public:
explicit MainWindow ( QWidget* parent = 0 ); explicit MainWindow ( QWidget* parent = 0 );
~MainWindow(); ~MainWindow();
private slots:
void updateProgress();
private: private:
Ui::MainWindow* ui; Ui::MainWindow* ui;
}; };

View File

@ -3,6 +3,7 @@
#include <QGraphicsSvgItem> #include <QGraphicsSvgItem>
#include <qqt-local.h> #include <qqt-local.h>
#include <qqtcore.h>
class QQTSHARED_EXPORT QQtGraphicsSvgItem : public QGraphicsSvgItem class QQTSHARED_EXPORT QQtGraphicsSvgItem : public QGraphicsSvgItem
{ {

View File

@ -5,6 +5,7 @@
#include <QSvgRenderer> #include <QSvgRenderer>
#include <qqtwidgets.h> #include <qqtwidgets.h>
#include <qqt-local.h> #include <qqt-local.h>
#include <qqtcore.h>
class QQTSHARED_EXPORT QQtSvgCheckBox : public QQtCheckBox class QQTSHARED_EXPORT QQtSvgCheckBox : public QQtCheckBox
{ {

View File

@ -23,11 +23,16 @@ void QQtSvgLabel::paintEvent(QPaintEvent* event)
Q_UNUSED ( event ) Q_UNUSED ( event )
QStylePainter p ( this ); QStylePainter p ( this );
if ( mSvgRender.isValid() ) if ( mSvgRender.isValid() )
mSvgRender.render ( &p ); mSvgRender.render ( &p );
bool enabled = isEnabled(); bool enabled = isEnabled();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
p.drawItemText ( rect(), alignment(), palette(), enabled, text() );
#else
QStyleOptionFrame opt; QStyleOptionFrame opt;
initStyleOption ( &opt ); initStyleOption ( &opt );
p.drawItemText ( rect(), alignment(), opt.palette, enabled, text() ); p.drawItemText ( rect(), alignment(), opt.palette, enabled, text() );
#endif
} }

View File

@ -4,6 +4,7 @@
#include <qqtlabel.h> #include <qqtlabel.h>
#include <QSvgRenderer> #include <QSvgRenderer>
#include <qqt-local.h> #include <qqt-local.h>
#include <qqtcore.h>
class QQTSHARED_EXPORT QQtSvgLabel : public QQtLabel class QQTSHARED_EXPORT QQtSvgLabel : public QQtLabel
{ {

View File

@ -4,6 +4,7 @@
#include <qqtsvgwidget.h> #include <qqtsvgwidget.h>
#include <QSvgRenderer> #include <QSvgRenderer>
#include <qqt-local.h> #include <qqt-local.h>
#include <qqtcore.h>
class QQTSHARED_EXPORT QQtSvgProgressBar : public QQtSvgWidget class QQTSHARED_EXPORT QQtSvgProgressBar : public QQtSvgWidget
{ {

View File

@ -5,6 +5,7 @@
#include <QSvgRenderer> #include <QSvgRenderer>
#include <qqtwidgets.h> #include <qqtwidgets.h>
#include <qqt-local.h> #include <qqt-local.h>
#include <qqtcore.h>
class QQTSHARED_EXPORT QQtSvgPushButton : public QQtPushButton class QQTSHARED_EXPORT QQtSvgPushButton : public QQtPushButton
{ {

View File

@ -5,6 +5,7 @@
#include <QSvgRenderer> #include <QSvgRenderer>
#include <qqtwidgets.h> #include <qqtwidgets.h>
#include <qqt-local.h> #include <qqt-local.h>
#include <qqtcore.h>
class QQTSHARED_EXPORT QQtSvgRadioButton : public QQtRadioButton class QQTSHARED_EXPORT QQtSvgRadioButton : public QQtRadioButton
{ {

View File

@ -3,6 +3,7 @@
#include <QSvgWidget> #include <QSvgWidget>
#include <qqt-local.h> #include <qqt-local.h>
#include <qqtcore.h>
class QQTSHARED_EXPORT QQtSvgWidget : public QSvgWidget class QQTSHARED_EXPORT QQtSvgWidget : public QSvgWidget
{ {

View File

@ -14,7 +14,7 @@ public:
private: private:
// QQTTreeView interface // QQtTreeView interface
protected: protected:
void drawRow ( QPainter* painter, const QStyleOptionViewItem& options, const QModelIndex& index ) const; void drawRow ( QPainter* painter, const QStyleOptionViewItem& options, const QModelIndex& index ) const;
void drawBranches ( QPainter* painter, const QRect& rect, const QModelIndex& index ) const; void drawBranches ( QPainter* painter, const QRect& rect, const QModelIndex& index ) const;

View File

@ -1,5 +1,4 @@
#include "qqttreewidget.h" #include "qqttreewidget.h"
#include "ui_qqttreewidget.h"
#include "qqtxmltreemodel.h" #include "qqtxmltreemodel.h"
QQtTreeWidget::QQtTreeWidget ( QWidget* parent ) : QQtTreeWidget::QQtTreeWidget ( QWidget* parent ) :