diff --git a/src/frame/qqtprogressdialog.h b/src/frame/qqtprogressdialog.h index 20e8f336..a9b8de01 100644 --- a/src/frame/qqtprogressdialog.h +++ b/src/frame/qqtprogressdialog.h @@ -26,7 +26,7 @@ public slots: private: Ui::QQtProgressDialog* ui; - QQTProgressBar* bar; + QQtProgressBar* bar; }; #endif // QPROGRESSWINDOW_H diff --git a/src/frame/qqtprogressdialog.ui b/src/frame/qqtprogressdialog.ui index 3e2f20e8..cd44b104 100644 --- a/src/frame/qqtprogressdialog.ui +++ b/src/frame/qqtprogressdialog.ui @@ -1,7 +1,7 @@ QQtProgressDialog - + 0 @@ -26,7 +26,7 @@ Cancel - + 20 @@ -63,7 +63,7 @@ 1 - QQTProgressBar + QQtProgressBar QWidget
qqtprogressbar.h
1 diff --git a/src/frame/qqtwifidbwidget.h b/src/frame/qqtwifidbwidget.h index a798e81d..3a2203a2 100644 --- a/src/frame/qqtwifidbwidget.h +++ b/src/frame/qqtwifidbwidget.h @@ -2,8 +2,9 @@ #define QQTWIFIDBWIDGET_H #include +#include -class QQtWifiDBWidget : public QQtWidget +class QQTSHARED_EXPORT QQtWifiDBWidget : public QQtWidget { Q_OBJECT Q_ENUMS(DB_STAT) diff --git a/src/qqt_source.pri b/src/qqt_source.pri index 765355cb..c4ebf9f6 100644 --- a/src/qqt_source.pri +++ b/src/qqt_source.pri @@ -17,12 +17,16 @@ SOURCES += \ $$PWD/svgwidgets/qqtsvgwidget.cpp \ $$PWD/svgwidgets/qqtsvgpushbutton.cpp \ $$PWD/svgwidgets/qqtsvgcheckbox.cpp \ - $$PWD/svgwidgets/qqtsvgradiobutton.cpp + $$PWD/svgwidgets/qqtsvgradiobutton.cpp \ + $$PWD/svgwidgets/qqtgraphicssvgitem.cpp \ + $$PWD/svgwidgets/qqtsvglabel.cpp HEADERS += \ $$PWD/svgwidgets/qqtsvgwidget.h \ $$PWD/svgwidgets/qqtsvgpushbutton.h \ $$PWD/svgwidgets/qqtsvgcheckbox.h \ - $$PWD/svgwidgets/qqtsvgradiobutton.h + $$PWD/svgwidgets/qqtsvgradiobutton.h \ + $$PWD/svgwidgets/qqtgraphicssvgitem.h \ + $$PWD/svgwidgets/qqtsvglabel.h #root dir HEADERS += $$PWD/qqt.h \ diff --git a/src/svgwidgets/qqtgraphicssvgitem.cpp b/src/svgwidgets/qqtgraphicssvgitem.cpp new file mode 100644 index 00000000..a93cdaf9 --- /dev/null +++ b/src/svgwidgets/qqtgraphicssvgitem.cpp @@ -0,0 +1,13 @@ +#include "qqtgraphicssvgitem.h" + +QQtGraphicsSvgItem::QQtGraphicsSvgItem(QQtGraphicsSvgItem* parent) : + QGraphicsSvgItem(parent) +{ + +} + +QQtGraphicsSvgItem::QQtGraphicsSvgItem(const QString& fileName, QQtGraphicsSvgItem* parentItem) : + QGraphicsSvgItem(fileName, parentItem) +{ + +} diff --git a/src/svgwidgets/qqtgraphicssvgitem.h b/src/svgwidgets/qqtgraphicssvgitem.h new file mode 100644 index 00000000..ce22928d --- /dev/null +++ b/src/svgwidgets/qqtgraphicssvgitem.h @@ -0,0 +1,19 @@ +#ifndef QQTGRAPHICSSVGITEM_H +#define QQTGRAPHICSSVGITEM_H + +#include +#include + +class QQTSHARED_EXPORT QQtGraphicsSvgItem : public QGraphicsSvgItem +{ + Q_OBJECT +public: + explicit QQtGraphicsSvgItem(QQtGraphicsSvgItem* parent = nullptr); + explicit QQtGraphicsSvgItem(const QString& fileName, QQtGraphicsSvgItem* parentItem = nullptr); + +signals: + +public slots: +}; + +#endif // QQTGRAPHICSSVGITEM_H diff --git a/src/svgwidgets/qqtsvgcheckbox.h b/src/svgwidgets/qqtsvgcheckbox.h index 7c3ab51a..e0d0b348 100644 --- a/src/svgwidgets/qqtsvgcheckbox.h +++ b/src/svgwidgets/qqtsvgcheckbox.h @@ -4,8 +4,9 @@ #include #include #include +#include -class QQtSvgCheckBox : public QQtCheckBox +class QQTSHARED_EXPORT QQtSvgCheckBox : public QQtCheckBox { Q_OBJECT public: diff --git a/src/svgwidgets/qqtsvglabel.cpp b/src/svgwidgets/qqtsvglabel.cpp new file mode 100644 index 00000000..33a28c9b --- /dev/null +++ b/src/svgwidgets/qqtsvglabel.cpp @@ -0,0 +1,33 @@ +#include "qqtsvglabel.h" +#include +#include + +QQtSvgLabel::QQtSvgLabel(QWidget* parent) : QQtLabel(parent) +{ + +} + +void QQtSvgLabel::setSvgFile(QString& filename) +{ + mSvgRender.load(filename); +} + +void QQtSvgLabel::setSvgContent(QByteArray& bytes) +{ + mSvgRender.load(bytes); +} + + +void QQtSvgLabel::paintEvent(QPaintEvent* event) +{ + Q_UNUSED(event) + + QStylePainter p(this); + if (mSvgRender.isValid()) + mSvgRender.render(&p); + + bool enabled = isEnabled(); + QStyleOptionFrame opt; + initStyleOption(&opt); + p.drawItemText(rect(), alignment(), opt.palette, enabled, text()); +} diff --git a/src/svgwidgets/qqtsvglabel.h b/src/svgwidgets/qqtsvglabel.h new file mode 100644 index 00000000..894e4d47 --- /dev/null +++ b/src/svgwidgets/qqtsvglabel.h @@ -0,0 +1,29 @@ +#ifndef QQTSVGLABEL_H +#define QQTSVGLABEL_H + +#include +#include +#include + +class QQTSHARED_EXPORT QQtSvgLabel : public QQtLabel +{ + Q_OBJECT +public: + explicit QQtSvgLabel(QWidget* parent = nullptr); + + void setSvgFile(QString& filename); + void setSvgContent(QByteArray& bytes); + +signals: + +public slots: + + // QWidget interface +protected: + virtual void paintEvent(QPaintEvent* event) override; + +private: + QSvgRenderer mSvgRender; +}; + +#endif // QQTSVGLABEL_H diff --git a/src/svgwidgets/qqtsvgpushbutton.h b/src/svgwidgets/qqtsvgpushbutton.h index abf2d72f..122079da 100644 --- a/src/svgwidgets/qqtsvgpushbutton.h +++ b/src/svgwidgets/qqtsvgpushbutton.h @@ -4,8 +4,9 @@ #include #include #include +#include -class QQtSvgPushButton : public QQtPushButton +class QQTSHARED_EXPORT QQtSvgPushButton : public QQtPushButton { Q_OBJECT public: diff --git a/src/svgwidgets/qqtsvgradiobutton.h b/src/svgwidgets/qqtsvgradiobutton.h index dc3a9caf..959d0e66 100644 --- a/src/svgwidgets/qqtsvgradiobutton.h +++ b/src/svgwidgets/qqtsvgradiobutton.h @@ -4,8 +4,9 @@ #include #include #include +#include -class QQtSvgRadioButton : public QQtRadioButton +class QQTSHARED_EXPORT QQtSvgRadioButton : public QQtRadioButton { Q_OBJECT public: diff --git a/src/svgwidgets/qqtsvgwidget.h b/src/svgwidgets/qqtsvgwidget.h index 22cd7f62..793c47be 100644 --- a/src/svgwidgets/qqtsvgwidget.h +++ b/src/svgwidgets/qqtsvgwidget.h @@ -2,8 +2,9 @@ #define QQTSVGWIDGET_H #include +#include -class QQtSvgWidget : public QSvgWidget +class QQTSHARED_EXPORT QQtSvgWidget : public QSvgWidget { Q_OBJECT public: diff --git a/src/widgets/qqtlistview.cpp b/src/widgets/qqtlistview.cpp index dbd61577..07888036 100644 --- a/src/widgets/qqtlistview.cpp +++ b/src/widgets/qqtlistview.cpp @@ -1,7 +1,7 @@ #include "qqtlistview.h" -QQtListView::QQtListView(QWidget* parent) : - QListView(parent) +QQtListView::QQtListView ( QWidget* parent ) : + QListView ( parent ) { } diff --git a/src/widgets/qqtlistview.h b/src/widgets/qqtlistview.h index 9dde75c5..1bf40e27 100644 --- a/src/widgets/qqtlistview.h +++ b/src/widgets/qqtlistview.h @@ -9,8 +9,8 @@ class QQTSHARED_EXPORT QQtListView : public QListView Q_OBJECT public: - explicit QQtListView(QWidget* parent = 0); - virtual ~QQtListView(); + explicit QQtListView ( QWidget* parent = 0 ); + virtual ~QQtListView (); private: }; diff --git a/src/widgets/qqtprogressbar.cpp b/src/widgets/qqtprogressbar.cpp index e859e9f9..500270c6 100644 --- a/src/widgets/qqtprogressbar.cpp +++ b/src/widgets/qqtprogressbar.cpp @@ -5,45 +5,45 @@ #include "QHBoxLayout" #include "QSpacerItem" -QQTProgressBar::QQTProgressBar(QWidget* parent) : - QWidget(parent), - ui(new Ui::QQTProgressBar) +QQtProgressBar::QQtProgressBar ( QWidget* parent ) : + QWidget ( parent ), + ui ( new Ui::QQtProgressBar ) { - ui->setupUi(this); + ui->setupUi ( this ); m_value = m_min = 0; m_max = 100; m_back = "./skin/default/bk_progress_background.png"; m_trunk = "./skin/default/bk_progress_trunk.png"; - ui->widthTrunk->setPixmap(m_trunk); - ui->widgetBack->setPixmap(m_back); - ui->widthTrunk->setType(QQtWidget::QQTTILEDWIDTH); - ui->widgetBack->setType(QQtWidget::QQTZOOMWIDTH); + ui->widthTrunk->setPixmap ( m_trunk ); + ui->widgetBack->setPixmap ( m_back ); + ui->widthTrunk->setType ( QQtWidget::QQTTILEDWIDTH ); + ui->widgetBack->setType ( QQtWidget::QQTZOOMWIDTH ); } -QQTProgressBar::~QQTProgressBar() +QQtProgressBar::~QQtProgressBar() { delete ui; } -void QQTProgressBar::setPixMap(QString back, QString trunk) +void QQtProgressBar::setPixMap ( QString back, QString trunk ) { m_back = back; m_trunk = trunk; - ui->widthTrunk->setPixmap(m_trunk); - ui->widgetBack->setPixmap(m_back); + ui->widthTrunk->setPixmap ( m_trunk ); + ui->widgetBack->setPixmap ( m_back ); } -void QQTProgressBar::setValue(int value) +void QQtProgressBar::setValue ( int value ) { m_value = value; - int w = ui->widgetBack->width() * (m_value - m_min) / (m_max - m_min); + int w = ui->widgetBack->width() * ( m_value - m_min ) / ( m_max - m_min ); int h = ui->widgetBack->height(); - ui->widthTrunk->setFixedSize(w, h); + ui->widthTrunk->setFixedSize ( w, h ); //pline() << width() << ui->widgetBack->width() << w << h; } -void QQTProgressBar::setRange(int min, int max) +void QQtProgressBar::setRange ( int min, int max ) { m_min = min; m_max = max; diff --git a/src/widgets/qqtprogressbar.h b/src/widgets/qqtprogressbar.h index f190836f..eb04e4d1 100644 --- a/src/widgets/qqtprogressbar.h +++ b/src/widgets/qqtprogressbar.h @@ -11,24 +11,24 @@ #include "qqtframe.h" namespace Ui { -class QQTProgressBar; +class QQtProgressBar; } -class QQTSHARED_EXPORT QQTProgressBar : public QWidget +class QQTSHARED_EXPORT QQtProgressBar : public QWidget { Q_OBJECT public: - explicit QQTProgressBar(QWidget* parent = 0); - ~QQTProgressBar(); + explicit QQtProgressBar ( QWidget* parent = 0 ); + ~QQtProgressBar(); - void setPixMap(QString back, QString trunk); + void setPixMap ( QString back, QString trunk ); public slots: - void setValue(int value); - void setRange(int min, int max); + void setValue ( int value ); + void setRange ( int min, int max ); private: - Ui::QQTProgressBar* ui; + Ui::QQtProgressBar* ui; private: QString m_back, m_trunk; diff --git a/src/widgets/qqtprogressbar.ui b/src/widgets/qqtprogressbar.ui index 7fb0d2e9..f1da6cab 100644 --- a/src/widgets/qqtprogressbar.ui +++ b/src/widgets/qqtprogressbar.ui @@ -1,7 +1,7 @@ - QQTProgressBar - + QQtProgressBar + 0