Fix to support build lib in Windows

This commit is contained in:
Xuan Nguyen 2021-07-01 17:04:11 +07:00
parent e0eacabf91
commit 91362b4af3
34 changed files with 90 additions and 44 deletions

View File

@ -315,3 +315,11 @@ YouTube video preview [available here](http://www.youtube.com/watch?v=21UMeNVBPU
- [ ] Stepper - [ ] Stepper
- [ ] Subheaders - [ ] Subheaders
- [ ] Toolbar - [ ] Toolbar
#### Implement Qt Desinger plugin
- Tested on Windows 10, Ubuntu
- Note: Must build with release mode in Windows
- Copy lib to Qt Design plugin folder. Example:
+ Ubuntu: /opt/Qt5.12.8/Tools/QtCreator/lib/Qt/plugins/designer/
+ Windows 10: C:\Qt\Qt5.12.8\Tools\QtCreator\bin\plugins\designer

View File

@ -1,11 +1,7 @@
QT += widgets uiplugin designer QT += widgets uiplugin designer
CONFIG += plugin release CONFIG += plugin #release
TEMPLATE = lib TEMPLATE = lib
TARGET = $$qtLibraryTarget(qt-material-widget)
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
include(link_components.pri) include(link_components.pri)
SOURCES += \ SOURCES += \
@ -13,3 +9,14 @@ SOURCES += \
HEADERS += \ HEADERS += \
plugin/plugintemplate.h \ plugin/plugintemplate.h \
plugin/qtmaterialplugins.h plugin/qtmaterialplugins.h
TARGET = $$qtLibraryTarget(qt-material-widget)
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
OBJECTS_DIR = $$PWD/../../qt-material-widgets-build/components/build/obj
MOC_DIR = $$PWD/../../qt-material-widgets-build/components/build/moc
RCC_DIR = $$PWD/../../qt-material-widgets-build/components/build/qrc
UI_DIR = $$PWD/../../qt-material-widgets-build/components/build/ui
DESTDIR = $$PWD/../../qt-material-widgets-build/components/lib

View File

@ -2,10 +2,11 @@
#define QTMATERIALCHECKABLE_H #define QTMATERIALCHECKABLE_H
#include <QtWidgets/QAbstractButton> #include <QtWidgets/QAbstractButton>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialCheckablePrivate; class QtMaterialCheckablePrivate;
class QtMaterialCheckable : public QAbstractButton class QDESIGNER_WIDGET_EXPORT QtMaterialCheckable : public QAbstractButton
{ {
Q_OBJECT Q_OBJECT
// Q_PROPERTY(LabelPosition labelPosition READ setLabelPosition WRITE labelPosition) // Q_PROPERTY(LabelPosition labelPosition READ setLabelPosition WRITE labelPosition)

View File

@ -2,8 +2,9 @@
#define QTMATERIALCONST_H #define QTMATERIALCONST_H
#include <QObject> #include <QObject>
#include <QtUiPlugin/QDesignerExportWidget>
class MaterialConst: public QObject class QDESIGNER_WIDGET_EXPORT MaterialConst: public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,8 +2,9 @@
#define QTMATERIALOVERLAYWIDGET_H #define QTMATERIALOVERLAYWIDGET_H
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialOverlayWidget : public QWidget class QDESIGNER_WIDGET_EXPORT QtMaterialOverlayWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -6,10 +6,11 @@
#include <QPropertyAnimation> #include <QPropertyAnimation>
#include <QPoint> #include <QPoint>
#include <QBrush> #include <QBrush>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialRippleOverlay; class QtMaterialRippleOverlay;
class QtMaterialRipple : public QParallelAnimationGroup class QDESIGNER_WIDGET_EXPORT QtMaterialRipple : public QParallelAnimationGroup
{ {
Q_OBJECT Q_OBJECT

View File

@ -3,10 +3,11 @@
#include <QPainterPath> #include <QPainterPath>
#include "lib/qtmaterialoverlaywidget.h" #include "lib/qtmaterialoverlaywidget.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialRipple; class QtMaterialRipple;
class QtMaterialRippleOverlay : public QtMaterialOverlayWidget class QDESIGNER_WIDGET_EXPORT QtMaterialRippleOverlay : public QtMaterialOverlayWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -3,13 +3,14 @@
#include <QtWidgets/QCommonStyle> #include <QtWidgets/QCommonStyle>
#include "lib/qtmaterialstyle_p.h" #include "lib/qtmaterialstyle_p.h"
#include <QtUiPlugin/QDesignerExportWidget>
#define MATERIAL_DISABLE_THEME_COLORS \ #define MATERIAL_DISABLE_THEME_COLORS \
if (d->useThemeColors == true) { d->useThemeColors = false; } if (d->useThemeColors == true) { d->useThemeColors = false; }
class QtMaterialTheme; class QtMaterialTheme;
class QtMaterialStyle : public QCommonStyle class QDESIGNER_WIDGET_EXPORT QtMaterialStyle : public QCommonStyle
{ {
Q_OBJECT Q_OBJECT

View File

@ -6,10 +6,11 @@
#include <QColor> #include <QColor>
#include <QIcon> #include <QIcon>
#include "qtmaterialconst.h" #include "qtmaterialconst.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialThemePrivate; class QtMaterialThemePrivate;
class QtMaterialTheme : public QObject class QDESIGNER_WIDGET_EXPORT QtMaterialTheme : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -1,6 +1,7 @@
COMP_PATH=$$PWD COMP_PATH=$$PWD
INCLUDEPATH += $$COMP_PATH INCLUDEPATH += $$COMP_PATH
DEFINES += QDESIGNER_EXPORT_WIDGETS
SOURCES += \ SOURCES += \
$$COMP_PATH/qtmaterialavatar.cpp \ $$COMP_PATH/qtmaterialavatar.cpp \

View File

@ -1,7 +1,7 @@
#ifndef QTMATERIALPLUGINS_H #ifndef QTMATERIALPLUGINS_H
#define QTMATERIALPLUGINS_H #define QTMATERIALPLUGINS_H
#include <QDesignerCustomWidgetCollectionInterface> #include <QtUiPlugin/QDesignerCustomWidgetCollectionInterface>
#include "plugintemplate.h" #include "plugintemplate.h"
#include "qtmaterialappbar.h" #include "qtmaterialappbar.h"
#include "qtmaterialautocomplete.h" #include "qtmaterialautocomplete.h"

View File

@ -3,10 +3,11 @@
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
#include <QtWidgets/QHBoxLayout> #include <QtWidgets/QHBoxLayout>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialAppBarPrivate; class QtMaterialAppBarPrivate;
class QtMaterialAppBar : public QWidget class QDESIGNER_WIDGET_EXPORT QtMaterialAppBar : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,10 +2,11 @@
#define QTMATERIALAUTOCOMPLETE_H #define QTMATERIALAUTOCOMPLETE_H
#include "qtmaterialtextfield.h" #include "qtmaterialtextfield.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialAutoCompletePrivate; class QtMaterialAutoCompletePrivate;
class QtMaterialAutoComplete : public QtMaterialTextField class QDESIGNER_WIDGET_EXPORT QtMaterialAutoComplete : public QtMaterialTextField
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QStringList dataSource WRITE setDataSource READ dataSource) Q_PROPERTY(QStringList dataSource WRITE setDataSource READ dataSource)

View File

@ -3,10 +3,11 @@
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
#include "lib/qtmaterialtheme.h" #include "lib/qtmaterialtheme.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialAvatarPrivate; class QtMaterialAvatarPrivate;
class QtMaterialAvatar : public QWidget class QDESIGNER_WIDGET_EXPORT QtMaterialAvatar : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -3,10 +3,11 @@
#include "lib/qtmaterialoverlaywidget.h" #include "lib/qtmaterialoverlaywidget.h"
#include <QIcon> #include <QIcon>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialBadgePrivate; class QtMaterialBadgePrivate;
class QtMaterialBadge : public QtMaterialOverlayWidget class QDESIGNER_WIDGET_EXPORT QtMaterialBadge : public QtMaterialOverlayWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,10 +2,11 @@
#define QTMATERIALCHECKBOX_H #define QTMATERIALCHECKBOX_H
#include "lib/qtmaterialcheckable.h" #include "lib/qtmaterialcheckable.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialCheckBoxPrivate; class QtMaterialCheckBoxPrivate;
class QtMaterialCheckBox : public QtMaterialCheckable class QDESIGNER_WIDGET_EXPORT QtMaterialCheckBox : public QtMaterialCheckable
{ {
Q_OBJECT Q_OBJECT

View File

@ -3,10 +3,11 @@
#include <QtWidgets/QProgressBar> #include <QtWidgets/QProgressBar>
#include "lib/qtmaterialtheme.h" #include "lib/qtmaterialtheme.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialCircularProgressPrivate; class QtMaterialCircularProgressPrivate;
class QtMaterialCircularProgress : public QProgressBar class QDESIGNER_WIDGET_EXPORT QtMaterialCircularProgress : public QProgressBar
{ {
Q_OBJECT Q_OBJECT

View File

@ -3,11 +3,12 @@
#include <QScopedPointer> #include <QScopedPointer>
#include "lib/qtmaterialoverlaywidget.h" #include "lib/qtmaterialoverlaywidget.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QLayout; class QLayout;
class QtMaterialDialogPrivate; class QtMaterialDialogPrivate;
class QtMaterialDialog : public QtMaterialOverlayWidget class QDESIGNER_WIDGET_EXPORT QtMaterialDialog : public QtMaterialOverlayWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,11 +2,12 @@
#define QTMATERIALDRAWER_H #define QTMATERIALDRAWER_H
#include "lib/qtmaterialoverlaywidget.h" #include "lib/qtmaterialoverlaywidget.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialDrawerPrivate; class QtMaterialDrawerPrivate;
class QtMaterialDrawerStateMachine; class QtMaterialDrawerStateMachine;
class QtMaterialDrawer : public QtMaterialOverlayWidget class QDESIGNER_WIDGET_EXPORT QtMaterialDrawer : public QtMaterialOverlayWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,10 +2,11 @@
#define QTMATERIALFAB_H #define QTMATERIALFAB_H
#include "qtmaterialraisedbutton.h" #include "qtmaterialraisedbutton.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialFloatingActionButtonPrivate; class QtMaterialFloatingActionButtonPrivate;
class QtMaterialFloatingActionButton : public QtMaterialRaisedButton class QDESIGNER_WIDGET_EXPORT QtMaterialFloatingActionButton : public QtMaterialRaisedButton
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool mini WRITE setMini READ isMini) Q_PROPERTY(bool mini WRITE setMini READ isMini)

View File

@ -4,10 +4,11 @@
#include <QtWidgets/QPushButton> #include <QtWidgets/QPushButton>
#include <QScopedPointer> #include <QScopedPointer>
#include "lib/qtmaterialtheme.h" #include "lib/qtmaterialtheme.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialFlatButtonPrivate; class QtMaterialFlatButtonPrivate;
class QtMaterialFlatButton : public QPushButton class QDESIGNER_WIDGET_EXPORT QtMaterialFlatButton : public QPushButton
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QColor foregroundColor WRITE setForegroundColor READ foregroundColor) Q_PROPERTY(QColor foregroundColor WRITE setForegroundColor READ foregroundColor)

View File

@ -2,10 +2,11 @@
#define QTMATERIALICONBUTTON_H #define QTMATERIALICONBUTTON_H
#include <QtWidgets/QAbstractButton> #include <QtWidgets/QAbstractButton>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialIconButtonPrivate; class QtMaterialIconButtonPrivate;
class QtMaterialIconButton : public QAbstractButton class QDESIGNER_WIDGET_EXPORT QtMaterialIconButton : public QAbstractButton
{ {
Q_OBJECT Q_OBJECT
// Q_PROPERTY(bool useThemeColors READ setUseThemeColors WRITE useThemeColors) // Q_PROPERTY(bool useThemeColors READ setUseThemeColors WRITE useThemeColors)

View File

@ -3,6 +3,7 @@
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
#include <QtUiPlugin/QDesignerExportWidget> #include <QtUiPlugin/QDesignerExportWidget>
#include <QtUiPlugin/QDesignerExportWidget>
class QDESIGNER_WIDGET_EXPORT QtMaterialMenu : public QWidget class QDESIGNER_WIDGET_EXPORT QtMaterialMenu : public QWidget
{ {

View File

@ -3,10 +3,11 @@
#include <QtWidgets/QProgressBar> #include <QtWidgets/QProgressBar>
#include "lib/qtmaterialtheme.h" #include "lib/qtmaterialtheme.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialProgressPrivate; class QtMaterialProgressPrivate;
class QtMaterialProgress : public QProgressBar class QDESIGNER_WIDGET_EXPORT QtMaterialProgress : public QProgressBar
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,10 +2,11 @@
#define QTMATERIALRADIOBUTTON_H #define QTMATERIALRADIOBUTTON_H
#include "lib/qtmaterialcheckable.h" #include "lib/qtmaterialcheckable.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialRadioButtonPrivate; class QtMaterialRadioButtonPrivate;
class QtMaterialRadioButton : public QtMaterialCheckable class QDESIGNER_WIDGET_EXPORT QtMaterialRadioButton : public QtMaterialCheckable
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,10 +2,11 @@
#define QTMATERIALRAISEDBUTTON_H #define QTMATERIALRAISEDBUTTON_H
#include "qtmaterialflatbutton.h" #include "qtmaterialflatbutton.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialRaisedButtonPrivate; class QtMaterialRaisedButtonPrivate;
class QtMaterialRaisedButton : public QtMaterialFlatButton class QDESIGNER_WIDGET_EXPORT QtMaterialRaisedButton : public QtMaterialFlatButton
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,10 +2,11 @@
#define QTMATERIALSCROLLBAR_H #define QTMATERIALSCROLLBAR_H
#include <QtWidgets/QScrollBar> #include <QtWidgets/QScrollBar>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialScrollBarPrivate; class QtMaterialScrollBarPrivate;
class QtMaterialScrollBar : public QScrollBar class QDESIGNER_WIDGET_EXPORT QtMaterialScrollBar : public QScrollBar
{ {
Q_OBJECT Q_OBJECT

View File

@ -3,12 +3,13 @@
#include <QtWidgets/QAbstractSlider> #include <QtWidgets/QAbstractSlider>
#include <QScopedPointer> #include <QScopedPointer>
#include <QtUiPlugin/QDesignerExportWidget>
#define QT_MATERIAL_SLIDER_MARGIN 30 #define QT_MATERIAL_SLIDER_MARGIN 30
class QtMaterialSliderPrivate; class QtMaterialSliderPrivate;
class QtMaterialSlider : public QAbstractSlider class QDESIGNER_WIDGET_EXPORT QtMaterialSlider : public QAbstractSlider
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,10 +2,11 @@
#define QTMATERIALSNACKBAR_H #define QTMATERIALSNACKBAR_H
#include "lib/qtmaterialoverlaywidget.h" #include "lib/qtmaterialoverlaywidget.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialSnackbarPrivate; class QtMaterialSnackbarPrivate;
class QtMaterialSnackbar : public QtMaterialOverlayWidget class QDESIGNER_WIDGET_EXPORT QtMaterialSnackbar : public QtMaterialOverlayWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -4,11 +4,12 @@
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
#include <QIcon> #include <QIcon>
#include "lib/qtmaterialtheme.h" #include "lib/qtmaterialtheme.h"
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialTabsPrivate; class QtMaterialTabsPrivate;
class QtMaterialTab; class QtMaterialTab;
class QtMaterialTabs : public QWidget class QDESIGNER_WIDGET_EXPORT QtMaterialTabs : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,7 +2,7 @@ QT += core gui widgets
TEMPLATE = app TEMPLATE = app
CONFIG += c++11 CONFIG += c++11
#include(../components/link_components.pri) TARGET = examples-exe
SOURCES += mainwindow.cpp \ SOURCES += mainwindow.cpp \
main.cpp \ main.cpp \
@ -74,9 +74,18 @@ FORMS += \
appbarsettingsform.ui appbarsettingsform.ui
RESOURCES += \ RESOURCES += \
../components/material_res.qrc \
examples.qrc examples.qrc
LIBS += -L../components/ -lqt-material-widget OBJECTS_DIR = $$PWD/../../qt-material-widgets-build/examples/build/obj
INCLUDEPATH += $$top_srcdir/components/ MOC_DIR = $$PWD/../../qt-material-widgets-build/examples/build/moc
TARGET = examples-exe RCC_DIR = $$PWD/../../qt-material-widgets-build/examples/build/qrc
UI_DIR = $$PWD/../../qt-material-widgets-build/examples/build/ui
DESTDIR = $$PWD/../../qt-material-widgets-build/examples/bin
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../qt-material-widgets-build/components/lib/ -lqt-material-widget
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../qt-material-widgets-build/components/lib/ -lqt-material-widgetd
else:unix:!macx: LIBS += -L$$PWD/../../qt-material-widgets-build/components/lib/ -lqt-material-widget
INCLUDEPATH += $$PWD/../components
DEPENDPATH += $$PWD/../../qt-material-widgets-build/components

View File

@ -6,6 +6,7 @@ int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
Q_INIT_RESOURCE(examples);
Q_INIT_RESOURCE(material_res); Q_INIT_RESOURCE(material_res);
MainWindow window; MainWindow window;

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>907</width> <width>907</width>
<height>746</height> <height>849</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -202,7 +202,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>60</width> <width>60</width>
<height>54</height> <height>60</height>
</rect> </rect>
</property> </property>
<property name="relativePosition"> <property name="relativePosition">
@ -350,7 +350,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>60</width> <width>60</width>
<height>54</height> <height>60</height>
</rect> </rect>
</property> </property>
<property name="relativePosition"> <property name="relativePosition">
@ -650,7 +650,6 @@
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../components/material_res.qrc"/> <include location="../components/material_res.qrc"/>
<include location="../components/material_res.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -8,8 +8,3 @@ CONFIG += ordered
# depend on your compiler). Please consult the documentation of the # depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it. # deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0