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
- [ ] Subheaders
- [ ] 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
CONFIG += plugin release
CONFIG += plugin #release
TEMPLATE = lib
TARGET = $$qtLibraryTarget(qt-material-widget)
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
include(link_components.pri)
SOURCES += \
@ -13,3 +9,14 @@ SOURCES += \
HEADERS += \
plugin/plugintemplate.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
#include <QtWidgets/QAbstractButton>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialCheckablePrivate;
class QtMaterialCheckable : public QAbstractButton
class QDESIGNER_WIDGET_EXPORT QtMaterialCheckable : public QAbstractButton
{
Q_OBJECT
// Q_PROPERTY(LabelPosition labelPosition READ setLabelPosition WRITE labelPosition)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ QT += core gui widgets
TEMPLATE = app
CONFIG += c++11
#include(../components/link_components.pri)
TARGET = examples-exe
SOURCES += mainwindow.cpp \
main.cpp \
@ -74,9 +74,18 @@ FORMS += \
appbarsettingsform.ui
RESOURCES += \
../components/material_res.qrc \
examples.qrc
LIBS += -L../components/ -lqt-material-widget
INCLUDEPATH += $$top_srcdir/components/
TARGET = examples-exe
OBJECTS_DIR = $$PWD/../../qt-material-widgets-build/examples/build/obj
MOC_DIR = $$PWD/../../qt-material-widgets-build/examples/build/moc
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);
Q_INIT_RESOURCE(examples);
Q_INIT_RESOURCE(material_res);
MainWindow window;

View File

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

View File

@ -8,8 +8,3 @@ CONFIG += ordered
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
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