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:
parent
55897af10d
commit
b1c56960a6
@ -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 );
|
||||||
|
}
|
||||||
|
@ -12,11 +12,14 @@ class MainWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
|
|
||||||
#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
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QQtGraphicsSvgItem(QQtGraphicsSvgItem* parent = nullptr);
|
explicit QQtGraphicsSvgItem ( QQtGraphicsSvgItem* parent = nullptr );
|
||||||
explicit QQtGraphicsSvgItem(const QString& fileName, QQtGraphicsSvgItem* parentItem = nullptr);
|
explicit QQtGraphicsSvgItem ( const QString& fileName, QQtGraphicsSvgItem* parentItem = nullptr );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
#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
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QQtSvgCheckBox(QWidget* parent = nullptr);
|
explicit QQtSvgCheckBox ( QWidget* parent = nullptr );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief renderToVariable
|
* @brief renderToVariable
|
||||||
@ -23,7 +24,7 @@ public slots:
|
|||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent* event) override;
|
virtual void paintEvent ( QPaintEvent* event ) override;
|
||||||
private:
|
private:
|
||||||
QSvgRenderer r[BTN_MAX];
|
QSvgRenderer r[BTN_MAX];
|
||||||
};
|
};
|
||||||
|
@ -2,32 +2,37 @@
|
|||||||
#include <QStylePainter>
|
#include <QStylePainter>
|
||||||
#include <QStyleOptionFrame>
|
#include <QStyleOptionFrame>
|
||||||
|
|
||||||
QQtSvgLabel::QQtSvgLabel(QWidget* parent) : QQtLabel(parent)
|
QQtSvgLabel::QQtSvgLabel ( QWidget* parent ) : QQtLabel ( parent )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSvgLabel::setSvgFile(QString& filename)
|
void QQtSvgLabel::setSvgFile ( QString& filename )
|
||||||
{
|
{
|
||||||
mSvgRender.load(filename);
|
mSvgRender.load ( filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSvgLabel::setSvgContent(QByteArray& bytes)
|
void QQtSvgLabel::setSvgContent ( QByteArray& bytes )
|
||||||
{
|
{
|
||||||
mSvgRender.load(bytes);
|
mSvgRender.load ( bytes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QQtSvgLabel::paintEvent(QPaintEvent* event)
|
void QQtSvgLabel::paintEvent ( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED ( event )
|
||||||
|
|
||||||
QStylePainter p(this);
|
QStylePainter p ( this );
|
||||||
if (mSvgRender.isValid())
|
|
||||||
mSvgRender.render(&p);
|
if ( mSvgRender.isValid() )
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,16 @@
|
|||||||
#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
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QQtSvgLabel(QWidget* parent = nullptr);
|
explicit QQtSvgLabel ( QWidget* parent = nullptr );
|
||||||
|
|
||||||
void setSvgFile(QString& filename);
|
void setSvgFile ( QString& filename );
|
||||||
void setSvgContent(QByteArray& bytes);
|
void setSvgContent ( QByteArray& bytes );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ public slots:
|
|||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent* event) override;
|
virtual void paintEvent ( QPaintEvent* event ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSvgRenderer mSvgRender;
|
QSvgRenderer mSvgRender;
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
#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
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QQtSvgPushButton(QWidget* parent = nullptr);
|
explicit QQtSvgPushButton ( QWidget* parent = nullptr );
|
||||||
virtual ~QQtSvgPushButton() {}
|
virtual ~QQtSvgPushButton() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +26,7 @@ public slots:
|
|||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent* event) override;
|
virtual void paintEvent ( QPaintEvent* event ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSvgRenderer r[BTN_MAX];
|
QSvgRenderer r[BTN_MAX];
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
#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
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QQtSvgRadioButton(QWidget* parent = nullptr);
|
explicit QQtSvgRadioButton ( QWidget* parent = nullptr );
|
||||||
/**
|
/**
|
||||||
* @brief renderToVariable
|
* @brief renderToVariable
|
||||||
* call this function after iconTable() set.
|
* call this function after iconTable() set.
|
||||||
@ -22,7 +23,7 @@ public slots:
|
|||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent* event) override;
|
virtual void paintEvent ( QPaintEvent* event ) override;
|
||||||
private:
|
private:
|
||||||
QSvgRenderer r[BTN_MAX];
|
QSvgRenderer r[BTN_MAX];
|
||||||
};
|
};
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -9,15 +9,15 @@ class QQTSHARED_EXPORT QQtTreeView : public QTreeView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QQtTreeView(QWidget* parent = 0);
|
explicit QQtTreeView ( QWidget* parent = 0 );
|
||||||
virtual ~QQtTreeView();
|
virtual ~QQtTreeView();
|
||||||
|
|
||||||
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTTREEVIEW_H
|
#endif // QQTTREEVIEW_H
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#include "qqttreewidget.h"
|
#include "qqttreewidget.h"
|
||||||
#include "ui_qqttreewidget.h"
|
|
||||||
#include "qqtxmltreemodel.h"
|
#include "qqtxmltreemodel.h"
|
||||||
|
|
||||||
QQtTreeWidget::QQtTreeWidget(QWidget* parent) :
|
QQtTreeWidget::QQtTreeWidget ( QWidget* parent ) :
|
||||||
QQtTreeView(parent)
|
QQtTreeView ( parent )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user