Add Qt Designer plugin for all supported widgets

This commit is contained in:
xuannt 2021-06-30 16:30:12 +07:00
parent 9cc62f6d87
commit 870736b072
56 changed files with 1640 additions and 720 deletions

View File

@ -1,147 +1,15 @@
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets designer
}
QT += widgets uiplugin designer
CONFIG += plugin release
TEMPLATE = lib
lessThan(QT_MAJOR_VERSION, 5) {
CONFIG += designer
}
CONFIG += plugin release
TEMPLATE = lib
TARGET = $$qtLibraryTarget(qt-material-widget)
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
INCLUDEPATH += .
SOURCES = \
plugin/materialtoggleplugin.cpp \
plugin/qtmaterialplugins.cpp \
qtmaterialavatar.cpp \
lib/qtmaterialstyle.cpp \
lib/qtmaterialtheme.cpp \
qtmaterialbadge.cpp \
lib/qtmaterialoverlaywidget.cpp \
qtmaterialcheckbox.cpp \
lib/qtmaterialcheckable_internal.cpp \
lib/qtmaterialcheckable.cpp \
lib/qtmaterialripple.cpp \
lib/qtmaterialrippleoverlay.cpp \
qtmaterialfab.cpp \
qtmaterialraisedbutton.cpp \
qtmaterialflatbutton_internal.cpp \
qtmaterialflatbutton.cpp \
lib/qtmaterialstatetransition.cpp \
qtmaterialiconbutton.cpp \
qtmaterialprogress_internal.cpp \
qtmaterialprogress.cpp \
qtmaterialcircularprogress_internal.cpp \
qtmaterialcircularprogress.cpp \
qtmaterialslider_internal.cpp \
qtmaterialslider.cpp \
qtmaterialsnackbar_internal.cpp \
qtmaterialsnackbar.cpp \
qtmaterialradiobutton.cpp \
qtmaterialtoggle_internal.cpp \
qtmaterialtoggle.cpp \
qtmaterialtextfield_internal.cpp \
qtmaterialtextfield.cpp \
qtmaterialtabs_internal.cpp \
qtmaterialtabs.cpp \
qtmaterialscrollbar_internal.cpp \
qtmaterialscrollbar.cpp \
qtmaterialdialog_internal.cpp \
qtmaterialdialog.cpp \
qtmaterialdrawer_internal.cpp \
qtmaterialdrawer.cpp \
qtmaterialappbar.cpp \
qtmaterialautocomplete.cpp \
qtmaterialpaper.cpp \
qtmaterialtable.cpp \
layouts/qtmaterialsnackbarlayout.cpp \
qtmaterialautocomplete_internal.cpp \
qtmaterialmenu.cpp \
qtmaterialmenu_internal.cpp \
qtmateriallist.cpp \
qtmateriallistitem.cpp
HEADERS = \
plugin/materialtoggleplugin.h \
plugin/qtmaterialplugins.h \
qtmaterialavatar_p.h \
qtmaterialavatar.h \
lib/qtmaterialstyle_p.h \
lib/qtmaterialstyle.h \
lib/qtmaterialtheme_p.h \
lib/qtmaterialtheme.h \
qtmaterialbadge_p.h \
qtmaterialbadge.h \
lib/qtmaterialoverlaywidget.h \
qtmaterialcheckbox_p.h \
qtmaterialcheckbox.h \
lib/qtmaterialcheckable_internal.h \
lib/qtmaterialcheckable_p.h \
lib/qtmaterialripple.h \
lib/qtmaterialrippleoverlay.h \
lib/qtmaterialcheckable.h \
qtmaterialfab_p.h \
qtmaterialfab.h \
qtmaterialraisedbutton_p.h \
qtmaterialraisedbutton.h \
qtmaterialflatbutton_internal.h \
qtmaterialflatbutton_p.h \
qtmaterialflatbutton.h \
lib/qtmaterialstatetransition.h \
lib/qtmaterialstatetransitionevent.h \
qtmaterialiconbutton_p.h \
qtmaterialiconbutton.h \
qtmaterialprogress_internal.h \
qtmaterialprogress_p.h \
qtmaterialprogress.h \
qtmaterialcircularprogress_internal.h \
qtmaterialcircularprogress_p.h \
qtmaterialcircularprogress.h \
qtmaterialslider_internal.h \
qtmaterialslider_p.h \
qtmaterialslider.h \
qtmaterialsnackbar_internal.h \
qtmaterialsnackbar_p.h \
qtmaterialsnackbar.h \
qtmaterialradiobutton_p.h \
qtmaterialradiobutton.h \
qtmaterialtoggle_internal.h \
qtmaterialtoggle_p.h \
qtmaterialtoggle.h \
qtmaterialtextfield_internal.h \
qtmaterialtextfield_p.h \
qtmaterialtextfield.h \
qtmaterialtabs_internal.h \
qtmaterialtabs_p.h \
qtmaterialtabs.h \
qtmaterialscrollbar_internal.h \
qtmaterialscrollbar_p.h \
qtmaterialscrollbar.h \
qtmaterialdialog_internal.h \
qtmaterialdialog_p.h \
qtmaterialdialog.h \
qtmaterialdrawer_internal.h \
qtmaterialdrawer_p.h \
qtmaterialdrawer.h \
qtmaterialappbar.h \
qtmaterialappbar_p.h \
qtmaterialautocomplete.h \
qtmaterialautocomplete_p.h \
qtmaterialpaper.h \
qtmaterialpaper_p.h \
qtmaterialtable.h \
qtmaterialtable_p.h \
layouts/qtmaterialsnackbarlayout.h \
layouts/qtmaterialsnackbarlayout_p.h \
qtmaterialautocomplete_internal.h \
qtmaterialmenu.h \
qtmaterialmenu_p.h \
qtmaterialmenu_internal.h \
qtmateriallist.h \
qtmateriallist_p.h \
qtmateriallistitem.h \
qtmateriallistitem_p.h
RESOURCES += \
material_res.qrc
include(link_components.pri)
SOURCES += \
plugin/qtmaterialplugins.cpp
HEADERS += \
plugin/plugintemplate.h \
plugin/qtmaterialplugins.h

View File

@ -8,12 +8,21 @@ class QtMaterialCheckablePrivate;
class QtMaterialCheckable : public QAbstractButton
{
Q_OBJECT
// Q_PROPERTY(LabelPosition labelPosition READ setLabelPosition WRITE labelPosition)
// Q_PROPERTY(bool useThemeColors READ setUseThemeColors WRITE useThemeColors)
// Q_PROPERTY(QColor checkedColor READ setCheckedColor WRITE checkedColor)
// Q_PROPERTY(QColor uncheckedColor READ setUncheckedColor WRITE uncheckedColor)
// Q_PROPERTY(QColor textColor READ setTextColor WRITE textColor)
// Q_PROPERTY(QColor disabledColor READ setDisabledColor WRITE disabledColor)
// Q_PROPERTY(QIcon checkedIcon READ setCheckedIcon WRITE checkedIcon)
// Q_PROPERTY(QIcon uncheckedIcon READ setUncheckedIcon WRITE uncheckedIcon)
public:
enum LabelPosition {
LabelPositionLeft,
LabelPositionRight,
};
Q_ENUM(LabelPosition)
explicit QtMaterialCheckable(QWidget *parent = 0);
~QtMaterialCheckable();

View File

@ -0,0 +1,328 @@
#ifndef QTMATERIALCONST_H
#define QTMATERIALCONST_H
#include <QObject>
class MaterialConst: public QObject
{
Q_OBJECT
public:
enum ButtonPreset {
FlatPreset,
CheckablePreset
};
Q_ENUM(ButtonPreset)
enum RippleStyle {
CenteredRipple,
PositionedRipple,
NoRipple
};
Q_ENUM(RippleStyle)
enum OverlayStyle {
NoOverlay = 0,
TintedOverlay,
GrayOverlay
};
Q_ENUM(OverlayStyle)
enum Role {
Default,
Primary,
Secondary
};
Q_ENUM(Role)
enum ButtonIconPlacement {
LeftIcon,
RightIcon
};
Q_ENUM(ButtonIconPlacement)
enum ProgressType {
DeterminateProgress,
IndeterminateProgress
};
Q_ENUM(ProgressType)
enum AvatarType {
ImageAvatar,
IconAvatar,
LetterAvatar
};
Q_ENUM(AvatarType)
enum Color {
red50,
red100,
red200,
red300,
red400,
red500,
red600,
red700,
red800,
red900,
redA100,
redA200,
redA400,
redA700,
pink50,
pink100,
pink200,
pink300,
pink400,
pink500,
pink600,
pink700,
pink800,
pink900,
pinkA100,
pinkA200,
pinkA400,
pinkA700,
purple50,
purple100,
purple200,
purple300,
purple400,
purple500,
purple600,
purple700,
purple800,
purple900,
purpleA100,
purpleA200,
purpleA400,
purpleA700,
deepPurple50,
deepPurple100,
deepPurple200,
deepPurple300,
deepPurple400,
deepPurple500,
deepPurple600,
deepPurple700,
deepPurple800,
deepPurple900,
deepPurpleA100,
deepPurpleA200,
deepPurpleA400,
deepPurpleA700,
indigo50,
indigo100,
indigo200,
indigo300,
indigo400,
indigo500,
indigo600,
indigo700,
indigo800,
indigo900,
indigoA100,
indigoA200,
indigoA400,
indigoA700,
blue50,
blue100,
blue200,
blue300,
blue400,
blue500,
blue600,
blue700,
blue800,
blue900,
blueA100,
blueA200,
blueA400,
blueA700,
lightBlue50,
lightBlue100,
lightBlue200,
lightBlue300,
lightBlue400,
lightBlue500,
lightBlue600,
lightBlue700,
lightBlue800,
lightBlue900,
lightBlueA100,
lightBlueA200,
lightBlueA400,
lightBlueA700,
cyan50,
cyan100,
cyan200,
cyan300,
cyan400,
cyan500,
cyan600,
cyan700,
cyan800,
cyan900,
cyanA100,
cyanA200,
cyanA400,
cyanA700,
teal50,
teal100,
teal200,
teal300,
teal400,
teal500,
teal600,
teal700,
teal800,
teal900,
tealA100,
tealA200,
tealA400,
tealA700,
green50,
green100,
green200,
green300,
green400,
green500,
green600,
green700,
green800,
green900,
greenA100,
greenA200,
greenA400,
greenA700,
lightGreen50,
lightGreen100,
lightGreen200,
lightGreen300,
lightGreen400,
lightGreen500,
lightGreen600,
lightGreen700,
lightGreen800,
lightGreen900,
lightGreenA100,
lightGreenA200,
lightGreenA400,
lightGreenA700,
lime50,
lime100,
lime200,
lime300,
lime400,
lime500,
lime600,
lime700,
lime800,
lime900,
limeA100,
limeA200,
limeA400,
limeA700,
yellow50,
yellow100,
yellow200,
yellow300,
yellow400,
yellow500,
yellow600,
yellow700,
yellow800,
yellow900,
yellowA100,
yellowA200,
yellowA400,
yellowA700,
amber50,
amber100,
amber200,
amber300,
amber400,
amber500,
amber600,
amber700,
amber800,
amber900,
amberA100,
amberA200,
amberA400,
amberA700,
orange50,
orange100,
orange200,
orange300,
orange400,
orange500,
orange600,
orange700,
orange800,
orange900,
orangeA100,
orangeA200,
orangeA400,
orangeA700,
deepOrange50,
deepOrange100,
deepOrange200,
deepOrange300,
deepOrange400,
deepOrange500,
deepOrange600,
deepOrange700,
deepOrange800,
deepOrange900,
deepOrangeA100,
deepOrangeA200,
deepOrangeA400,
deepOrangeA700,
brown50,
brown100,
brown200,
brown300,
brown400,
brown500,
brown600,
brown700,
brown800,
brown900,
blueGrey50,
blueGrey100,
blueGrey200,
blueGrey300,
blueGrey400,
blueGrey500,
blueGrey600,
blueGrey700,
blueGrey800,
blueGrey900,
grey50,
grey100,
grey200,
grey300,
grey400,
grey500,
grey600,
grey700,
grey800,
grey900,
black,
white,
transparent,
fullBlack,
darkBlack,
lightBlack,
minBlack,
faintBlack,
fullWhite,
darkWhite,
lightWhite
};
Q_ENUM(Color)
};
#endif // QTMATERIALCONST_H

View File

@ -33,19 +33,19 @@ QtMaterialTheme::QtMaterialTheme(QObject *parent)
: QObject(parent),
d_ptr(new QtMaterialThemePrivate(this))
{
setColor("primary1", Material::cyan500);
setColor("primary2", Material::cyan700);
setColor("primary3", Material::lightBlack);
setColor("accent1", Material::pinkA200);
setColor("accent2", Material::grey100);
setColor("accent3", Material::grey500);
setColor("text", Material::darkBlack);
setColor("alternateText", Material::white);
setColor("canvas", Material::white);
setColor("border", Material::grey300);
setColor("disabled", Material::minBlack);
setColor("disabled2", Material::faintBlack);
setColor("disabled3", Material::grey300);
setColor("primary1", MaterialConst::cyan500);
setColor("primary2", MaterialConst::cyan700);
setColor("primary3", MaterialConst::lightBlack);
setColor("accent1", MaterialConst::pinkA200);
setColor("accent2", MaterialConst::grey100);
setColor("accent3", MaterialConst::grey500);
setColor("text", MaterialConst::darkBlack);
setColor("alternateText", MaterialConst::white);
setColor("canvas", MaterialConst::white);
setColor("border", MaterialConst::grey300);
setColor("disabled", MaterialConst::minBlack);
setColor("disabled2", MaterialConst::faintBlack);
setColor("disabled3", MaterialConst::grey300);
}
QtMaterialTheme::~QtMaterialTheme()
@ -70,7 +70,7 @@ void QtMaterialTheme::setColor(const QString &key, const QColor &color)
d->colors.insert(key, color);
}
void QtMaterialTheme::setColor(const QString &key, Material::Color color)
void QtMaterialTheme::setColor(const QString &key, MaterialConst::Color color)
{
Q_D(QtMaterialTheme);

View File

@ -5,316 +5,7 @@
#include <QScopedPointer>
#include <QColor>
#include <QIcon>
namespace Material
{
enum ButtonPreset {
FlatPreset,
CheckablePreset
};
enum RippleStyle {
CenteredRipple,
PositionedRipple,
NoRipple
};
enum OverlayStyle {
NoOverlay,
TintedOverlay,
GrayOverlay
};
enum Role {
Default,
Primary,
Secondary
};
enum ButtonIconPlacement {
LeftIcon,
RightIcon
};
enum ProgressType {
DeterminateProgress,
IndeterminateProgress
};
enum AvatarType {
ImageAvatar,
IconAvatar,
LetterAvatar
};
enum Color {
red50,
red100,
red200,
red300,
red400,
red500,
red600,
red700,
red800,
red900,
redA100,
redA200,
redA400,
redA700,
pink50,
pink100,
pink200,
pink300,
pink400,
pink500,
pink600,
pink700,
pink800,
pink900,
pinkA100,
pinkA200,
pinkA400,
pinkA700,
purple50,
purple100,
purple200,
purple300,
purple400,
purple500,
purple600,
purple700,
purple800,
purple900,
purpleA100,
purpleA200,
purpleA400,
purpleA700,
deepPurple50,
deepPurple100,
deepPurple200,
deepPurple300,
deepPurple400,
deepPurple500,
deepPurple600,
deepPurple700,
deepPurple800,
deepPurple900,
deepPurpleA100,
deepPurpleA200,
deepPurpleA400,
deepPurpleA700,
indigo50,
indigo100,
indigo200,
indigo300,
indigo400,
indigo500,
indigo600,
indigo700,
indigo800,
indigo900,
indigoA100,
indigoA200,
indigoA400,
indigoA700,
blue50,
blue100,
blue200,
blue300,
blue400,
blue500,
blue600,
blue700,
blue800,
blue900,
blueA100,
blueA200,
blueA400,
blueA700,
lightBlue50,
lightBlue100,
lightBlue200,
lightBlue300,
lightBlue400,
lightBlue500,
lightBlue600,
lightBlue700,
lightBlue800,
lightBlue900,
lightBlueA100,
lightBlueA200,
lightBlueA400,
lightBlueA700,
cyan50,
cyan100,
cyan200,
cyan300,
cyan400,
cyan500,
cyan600,
cyan700,
cyan800,
cyan900,
cyanA100,
cyanA200,
cyanA400,
cyanA700,
teal50,
teal100,
teal200,
teal300,
teal400,
teal500,
teal600,
teal700,
teal800,
teal900,
tealA100,
tealA200,
tealA400,
tealA700,
green50,
green100,
green200,
green300,
green400,
green500,
green600,
green700,
green800,
green900,
greenA100,
greenA200,
greenA400,
greenA700,
lightGreen50,
lightGreen100,
lightGreen200,
lightGreen300,
lightGreen400,
lightGreen500,
lightGreen600,
lightGreen700,
lightGreen800,
lightGreen900,
lightGreenA100,
lightGreenA200,
lightGreenA400,
lightGreenA700,
lime50,
lime100,
lime200,
lime300,
lime400,
lime500,
lime600,
lime700,
lime800,
lime900,
limeA100,
limeA200,
limeA400,
limeA700,
yellow50,
yellow100,
yellow200,
yellow300,
yellow400,
yellow500,
yellow600,
yellow700,
yellow800,
yellow900,
yellowA100,
yellowA200,
yellowA400,
yellowA700,
amber50,
amber100,
amber200,
amber300,
amber400,
amber500,
amber600,
amber700,
amber800,
amber900,
amberA100,
amberA200,
amberA400,
amberA700,
orange50,
orange100,
orange200,
orange300,
orange400,
orange500,
orange600,
orange700,
orange800,
orange900,
orangeA100,
orangeA200,
orangeA400,
orangeA700,
deepOrange50,
deepOrange100,
deepOrange200,
deepOrange300,
deepOrange400,
deepOrange500,
deepOrange600,
deepOrange700,
deepOrange800,
deepOrange900,
deepOrangeA100,
deepOrangeA200,
deepOrangeA400,
deepOrangeA700,
brown50,
brown100,
brown200,
brown300,
brown400,
brown500,
brown600,
brown700,
brown800,
brown900,
blueGrey50,
blueGrey100,
blueGrey200,
blueGrey300,
blueGrey400,
blueGrey500,
blueGrey600,
blueGrey700,
blueGrey800,
blueGrey900,
grey50,
grey100,
grey200,
grey300,
grey400,
grey500,
grey600,
grey700,
grey800,
grey900,
black,
white,
transparent,
fullBlack,
darkBlack,
lightBlack,
minBlack,
faintBlack,
fullWhite,
darkWhite,
lightWhite
};
}
#include "qtmaterialconst.h"
class QtMaterialThemePrivate;
@ -329,7 +20,7 @@ public:
QColor getColor(const QString &key) const;
void setColor(const QString &key, const QColor &color);
void setColor(const QString &key, Material::Color color);
void setColor(const QString &key, MaterialConst::Color color);
static QIcon icon(QString category, QString icon);

View File

@ -0,0 +1,134 @@
COMP_PATH=$$PWD
INCLUDEPATH += $$COMP_PATH
SOURCES += \
$$COMP_PATH/qtmaterialavatar.cpp \
$$COMP_PATH/lib/qtmaterialstyle.cpp \
$$COMP_PATH/lib/qtmaterialtheme.cpp \
$$COMP_PATH/qtmaterialbadge.cpp \
$$COMP_PATH/lib/qtmaterialoverlaywidget.cpp \
$$COMP_PATH/qtmaterialcheckbox.cpp \
$$COMP_PATH/lib/qtmaterialcheckable_internal.cpp \
$$COMP_PATH/lib/qtmaterialcheckable.cpp \
$$COMP_PATH/lib/qtmaterialripple.cpp \
$$COMP_PATH/lib/qtmaterialrippleoverlay.cpp \
$$COMP_PATH/qtmaterialfab.cpp \
$$COMP_PATH/qtmaterialraisedbutton.cpp \
$$COMP_PATH/qtmaterialflatbutton_internal.cpp \
$$COMP_PATH/qtmaterialflatbutton.cpp \
$$COMP_PATH/lib/qtmaterialstatetransition.cpp \
$$COMP_PATH/qtmaterialiconbutton.cpp \
$$COMP_PATH/qtmaterialprogress_internal.cpp \
$$COMP_PATH/qtmaterialprogress.cpp \
$$COMP_PATH/qtmaterialcircularprogress_internal.cpp \
$$COMP_PATH/qtmaterialcircularprogress.cpp \
$$COMP_PATH/qtmaterialslider_internal.cpp \
$$COMP_PATH/qtmaterialslider.cpp \
$$COMP_PATH/qtmaterialsnackbar_internal.cpp \
$$COMP_PATH/qtmaterialsnackbar.cpp \
$$COMP_PATH/qtmaterialradiobutton.cpp \
$$COMP_PATH/qtmaterialtoggle_internal.cpp \
$$COMP_PATH/qtmaterialtoggle.cpp \
$$COMP_PATH/qtmaterialtextfield_internal.cpp \
$$COMP_PATH/qtmaterialtextfield.cpp \
$$COMP_PATH/qtmaterialtabs_internal.cpp \
$$COMP_PATH/qtmaterialtabs.cpp \
$$COMP_PATH/qtmaterialscrollbar_internal.cpp \
$$COMP_PATH/qtmaterialscrollbar.cpp \
$$COMP_PATH/qtmaterialdialog_internal.cpp \
$$COMP_PATH/qtmaterialdialog.cpp \
$$COMP_PATH/qtmaterialdrawer_internal.cpp \
$$COMP_PATH/qtmaterialdrawer.cpp \
$$COMP_PATH/qtmaterialappbar.cpp \
$$COMP_PATH/qtmaterialautocomplete.cpp \
$$COMP_PATH/qtmaterialpaper.cpp \
$$COMP_PATH/qtmaterialtable.cpp \
$$COMP_PATH/layouts/qtmaterialsnackbarlayout.cpp \
$$COMP_PATH/qtmaterialautocomplete_internal.cpp \
$$COMP_PATH/qtmaterialmenu.cpp \
$$COMP_PATH/qtmaterialmenu_internal.cpp \
$$COMP_PATH/qtmateriallist.cpp \
$$COMP_PATH/qtmateriallistitem.cpp
HEADERS += \
$$COMP_PATH/qtmaterialavatar_p.h \
$$COMP_PATH/qtmaterialavatar.h \
$$COMP_PATH/lib/qtmaterialstyle_p.h \
$$COMP_PATH/lib/qtmaterialstyle.h \
$$COMP_PATH/lib/qtmaterialtheme_p.h \
$$COMP_PATH/lib/qtmaterialtheme.h \
$$COMP_PATH/qtmaterialbadge_p.h \
$$COMP_PATH/qtmaterialbadge.h \
$$COMP_PATH/lib/qtmaterialoverlaywidget.h \
$$COMP_PATH/qtmaterialcheckbox_p.h \
$$COMP_PATH/qtmaterialcheckbox.h \
$$COMP_PATH/lib/qtmaterialcheckable_internal.h \
$$COMP_PATH/lib/qtmaterialcheckable_p.h \
$$COMP_PATH/lib/qtmaterialripple.h \
$$COMP_PATH/lib/qtmaterialrippleoverlay.h \
$$COMP_PATH/lib/qtmaterialcheckable.h \
$$COMP_PATH/qtmaterialfab_p.h \
$$COMP_PATH/qtmaterialfab.h \
$$COMP_PATH/qtmaterialraisedbutton_p.h \
$$COMP_PATH/qtmaterialraisedbutton.h \
$$COMP_PATH/qtmaterialflatbutton_internal.h \
$$COMP_PATH/qtmaterialflatbutton_p.h \
$$COMP_PATH/qtmaterialflatbutton.h \
$$COMP_PATH/lib/qtmaterialstatetransition.h \
$$COMP_PATH/lib/qtmaterialstatetransitionevent.h \
$$COMP_PATH/qtmaterialiconbutton_p.h \
$$COMP_PATH/qtmaterialiconbutton.h \
$$COMP_PATH/qtmaterialprogress_internal.h \
$$COMP_PATH/qtmaterialprogress_p.h \
$$COMP_PATH/qtmaterialprogress.h \
$$COMP_PATH/qtmaterialcircularprogress_internal.h \
$$COMP_PATH/qtmaterialcircularprogress_p.h \
$$COMP_PATH/qtmaterialcircularprogress.h \
$$COMP_PATH/qtmaterialslider_internal.h \
$$COMP_PATH/qtmaterialslider_p.h \
$$COMP_PATH/qtmaterialslider.h \
$$COMP_PATH/qtmaterialsnackbar_internal.h \
$$COMP_PATH/qtmaterialsnackbar_p.h \
$$COMP_PATH/qtmaterialsnackbar.h \
$$COMP_PATH/qtmaterialradiobutton_p.h \
$$COMP_PATH/qtmaterialradiobutton.h \
$$COMP_PATH/qtmaterialtoggle_internal.h \
$$COMP_PATH/qtmaterialtoggle_p.h \
$$COMP_PATH/qtmaterialtoggle.h \
$$COMP_PATH/qtmaterialtextfield_internal.h \
$$COMP_PATH/qtmaterialtextfield_p.h \
$$COMP_PATH/qtmaterialtextfield.h \
$$COMP_PATH/qtmaterialtabs_internal.h \
$$COMP_PATH/qtmaterialtabs_p.h \
$$COMP_PATH/qtmaterialtabs.h \
$$COMP_PATH/qtmaterialscrollbar_internal.h \
$$COMP_PATH/qtmaterialscrollbar_p.h \
$$COMP_PATH/qtmaterialscrollbar.h \
$$COMP_PATH/qtmaterialdialog_internal.h \
$$COMP_PATH/qtmaterialdialog_p.h \
$$COMP_PATH/qtmaterialdialog.h \
$$COMP_PATH/qtmaterialdrawer_internal.h \
$$COMP_PATH/qtmaterialdrawer_p.h \
$$COMP_PATH/qtmaterialdrawer.h \
$$COMP_PATH/qtmaterialappbar.h \
$$COMP_PATH/qtmaterialappbar_p.h \
$$COMP_PATH/qtmaterialautocomplete.h \
$$COMP_PATH/qtmaterialautocomplete_p.h \
$$COMP_PATH/qtmaterialpaper.h \
$$COMP_PATH/qtmaterialpaper_p.h \
$$COMP_PATH/qtmaterialtable.h \
$$COMP_PATH/qtmaterialtable_p.h \
$$COMP_PATH/layouts/qtmaterialsnackbarlayout.h \
$$COMP_PATH/layouts/qtmaterialsnackbarlayout_p.h \
$$COMP_PATH/qtmaterialautocomplete_internal.h \
$$COMP_PATH/qtmaterialmenu.h \
$$COMP_PATH/qtmaterialmenu_p.h \
$$COMP_PATH/qtmaterialmenu_internal.h \
$$COMP_PATH/qtmateriallist.h \
$$COMP_PATH/qtmateriallist_p.h \
$$COMP_PATH/qtmateriallistitem.h \
$$COMP_PATH/qtmateriallistitem_p.h \
$$PWD/lib/qtmaterialconst.h
RESOURCES += \
$$COMP_PATH/material_res.qrc

View File

@ -0,0 +1,6 @@
#include "materialmenuplugin.h"
MaterialMenuPlugin::MaterialMenuPlugin(QObject *parent) : QObject(parent)
{
}

View File

@ -0,0 +1,16 @@
#ifndef MATERIALMENUPLUGIN_H
#define MATERIALMENUPLUGIN_H
#include <QObject>
class MaterialMenuPlugin : public QObject
{
Q_OBJECT
public:
explicit MaterialMenuPlugin(QObject *parent = nullptr);
signals:
};
#endif // MATERIALMENUPLUGIN_H

View File

@ -0,0 +1,6 @@
#include "materialtextfieldplugin.h"
MaterialTextFieldPlugin::MaterialTextFieldPlugin(QObject *parent) : QObject(parent)
{
}

View File

@ -0,0 +1,16 @@
#ifndef MATERIALTEXTFIELDPLUGIN_H
#define MATERIALTEXTFIELDPLUGIN_H
#include <QObject>
class MaterialTextFieldPlugin : public QObject
{
Q_OBJECT
public:
explicit MaterialTextFieldPlugin(QObject *parent = nullptr);
signals:
};
#endif // MATERIALTEXTFIELDPLUGIN_H

View File

@ -1,62 +0,0 @@
#include "materialtoggleplugin.h"
#include "qtmaterialtoggle.h"
#include <QtPlugin>
MaterialTogglePlugin::
MaterialTogglePlugin(QObject* parent) :
QObject(parent),
initialized(false)
{
}
QString MaterialTogglePlugin::
name() const
{
return "Material Toggle";
}
QString MaterialTogglePlugin::
group() const
{
return tr("Qt Meterial Widgets");
}
QString MaterialTogglePlugin::
toolTip() const
{
return tr("Material toggle button");
}
QString MaterialTogglePlugin::
whatsThis() const
{
return tr("Material toggle button");
}
QString MaterialTogglePlugin::
includeFile() const
{
return "qtmaterialtoggle.h";
}
QIcon MaterialTogglePlugin::
icon() const
{
return QIcon();
}
bool MaterialTogglePlugin::
isContainer() const
{
return false;
}
QWidget * MaterialTogglePlugin::
createWidget(QWidget *parent)
{
return new QtMaterialToggle(parent);
}
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
Q_EXPORT_PLUGIN2(MaterialTogglePlugin, MaterialTogglePlugin)
#endif

View File

@ -1,27 +0,0 @@
#ifndef MATERIALTOGGLEPLUGIN_H
#define MATERIALTOGGLEPLUGIN_H
#include <QDesignerCustomWidgetInterface>
class MaterialTogglePlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
public:
explicit MaterialTogglePlugin(QObject *parent = nullptr);
QString name() const;
QString group() const;
QString toolTip() const;
QString whatsThis() const;
QString includeFile() const;
QIcon icon() const;
bool isContainer() const;
QWidget *createWidget(QWidget *parent);
private:
bool initialized;
};
#endif // MATERIALTOGGLEPLUGIN_H

View File

@ -0,0 +1,33 @@
#ifndef PLUGINTEMPLATE_H
#define PLUGINTEMPLATE_H
#define QT_DESIGN_PLUGIN(pluginName, headerFile, className) \
class pluginName : public QObject, public QDesignerCustomWidgetInterface \
{ \
Q_OBJECT \
public: \
explicit pluginName(QObject *parent = nullptr):QObject(parent) {} \
\
QString name() const override { return #className; } \
QString group() const override { return "Qt Material Widgets"; } \
QString toolTip() const override { return QString(); } \
QString whatsThis() const override { return QString(); } \
QString includeFile() const override { return headerFile; } \
QIcon icon() const override { return QIcon(); } \
\
QWidget *createWidget(QWidget *parent) override { return new className(parent); } \
bool isContainer() const override { return true; } \
bool isInitialized() const override { return initialized; } \
void initialize(QDesignerFormEditorInterface * /*core*/) override { \
if (initialized) \
return; \
\
initialized = true; \
} \
\
private: \
bool initialized; \
}; \
#endif // PLUGINTEMPLATE_H

View File

@ -1,9 +1,33 @@
#include "qtmaterialplugins.h"
#include "materialtoggleplugin.h"
QtMaterialPlugins::QtMaterialPlugins(QObject *parent) : QObject(parent)
{
m_plugins << new MaterialTogglePlugin(this);
m_plugins << new MaterialAppBarPlugin(this)
<< new MaterialAutoCompletePlugin(this)
<< new MaterialAvatarPlugin(this)
<< new MaterialBadgePlugin(this)
<< new MaterialCheckBoxPlugin(this)
<< new MaterialCircularProgressPlugin(this)
<< new MaterialDialogPlugin(this)
<< new MaterialDrawerPlugin(this)
<< new MaterialFabPlugin(this)
<< new MaterialFlatButtonPlugin(this)
<< new MaterialIconButtonPlugin(this)
//// << new MaterialListPlugin(this)
//// << new MaterialListItemPlugin(this)
// << new MaterialMenuPlugin(this)
//// << new MaterialPaperPlugin(this)
<< new MaterialProgressPlugin(this)
<< new MaterialRadioButtonPlugin(this)
<< new MaterialRaisedButtonPlugin(this)
// << new MaterialScrollbarPlugin(this)
<< new MaterialSliderPlugin(this)
<< new MaterialSnackbarPlugin(this)
//// << new MaterialTablePlugin(this)
<< new MaterialTabsPlugin(this)
<< new MaterialTextFieldPlugin(this)
<< new MaterialTogglePlugin(this)
;
}
QList<QDesignerCustomWidgetInterface*> QtMaterialPlugins::customWidgets() const {

View File

@ -2,6 +2,58 @@
#define QTMATERIALPLUGINS_H
#include <QDesignerCustomWidgetCollectionInterface>
#include "plugintemplate.h"
#include "qtmaterialappbar.h"
#include "qtmaterialautocomplete.h"
#include "qtmaterialavatar.h"
#include "qtmaterialbadge.h"
#include "qtmaterialcheckbox.h"
#include "qtmaterialcircularprogress.h"
#include "qtmaterialdialog.h"
#include "qtmaterialdrawer.h"
#include "qtmaterialfab.h"
#include "qtmaterialflatbutton.h"
#include "qtmaterialiconbutton.h"
#include "qtmateriallist.h"
#include "qtmateriallistitem.h"
#include "qtmaterialmenu.h"
#include "qtmaterialpaper.h"
#include "qtmaterialprogress.h"
#include "qtmaterialradiobutton.h"
#include "qtmaterialraisedbutton.h"
#include "qtmaterialscrollbar.h"
#include "qtmaterialslider.h"
#include "qtmaterialsnackbar.h"
#include "qtmaterialtable.h"
#include "qtmaterialtabs.h"
#include "qtmaterialtextfield.h"
#include "qtmaterialtoggle.h"
QT_DESIGN_PLUGIN(MaterialAppBarPlugin , "qtmaterialappbar.h" , QtMaterialAppBar )
QT_DESIGN_PLUGIN(MaterialAutoCompletePlugin , "qtmaterialautocomplete.h" , QtMaterialAutoComplete )
QT_DESIGN_PLUGIN(MaterialAvatarPlugin , "qtmaterialavatar.h" , QtMaterialAvatar )
QT_DESIGN_PLUGIN(MaterialBadgePlugin , "qtmaterialbadge.h" , QtMaterialBadge )
QT_DESIGN_PLUGIN(MaterialCheckBoxPlugin , "qtmaterialcheckbox.h" , QtMaterialCheckBox )
QT_DESIGN_PLUGIN(MaterialCircularProgressPlugin, "qtmaterialcircularprogress.h", QtMaterialCircularProgress)
QT_DESIGN_PLUGIN(MaterialDialogPlugin , "qtmaterialdialog.h" , QtMaterialDialog )
QT_DESIGN_PLUGIN(MaterialDrawerPlugin , "qtmaterialdrawer.h" , QtMaterialDrawer )
QT_DESIGN_PLUGIN(MaterialFabPlugin , "qtmaterialfab.h" , QtMaterialFloatingActionButton)
QT_DESIGN_PLUGIN(MaterialFlatButtonPlugin , "qtmaterialflatbutton.h" , QtMaterialFlatButton )
QT_DESIGN_PLUGIN(MaterialIconButtonPlugin , "qtmaterialiconbutton.h" , QtMaterialIconButton )
//QT_DESIGN_PLUGIN(MaterialListPlugin , "qtmateriallist.h" , QtMaterialList )
//QT_DESIGN_PLUGIN(MaterialListItemPlugin , "qtmateriallistitem.h" , QtMaterialListItem )
QT_DESIGN_PLUGIN(MaterialMenuPlugin , "qtmaterialmenu.h" , QtMaterialMenu )
//QT_DESIGN_PLUGIN(MaterialPaperPlugin , "qtmaterialpaper.h" , QtMaterialPaper )
QT_DESIGN_PLUGIN(MaterialProgressPlugin , "qtmaterialprogress.h" , QtMaterialProgress )
QT_DESIGN_PLUGIN(MaterialRadioButtonPlugin , "qtmaterialradiobutton.h" , QtMaterialRadioButton )
QT_DESIGN_PLUGIN(MaterialRaisedButtonPlugin , "qtmaterialraisedbutton.h" , QtMaterialRaisedButton )
QT_DESIGN_PLUGIN(MaterialScrollbarPlugin , "qtmaterialscrollbar.h" , QtMaterialScrollBar )
QT_DESIGN_PLUGIN(MaterialSliderPlugin , "qtmaterialslider.h" , QtMaterialSlider )
QT_DESIGN_PLUGIN(MaterialSnackbarPlugin , "qtmaterialsnackbar.h" , QtMaterialSnackbar )
//QT_DESIGN_PLUGIN(MaterialTablePlugin , "qtmaterialtable.h" , QtMaterialTable )
QT_DESIGN_PLUGIN(MaterialTabsPlugin , "qtmaterialtabs.h" , QtMaterialTabs )
QT_DESIGN_PLUGIN(MaterialTextFieldPlugin , "qtmaterialtextfield.h" , QtMaterialTextField )
QT_DESIGN_PLUGIN(MaterialTogglePlugin , "qtmaterialtoggle.h" , QtMaterialToggle )
class QtMaterialPlugins : public QObject, public QDesignerCustomWidgetCollectionInterface
{

View File

@ -89,6 +89,12 @@ void QtMaterialAutoComplete::setDataSource(const QStringList &data)
update();
}
QStringList QtMaterialAutoComplete::dataSource() const
{
Q_D(const QtMaterialAutoComplete);
return d->dataSource;
}
void QtMaterialAutoComplete::updateResults(QString text)
{
Q_D(QtMaterialAutoComplete);
@ -117,7 +123,7 @@ void QtMaterialAutoComplete::updateResults(QString text)
item->setCornerRadius(0);
item->setHaloVisible(false);
item->setFixedHeight(50);
item->setOverlayStyle(Material::TintedOverlay);
item->setOverlayStyle(MaterialConst::TintedOverlay);
d->menuLayout->addWidget(item);
item->installEventFilter(this);
}

View File

@ -8,12 +8,14 @@ class QtMaterialAutoCompletePrivate;
class QtMaterialAutoComplete : public QtMaterialTextField
{
Q_OBJECT
Q_PROPERTY(QStringList dataSource WRITE setDataSource READ dataSource)
public:
explicit QtMaterialAutoComplete(QWidget *parent = 0);
~QtMaterialAutoComplete();
void setDataSource(const QStringList &data);
QStringList dataSource() const;
signals:
void itemSelected(QString);

View File

@ -32,7 +32,7 @@ void QtMaterialAvatarPrivate::init()
Q_Q(QtMaterialAvatar);
size = 40;
type = Material::LetterAvatar;
type = MaterialConst::LetterAvatar;
useThemeColors = true;
QFont font(q->font());
@ -188,16 +188,22 @@ void QtMaterialAvatar::setLetter(const QChar &letter)
Q_D(QtMaterialAvatar);
d->letter = letter;
d->type = Material::LetterAvatar;
d->type = MaterialConst::LetterAvatar;
update();
}
QChar QtMaterialAvatar::letter() const
{
Q_D(const QtMaterialAvatar);
return d->letter;
}
void QtMaterialAvatar::setImage(const QImage &image)
{
Q_D(QtMaterialAvatar);
d->image = image;
d->type = Material::ImageAvatar;
d->type = MaterialConst::ImageAvatar;
d->pixmap = QPixmap::fromImage(image.scaled(d->size, d->size,
Qt::IgnoreAspectRatio,
@ -205,16 +211,28 @@ void QtMaterialAvatar::setImage(const QImage &image)
update();
}
QImage QtMaterialAvatar::image() const
{
Q_D(const QtMaterialAvatar);
return d->image;
}
void QtMaterialAvatar::setIcon(const QIcon &icon)
{
Q_D(QtMaterialAvatar);
d->icon = icon;
d->type = Material::IconAvatar;
d->type = MaterialConst::IconAvatar;
update();
}
Material::AvatarType QtMaterialAvatar::type() const
QIcon QtMaterialAvatar::icon() const
{
Q_D(const QtMaterialAvatar);
return d->icon;
}
MaterialConst::AvatarType QtMaterialAvatar::type() const
{
Q_D(const QtMaterialAvatar);
@ -248,7 +266,7 @@ void QtMaterialAvatar::paintEvent(QPaintEvent *event)
return;
}
if (Material::ImageAvatar != d->type)
if (MaterialConst::ImageAvatar != d->type)
{
QBrush brush;
brush.setStyle(Qt::SolidPattern);
@ -261,7 +279,7 @@ void QtMaterialAvatar::paintEvent(QPaintEvent *event)
switch (d->type)
{
case Material::ImageAvatar:
case MaterialConst::ImageAvatar:
{
QPainterPath path;
path.addEllipse(width()/2-hs, height()/2-hs, d->size, d->size);
@ -271,7 +289,7 @@ void QtMaterialAvatar::paintEvent(QPaintEvent *event)
d->pixmap);
break;
}
case Material::IconAvatar:
case MaterialConst::IconAvatar:
{
QRect iconGeometry((width()-hs)/2, (height()-hs)/2, hs, hs);
QPixmap pixmap = d->icon.pixmap(hs, hs);
@ -281,7 +299,7 @@ void QtMaterialAvatar::paintEvent(QPaintEvent *event)
painter.drawPixmap(iconGeometry, pixmap);
break;
}
case Material::LetterAvatar:
case MaterialConst::LetterAvatar:
{
painter.setPen(textColor());
painter.setBrush(Qt::NoBrush);

View File

@ -10,6 +10,13 @@ class QtMaterialAvatar : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
Q_PROPERTY(int size WRITE setSize READ size)
Q_PROPERTY(QChar letter WRITE setLetter READ letter)
Q_PROPERTY(QImage image WRITE setImage READ image)
Q_PROPERTY(QIcon icon WRITE setIcon READ icon)
public:
explicit QtMaterialAvatar(QWidget *parent = 0);
explicit QtMaterialAvatar(const QIcon &icon, QWidget *parent = 0);
@ -32,10 +39,15 @@ public:
int size() const;
void setLetter(const QChar &letter);
void setImage(const QImage &image);
void setIcon(const QIcon &icon);
QChar letter() const;
Material::AvatarType type() const;
void setImage(const QImage &image);
QImage image() const;
void setIcon(const QIcon &icon);
QIcon icon() const;
MaterialConst::AvatarType type() const;
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;

View File

@ -24,7 +24,7 @@ public:
QtMaterialAvatar *const q_ptr;
int size;
Material::AvatarType type;
MaterialConst::AvatarType type;
QChar letter;
QImage image;
QIcon icon;

View File

@ -2,6 +2,7 @@
#define QTMATERIALBADGE_H
#include "lib/qtmaterialoverlaywidget.h"
#include <QIcon>
class QtMaterialBadgePrivate;
@ -12,6 +13,8 @@ class QtMaterialBadge : public QtMaterialOverlayWidget
Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
Q_PROPERTY(QPointF relativePosition WRITE setRelativePosition READ relativePosition)
Q_PROPERTY(QIcon icon WRITE setIcon READ icon)
Q_PROPERTY(QString text WRITE setText READ text)
public:
explicit QtMaterialBadge(QWidget *parent = 0);

View File

@ -26,7 +26,7 @@ void QtMaterialCircularProgressPrivate::init()
Q_Q(QtMaterialCircularProgress);
delegate = new QtMaterialCircularProgressDelegate(q);
progressType = Material::IndeterminateProgress;
progressType = MaterialConst::IndeterminateProgress;
penWidth = 6.25;
size = 64;
useThemeColors = true;
@ -92,7 +92,7 @@ QtMaterialCircularProgress::~QtMaterialCircularProgress()
{
}
void QtMaterialCircularProgress::setProgressType(Material::ProgressType type)
void QtMaterialCircularProgress::setProgressType(MaterialConst::ProgressType type)
{
Q_D(QtMaterialCircularProgress);
@ -100,7 +100,7 @@ void QtMaterialCircularProgress::setProgressType(Material::ProgressType type)
update();
}
Material::ProgressType QtMaterialCircularProgress::progressType() const
MaterialConst::ProgressType QtMaterialCircularProgress::progressType() const
{
Q_D(const QtMaterialCircularProgress);
@ -214,7 +214,7 @@ void QtMaterialCircularProgress::paintEvent(QPaintEvent *event)
return;
}
if (Material::IndeterminateProgress == d->progressType)
if (MaterialConst::IndeterminateProgress == d->progressType)
{
painter.translate(width()/2, height()/2);
painter.rotate(d->delegate->angle());
@ -225,7 +225,7 @@ void QtMaterialCircularProgress::paintEvent(QPaintEvent *event)
pen.setWidthF(d->penWidth);
pen.setColor(color());
if (Material::IndeterminateProgress == d->progressType)
if (MaterialConst::IndeterminateProgress == d->progressType)
{
QVector<qreal> pattern;
pattern << d->delegate->dashLength()*d->size/50 << 30*d->size/50;

View File

@ -10,6 +10,8 @@ class QtMaterialCircularProgress : public QProgressBar
{
Q_OBJECT
Q_PROPERTY(MaterialConst::ProgressType progressType WRITE setProgressType READ progressType)
Q_PROPERTY(bool useThemeColors WRITE setUseThemeColors READ useThemeColors)
Q_PROPERTY(qreal lineWidth WRITE setLineWidth READ lineWidth)
Q_PROPERTY(qreal size WRITE setSize READ size)
Q_PROPERTY(QColor color WRITE setColor READ color)
@ -18,8 +20,8 @@ public:
explicit QtMaterialCircularProgress(QWidget *parent = 0);
~QtMaterialCircularProgress();
void setProgressType(Material::ProgressType type);
Material::ProgressType progressType() const;
void setProgressType(MaterialConst::ProgressType type);
MaterialConst::ProgressType progressType() const;
void setUseThemeColors(bool value);
bool useThemeColors() const;

View File

@ -20,7 +20,7 @@ public:
QtMaterialCircularProgress *const q_ptr;
QtMaterialCircularProgressDelegate *delegate;
Material::ProgressType progressType;
MaterialConst::ProgressType progressType;
QColor color;
qreal penWidth;
int size;

View File

@ -38,7 +38,7 @@ void QtMaterialFloatingActionButtonPrivate::init()
offsX = 34;
offsY = 36;
q->setRole(Material::Primary);
q->setRole(MaterialConst::Primary);
q->setFixedSize(DefaultDiameter, DefaultDiameter);
q->setGeometry(fabGeometry());
@ -104,6 +104,13 @@ void QtMaterialFloatingActionButtonPrivate::setupProperties()
* \class QtMaterialFloatingActionButton
*/
QtMaterialFloatingActionButton::QtMaterialFloatingActionButton(QWidget *parent)
: QtMaterialRaisedButton(*new QtMaterialFloatingActionButtonPrivate(this), parent)
{
d_func()->init();
}
QtMaterialFloatingActionButton::QtMaterialFloatingActionButton(const QIcon &icon, QWidget *parent)
: QtMaterialRaisedButton(*new QtMaterialFloatingActionButtonPrivate(this), parent)
{

View File

@ -8,8 +8,13 @@ class QtMaterialFloatingActionButtonPrivate;
class QtMaterialFloatingActionButton : public QtMaterialRaisedButton
{
Q_OBJECT
Q_PROPERTY(bool mini WRITE setMini READ isMini)
Q_PROPERTY(Qt::Corner corner WRITE setCorner READ corner)
Q_PROPERTY(int xOffset WRITE setXOffset READ xOffset)
Q_PROPERTY(int yOffset WRITE setYOffset READ yOffset)
public:
explicit QtMaterialFloatingActionButton(QWidget *parent = 0);
explicit QtMaterialFloatingActionButton(const QIcon &icon, QWidget *parent = 0);
~QtMaterialFloatingActionButton();

View File

@ -40,10 +40,10 @@ void QtMaterialFlatButtonPrivate::init()
rippleOverlay = new QtMaterialRippleOverlay(q);
stateMachine = new QtMaterialFlatButtonStateMachine(q);
role = Material::Default;
rippleStyle = Material::PositionedRipple;
iconPlacement = Material::LeftIcon;
overlayStyle = Material::GrayOverlay;
role = MaterialConst::Default;
rippleStyle = MaterialConst::PositionedRipple;
iconPlacement = MaterialConst::LeftIcon;
overlayStyle = MaterialConst::GrayOverlay;
bgMode = Qt::TransparentMode;
textAlignment = Qt::AlignHCenter;
fixedRippleRadius = 64;
@ -75,7 +75,7 @@ void QtMaterialFlatButtonPrivate::init()
* \class QtMaterialFlatButton
*/
QtMaterialFlatButton::QtMaterialFlatButton(QWidget *parent, Material::ButtonPreset preset)
QtMaterialFlatButton::QtMaterialFlatButton(QWidget *parent, MaterialConst::ButtonPreset preset)
: QPushButton(parent),
d_ptr(new QtMaterialFlatButtonPrivate(this))
{
@ -84,7 +84,7 @@ QtMaterialFlatButton::QtMaterialFlatButton(QWidget *parent, Material::ButtonPres
applyPreset(preset);
}
QtMaterialFlatButton::QtMaterialFlatButton(const QString &text, QWidget *parent, Material::ButtonPreset preset)
QtMaterialFlatButton::QtMaterialFlatButton(const QString &text, QWidget *parent, MaterialConst::ButtonPreset preset)
: QPushButton(text, parent),
d_ptr(new QtMaterialFlatButtonPrivate(this))
{
@ -93,7 +93,7 @@ QtMaterialFlatButton::QtMaterialFlatButton(const QString &text, QWidget *parent,
applyPreset(preset);
}
QtMaterialFlatButton::QtMaterialFlatButton(const QString &text, Material::Role role, QWidget *parent, Material::ButtonPreset preset)
QtMaterialFlatButton::QtMaterialFlatButton(const QString &text, MaterialConst::Role role, QWidget *parent, MaterialConst::ButtonPreset preset)
: QPushButton(text, parent),
d_ptr(new QtMaterialFlatButtonPrivate(this))
{
@ -107,15 +107,15 @@ QtMaterialFlatButton::~QtMaterialFlatButton()
{
}
void QtMaterialFlatButton::applyPreset(Material::ButtonPreset preset)
void QtMaterialFlatButton::applyPreset(MaterialConst::ButtonPreset preset)
{
switch (preset)
{
case Material::FlatPreset:
setOverlayStyle(Material::NoOverlay);
case MaterialConst::FlatPreset:
setOverlayStyle(MaterialConst::NoOverlay);
break;
case Material::CheckablePreset:
setOverlayStyle(Material::NoOverlay);
case MaterialConst::CheckablePreset:
setOverlayStyle(MaterialConst::NoOverlay);
setCheckable(true);
setHaloVisible(false);
break;
@ -143,7 +143,7 @@ bool QtMaterialFlatButton::useThemeColors() const
return d->useThemeColors;
}
void QtMaterialFlatButton::setRole(Material::Role role)
void QtMaterialFlatButton::setRole(MaterialConst::Role role)
{
Q_D(QtMaterialFlatButton);
@ -151,7 +151,7 @@ void QtMaterialFlatButton::setRole(Material::Role role)
d->stateMachine->setupProperties();
}
Material::Role QtMaterialFlatButton::role() const
MaterialConst::Role QtMaterialFlatButton::role() const
{
Q_D(const QtMaterialFlatButton);
@ -179,11 +179,11 @@ QColor QtMaterialFlatButton::foregroundColor() const
}
switch (d->role)
{
case Material::Primary:
case MaterialConst::Primary:
return QtMaterialStyle::instance().themeColor("primary1");
case Material::Secondary:
case MaterialConst::Secondary:
return QtMaterialStyle::instance().themeColor("accent1");
case Material::Default:
case MaterialConst::Default:
default:
return QtMaterialStyle::instance().themeColor("text");
}
@ -209,11 +209,11 @@ QColor QtMaterialFlatButton::backgroundColor() const
{
switch (d->role)
{
case Material::Primary:
case MaterialConst::Primary:
return QtMaterialStyle::instance().themeColor("primary1");
case Material::Secondary:
case MaterialConst::Secondary:
return QtMaterialStyle::instance().themeColor("accent1");
case Material::Default:
case MaterialConst::Default:
default:
return QtMaterialStyle::instance().themeColor("text");
}
@ -229,7 +229,7 @@ void QtMaterialFlatButton::setOverlayColor(const QColor &color)
MATERIAL_DISABLE_THEME_COLORS
setOverlayStyle(Material::TintedOverlay);
setOverlayStyle(MaterialConst::TintedOverlay);
update();
}
@ -320,7 +320,7 @@ bool QtMaterialFlatButton::isHaloVisible() const
return d->haloVisible;
}
void QtMaterialFlatButton::setOverlayStyle(Material::OverlayStyle style)
void QtMaterialFlatButton::setOverlayStyle(MaterialConst::OverlayStyle style)
{
Q_D(QtMaterialFlatButton);
@ -328,28 +328,28 @@ void QtMaterialFlatButton::setOverlayStyle(Material::OverlayStyle style)
update();
}
Material::OverlayStyle QtMaterialFlatButton::overlayStyle() const
MaterialConst::OverlayStyle QtMaterialFlatButton::overlayStyle() const
{
Q_D(const QtMaterialFlatButton);
return d->overlayStyle;
}
void QtMaterialFlatButton::setRippleStyle(Material::RippleStyle style)
void QtMaterialFlatButton::setRippleStyle(MaterialConst::RippleStyle style)
{
Q_D(QtMaterialFlatButton);
d->rippleStyle = style;
}
Material::RippleStyle QtMaterialFlatButton::rippleStyle() const
MaterialConst::RippleStyle QtMaterialFlatButton::rippleStyle() const
{
Q_D(const QtMaterialFlatButton);
return d->rippleStyle;
}
void QtMaterialFlatButton::setIconPlacement(Material::ButtonIconPlacement placement)
void QtMaterialFlatButton::setIconPlacement(MaterialConst::ButtonIconPlacement placement)
{
Q_D(QtMaterialFlatButton);
@ -357,7 +357,7 @@ void QtMaterialFlatButton::setIconPlacement(Material::ButtonIconPlacement placem
update();
}
Material::ButtonIconPlacement QtMaterialFlatButton::iconPlacement() const
MaterialConst::ButtonIconPlacement QtMaterialFlatButton::iconPlacement() const
{
Q_D(const QtMaterialFlatButton);
@ -473,7 +473,7 @@ QSize QtMaterialFlatButton::sizeHint() const
return QSize(w, 20 + h);
}
QtMaterialFlatButton::QtMaterialFlatButton(QtMaterialFlatButtonPrivate &d,QWidget *parent, Material::ButtonPreset preset)
QtMaterialFlatButton::QtMaterialFlatButton(QtMaterialFlatButtonPrivate &d,QWidget *parent, MaterialConst::ButtonPreset preset)
: QPushButton(parent),
d_ptr(&d)
{
@ -501,12 +501,12 @@ void QtMaterialFlatButton::mousePressEvent(QMouseEvent *event)
{
Q_D(QtMaterialFlatButton);
if (Material::NoRipple != d->rippleStyle)
if (MaterialConst::NoRipple != d->rippleStyle)
{
QPoint pos;
qreal radiusEndValue;
if (Material::CenteredRipple == d->rippleStyle) {
if (MaterialConst::CenteredRipple == d->rippleStyle) {
pos = rect().center();
} else {
pos = event->pos();
@ -615,8 +615,8 @@ void QtMaterialFlatButton::paintBackground(QPainter *painter)
return;
}
if ((Material::NoOverlay != d->overlayStyle) && (overlayOpacity > 0)) {
if (Material::TintedOverlay == d->overlayStyle) {
if ((MaterialConst::NoOverlay != d->overlayStyle) && (overlayOpacity > 0)) {
if (MaterialConst::TintedOverlay == d->overlayStyle) {
brush.setColor(overlayColor());
} else {
brush.setColor(Qt::gray);
@ -711,7 +711,7 @@ void QtMaterialFlatButton::paintForeground(QPainter *painter)
QRect textGeometry(pos + QPoint(0, base.height()/2), textSize);
QRect iconGeometry(pos + QPoint(0, (height()-iconSize().height())/2), iconSize());
if (Material::LeftIcon == d->iconPlacement) {
if (MaterialConst::LeftIcon == d->iconPlacement) {
textGeometry.translate(iw, 0);
} else {
iconGeometry.translate(textSize.width() + IconPadding, 0);

View File

@ -10,7 +10,6 @@ class QtMaterialFlatButtonPrivate;
class QtMaterialFlatButton : public QPushButton
{
Q_OBJECT
Q_PROPERTY(QColor foregroundColor WRITE setForegroundColor READ foregroundColor)
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
Q_PROPERTY(QColor overlayColor WRITE setOverlayColor READ overlayColor)
@ -18,20 +17,28 @@ class QtMaterialFlatButton : public QPushButton
Q_PROPERTY(QColor disabledBackgroundColor WRITE setDisabledBackgroundColor READ disabledBackgroundColor)
Q_PROPERTY(qreal fontSize WRITE setFontSize READ fontSize)
Q_PROPERTY(bool useThemeColors WRITE setUseThemeColors READ useThemeColors)
Q_PROPERTY(bool haloVisible WRITE setHaloVisible READ isHaloVisible)
Q_PROPERTY(MaterialConst::Role role WRITE setRole READ role)
Q_PROPERTY(MaterialConst::OverlayStyle overlayStyle WRITE setOverlayStyle READ overlayStyle)
Q_PROPERTY(MaterialConst::RippleStyle rippleStyle WRITE setRippleStyle READ rippleStyle)
Q_PROPERTY(MaterialConst::ButtonIconPlacement iconPlacement WRITE setIconPlacement READ iconPlacement)
Q_PROPERTY(qreal cornerRadius WRITE setCornerRadius READ cornerRadius)
Q_PROPERTY(Qt::BGMode backgroundMode WRITE setBackgroundMode READ backgroundMode)
Q_PROPERTY(qreal baseOpacity WRITE setBaseOpacity READ baseOpacity)
Q_PROPERTY(bool checkable WRITE setCheckable)
public:
explicit QtMaterialFlatButton(QWidget *parent = 0, Material::ButtonPreset preset = Material::FlatPreset);
explicit QtMaterialFlatButton(const QString &text, QWidget *parent = 0, Material::ButtonPreset preset = Material::FlatPreset);
QtMaterialFlatButton(const QString &text, Material::Role role, QWidget *parent = 0, Material::ButtonPreset preset = Material::FlatPreset);
explicit QtMaterialFlatButton(QWidget *parent = 0, MaterialConst::ButtonPreset preset = MaterialConst::FlatPreset);
explicit QtMaterialFlatButton(const QString &text, QWidget *parent = 0, MaterialConst::ButtonPreset preset = MaterialConst::FlatPreset);
QtMaterialFlatButton(const QString &text, MaterialConst::Role role, QWidget *parent = 0, MaterialConst::ButtonPreset preset = MaterialConst::FlatPreset);
~QtMaterialFlatButton();
void applyPreset(Material::ButtonPreset preset);
void applyPreset(MaterialConst::ButtonPreset preset);
void setUseThemeColors(bool value);
bool useThemeColors() const;
void setRole(Material::Role role);
Material::Role role() const;
void setForegroundColor(const QColor &color);
QColor foregroundColor() const;
@ -53,14 +60,17 @@ public:
void setHaloVisible(bool visible);
bool isHaloVisible() const;
void setOverlayStyle(Material::OverlayStyle style);
Material::OverlayStyle overlayStyle() const;
void setRole(MaterialConst::Role role);
MaterialConst::Role role() const;
void setRippleStyle(Material::RippleStyle style);
Material::RippleStyle rippleStyle() const;
void setOverlayStyle(MaterialConst::OverlayStyle style);
MaterialConst::OverlayStyle overlayStyle() const;
void setIconPlacement(Material::ButtonIconPlacement placement);
Material::ButtonIconPlacement iconPlacement() const;
void setRippleStyle(MaterialConst::RippleStyle style);
MaterialConst::RippleStyle rippleStyle() const;
void setIconPlacement(MaterialConst::ButtonIconPlacement placement);
MaterialConst::ButtonIconPlacement iconPlacement() const;
void setCornerRadius(qreal radius);
qreal cornerRadius() const;
@ -88,7 +98,7 @@ protected:
IconPadding = 12
};
QtMaterialFlatButton(QtMaterialFlatButtonPrivate &d, QWidget *parent = 0, Material::ButtonPreset preset = Material::FlatPreset);
QtMaterialFlatButton(QtMaterialFlatButtonPrivate &d, QWidget *parent = 0, MaterialConst::ButtonPreset preset = MaterialConst::FlatPreset);
void checkStateSet() Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;

View File

@ -23,10 +23,10 @@ public:
QtMaterialFlatButton *const q_ptr;
QtMaterialRippleOverlay *rippleOverlay;
QtMaterialFlatButtonStateMachine *stateMachine;
Material::Role role;
Material::RippleStyle rippleStyle;
Material::ButtonIconPlacement iconPlacement;
Material::OverlayStyle overlayStyle;
MaterialConst::Role role;
MaterialConst::RippleStyle rippleStyle;
MaterialConst::ButtonIconPlacement iconPlacement;
MaterialConst::OverlayStyle overlayStyle;
Qt::BGMode bgMode;
Qt::Alignment textAlignment;
QColor backgroundColor;

View File

@ -48,6 +48,12 @@ void QtMaterialIconButtonPrivate::updateRipple()
/*!
* \class QtMaterialIconButton
*/
QtMaterialIconButton::QtMaterialIconButton(QWidget *parent)
: QAbstractButton(parent),
d_ptr(new QtMaterialIconButtonPrivate(this))
{
d_func()->init();
}
QtMaterialIconButton::QtMaterialIconButton(const QIcon &icon, QWidget *parent)
: QAbstractButton(parent),

View File

@ -8,8 +8,12 @@ class QtMaterialIconButtonPrivate;
class QtMaterialIconButton : public QAbstractButton
{
Q_OBJECT
// Q_PROPERTY(bool useThemeColors READ setUseThemeColors WRITE useThemeColors)
// Q_PROPERTY(QColor color READ setColor WRITE color)
// Q_PROPERTY(QColor disabledColor READ setDisabledColor WRITE disabledColor)
public:
explicit QtMaterialIconButton(QWidget *parent = 0);
explicit QtMaterialIconButton(const QIcon &icon, QWidget *parent = 0);
~QtMaterialIconButton();

View File

@ -1,11 +1,73 @@
#include "qtmaterialmenu.h"
#include "qtmaterialmenu_p.h"
#include <QMouseEvent>
#include <QPainter>
#include <QTime>
#include <QTimer>
QtMaterialMenu::QtMaterialMenu(QWidget *parent)
: QWidget(parent)
{
QTimer *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, QOverload<>::of(&QWidget::update));
timer->start(1000);
setWindowTitle(tr("Analog Clock"));
resize(200, 200);
}
QtMaterialMenu::~QtMaterialMenu()
void QtMaterialMenu::paintEvent(QPaintEvent *)
{
static const QPoint hourHand[3] = {
QPoint(7, 8),
QPoint(-7, 8),
QPoint(0, -40)
};
static const QPoint minuteHand[3] = {
QPoint(7, 8),
QPoint(-7, 8),
QPoint(0, -70)
};
QColor hourColor(127, 0, 127);
QColor minuteColor(0, 127, 127, 191);
int side = qMin(width(), height());
QTime time = QTime::currentTime();
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.translate(width() / 2, height() / 2);
painter.scale(side / 200.0, side / 200.0);
painter.setPen(Qt::NoPen);
painter.setBrush(hourColor);
painter.save();
painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0)));
painter.drawConvexPolygon(hourHand, 3);
painter.restore();
painter.setPen(hourColor);
for (int i = 0; i < 12; ++i) {
painter.drawLine(88, 0, 96, 0);
painter.rotate(30.0);
}
painter.setPen(Qt::NoPen);
painter.setBrush(minuteColor);
painter.save();
painter.rotate(6.0 * (time.minute() + time.second() / 60.0));
painter.drawConvexPolygon(minuteHand, 3);
painter.restore();
painter.setPen(minuteColor);
for (int j = 0; j < 60; ++j) {
if ((j % 5) != 0)
painter.drawLine(92, 0, 96, 0);
painter.rotate(6.0);
}
}

View File

@ -2,14 +2,17 @@
#define QTMATERIALMENU_H
#include <QtWidgets/QWidget>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialMenu : public QWidget
class QDESIGNER_WIDGET_EXPORT QtMaterialMenu : public QWidget
{
Q_OBJECT
public:
explicit QtMaterialMenu(QWidget *parent = 0);
~QtMaterialMenu();
protected:
void paintEvent(QPaintEvent *event) override;
};
#endif // QTMATERIALMENU_H

View File

@ -25,7 +25,7 @@ void QtMaterialProgressPrivate::init()
Q_Q(QtMaterialProgress);
delegate = new QtMaterialProgressDelegate(q);
progressType = Material::IndeterminateProgress;
progressType = MaterialConst::IndeterminateProgress;
useThemeColors = true;
QPropertyAnimation *animation;
@ -57,7 +57,7 @@ QtMaterialProgress::~QtMaterialProgress()
{
}
void QtMaterialProgress::setProgressType(Material::ProgressType type)
void QtMaterialProgress::setProgressType(MaterialConst::ProgressType type)
{
Q_D(QtMaterialProgress);
@ -65,7 +65,7 @@ void QtMaterialProgress::setProgressType(Material::ProgressType type)
update();
}
Material::ProgressType QtMaterialProgress::progressType() const
MaterialConst::ProgressType QtMaterialProgress::progressType() const
{
Q_D(const QtMaterialProgress);
@ -163,7 +163,7 @@ void QtMaterialProgress::paintEvent(QPaintEvent *event)
brush.setColor(progressColor());
painter.setBrush(brush);
if (Material::IndeterminateProgress == d->progressType) {
if (MaterialConst::IndeterminateProgress == d->progressType) {
painter.drawRect(d->delegate->offset()*width()*2-width(), 0, width(), height());
} else {
qreal p = static_cast<qreal>(width())*(value()-minimum())/(maximum()-minimum());

View File

@ -17,8 +17,8 @@ public:
explicit QtMaterialProgress(QWidget *parent = 0);
~QtMaterialProgress();
void setProgressType(Material::ProgressType type);
Material::ProgressType progressType() const;
void setProgressType(MaterialConst::ProgressType type);
MaterialConst::ProgressType progressType() const;
void setUseThemeColors(bool state);
bool useThemeColors() const;

View File

@ -21,7 +21,7 @@ public:
QtMaterialProgress *const q_ptr;
QtMaterialProgressDelegate *delegate;
Material::ProgressType progressType;
MaterialConst::ProgressType progressType;
QColor progressColor;
QColor backgroundColor;
bool useThemeColors;

View File

@ -9,9 +9,11 @@ class QtMaterialScrollBar : public QScrollBar
{
Q_OBJECT
Q_PROPERTY(bool useThemeColors WRITE setUseThemeColors READ useThemeColors)
Q_PROPERTY(QColor canvasColor WRITE setCanvasColor READ canvasColor)
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
Q_PROPERTY(QColor sliderColor WRITE setSliderColor READ sliderColor)
Q_PROPERTY(bool hideOnMouseOut WRITE setHideOnMouseOut READ hideOnMouseOut)
public:
explicit QtMaterialScrollBar(QWidget *parent = 0);

View File

@ -12,9 +12,12 @@ class QtMaterialSlider : public QAbstractSlider
{
Q_OBJECT
Q_PROPERTY(bool useThemeColors WRITE setUseThemeColors READ useThemeColors)
Q_PROPERTY(QColor thumbColor WRITE setThumbColor READ thumbColor)
Q_PROPERTY(QColor trackColor WRITE setTrackColor READ trackColor)
Q_PROPERTY(QColor disabledColor WRITE setDisabledColor READ disabledColor)
Q_PROPERTY(bool pageStepMode WRITE setPageStepMode READ pageStepMode)
Q_PROPERTY(bool invertedAppearance WRITE setInvertedAppearance)
public:
explicit QtMaterialSlider(QWidget *parent = 0);

View File

@ -24,7 +24,7 @@ void QtMaterialTabsPrivate::QtMaterialTabsPrivate::init()
inkBar = new QtMaterialTabsInkBar(q);
tabLayout = new QHBoxLayout;
rippleStyle = Material::CenteredRipple;
rippleStyle = MaterialConst::CenteredRipple;
tab = -1;
showHalo = true;
useThemeColors = true;
@ -80,7 +80,7 @@ bool QtMaterialTabs::isHaloVisible() const
return d->showHalo;
}
void QtMaterialTabs::setRippleStyle(Material::RippleStyle style)
void QtMaterialTabs::setRippleStyle(MaterialConst::RippleStyle style)
{
Q_D(QtMaterialTabs);
@ -88,7 +88,7 @@ void QtMaterialTabs::setRippleStyle(Material::RippleStyle style)
updateTabs();
}
Material::RippleStyle QtMaterialTabs::rippleStyle() const
MaterialConst::RippleStyle QtMaterialTabs::rippleStyle() const
{
Q_D(const QtMaterialTabs);

View File

@ -22,8 +22,8 @@ public:
void setHaloVisible(bool value);
bool isHaloVisible() const;
void setRippleStyle(Material::RippleStyle style);
Material::RippleStyle rippleStyle() const;
void setRippleStyle(MaterialConst::RippleStyle style);
MaterialConst::RippleStyle rippleStyle() const;
void setInkColor(const QColor &color);
QColor inkColor() const;

View File

@ -112,7 +112,7 @@ QtMaterialTab::QtMaterialTab(QtMaterialTabs *parent)
setFont(f);
setCornerRadius(0);
setRole(Material::Primary);
setRole(MaterialConst::Primary);
setBackgroundMode(Qt::OpaqueMode);
setBaseOpacity(0.25);

View File

@ -22,7 +22,7 @@ public:
QtMaterialTabs *const q_ptr;
QtMaterialTabsInkBar *inkBar;
QHBoxLayout *tabLayout;
Material::RippleStyle rippleStyle;
MaterialConst::RippleStyle rippleStyle;
QColor inkColor;
QColor backgroundColor;
QColor textColor;

View File

@ -56,6 +56,7 @@ QtMaterialTextField::QtMaterialTextField(QWidget *parent)
QtMaterialTextField::~QtMaterialTextField()
{
}
void QtMaterialTextField::setUseThemeColors(bool value)

View File

@ -3,16 +3,23 @@
#include <QtWidgets/QLineEdit>
#include <QColor>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialTextFieldPrivate;
class QtMaterialTextField : public QLineEdit
class QDESIGNER_WIDGET_EXPORT QtMaterialTextField : public QLineEdit
{
Q_OBJECT
Q_PROPERTY(bool useThemeColors WRITE setUseThemeColors READ useThemeColors)
Q_PROPERTY(bool showLabel WRITE setShowLabel READ hasLabel)
Q_PROPERTY(QString label WRITE setLabel READ label)
Q_PROPERTY(qreal labelFontSize WRITE setLabelFontSize READ labelFontSize)
Q_PROPERTY(QColor labelColor WRITE setLabelColor READ labelColor)
Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor)
Q_PROPERTY(QColor inputLineColor WRITE setInputLineColor READ inputLineColor)
Q_PROPERTY(bool showInputLine WRITE setShowInputLine READ hasInputLine)
public:
explicit QtMaterialTextField(QWidget *parent = 0);

View File

@ -143,6 +143,7 @@ QtMaterialToggle::QtMaterialToggle(QWidget *parent)
QtMaterialToggle::~QtMaterialToggle()
{
}
void QtMaterialToggle::setUseThemeColors(bool value)

View File

@ -2,17 +2,20 @@
#define QTMATERIALTOGGLE_H
#include <QtWidgets/QAbstractButton>
#include <QtUiPlugin/QDesignerExportWidget>
class QtMaterialTogglePrivate;
class QtMaterialToggle : public QAbstractButton
class QDESIGNER_WIDGET_EXPORT QtMaterialToggle : public QAbstractButton
{
Q_OBJECT
Q_PROPERTY(bool useThemeColors WRITE setUseThemeColors READ useThemeColors)
Q_PROPERTY(QColor disabledColor WRITE setDisabledColor READ disabledColor)
Q_PROPERTY(QColor activeColor WRITE setActiveColor READ activeColor)
Q_PROPERTY(QColor inactiveColor WRITE setInactiveColor READ inactiveColor)
Q_PROPERTY(QColor trackColor WRITE setTrackColor READ trackColor)
Q_PROPERTY(Qt::Orientation orientation WRITE setOrientation READ orientation)
public:
explicit QtMaterialToggle(QWidget *parent = 0);

View File

@ -47,13 +47,13 @@ void AvatarSettingsEditor::setupForm()
{
switch (m_avatar->type())
{
case Material::LetterAvatar:
case MaterialConst::LetterAvatar:
ui->typeComboBox->setCurrentIndex(0);
break;
case Material::ImageAvatar:
case MaterialConst::ImageAvatar:
ui->typeComboBox->setCurrentIndex(1);
break;
case Material::IconAvatar:
case MaterialConst::IconAvatar:
ui->typeComboBox->setCurrentIndex(2);
break;
default:

View File

@ -49,10 +49,10 @@ void CircularProgressSettingsEditor::setupForm()
{
switch (m_progress->progressType())
{
case Material::DeterminateProgress:
case MaterialConst::DeterminateProgress:
ui->progressTypeComboBox->setCurrentIndex(0);
break;
case Material::IndeterminateProgress:
case MaterialConst::IndeterminateProgress:
ui->progressTypeComboBox->setCurrentIndex(1);
break;
default:
@ -71,10 +71,10 @@ void CircularProgressSettingsEditor::updateWidget()
switch (ui->progressTypeComboBox->currentIndex())
{
case 0:
m_progress->setProgressType(Material::DeterminateProgress);
m_progress->setProgressType(MaterialConst::DeterminateProgress);
break;
case 1:
m_progress->setProgressType(Material::IndeterminateProgress);
m_progress->setProgressType(MaterialConst::IndeterminateProgress);
break;
default:
break;

0
examples/components.pri Normal file
View File

View File

@ -1,7 +1,10 @@
QT += core gui widgets
TEMPLATE = app
CONFIG += c++11
SOURCES = mainwindow.cpp \
#include(../components/link_components.pri)
SOURCES += mainwindow.cpp \
main.cpp \
avatarsettingseditor.cpp \
badgesettingseditor.cpp \
@ -25,7 +28,7 @@ SOURCES = mainwindow.cpp \
appbarsettingseditor.cpp \
autocompletesettingseditor.cpp \
menusettingseditor.cpp
HEADERS = mainwindow.h \
HEADERS += mainwindow.h \
avatarsettingseditor.h \
badgesettingseditor.h \
checkboxsettingseditor.h \
@ -48,12 +51,6 @@ HEADERS = mainwindow.h \
appbarsettingseditor.h \
autocompletesettingseditor.h \
menusettingseditor.h
LIBS += -L../components/ -lqt-material-widget
INCLUDEPATH += $$top_srcdir/components/
TARGET = examples-exe
RESOURCES += \
examples.qrc
FORMS += \
avatarsettingsform.ui \
@ -75,3 +72,11 @@ FORMS += \
drawersettingsform.ui \
scrollbarsettingsform.ui \
appbarsettingsform.ui
RESOURCES += \
examples.qrc
LIBS += -L../components/ -lqt-material-widget
INCLUDEPATH += $$top_srcdir/components/
TARGET = examples-exe

View File

@ -49,13 +49,13 @@ void FloatingActionButtonSettingsEditor::setupForm()
{
switch (m_fab->role())
{
case Material::Default:
case MaterialConst::Default:
ui->buttonRoleComboBox->setCurrentIndex(0);
break;
case Material::Primary:
case MaterialConst::Primary:
ui->buttonRoleComboBox->setCurrentIndex(1);
break;
case Material::Secondary:
case MaterialConst::Secondary:
ui->buttonRoleComboBox->setCurrentIndex(2);
break;
default:
@ -82,13 +82,13 @@ void FloatingActionButtonSettingsEditor::setupForm()
switch (m_fab->rippleStyle())
{
case Material::CenteredRipple:
case MaterialConst::CenteredRipple:
ui->rippleStyleComboBox->setCurrentIndex(0);
break;
case Material::PositionedRipple:
case MaterialConst::PositionedRipple:
ui->rippleStyleComboBox->setCurrentIndex(1);
break;
case Material::NoRipple:
case MaterialConst::NoRipple:
ui->rippleStyleComboBox->setCurrentIndex(2);
break;
default:
@ -107,13 +107,13 @@ void FloatingActionButtonSettingsEditor::updateWidget()
switch (ui->buttonRoleComboBox->currentIndex())
{
case 0:
m_fab->setRole(Material::Default);
m_fab->setRole(MaterialConst::Default);
break;
case 1:
m_fab->setRole(Material::Primary);
m_fab->setRole(MaterialConst::Primary);
break;
case 2:
m_fab->setRole(Material::Secondary);
m_fab->setRole(MaterialConst::Secondary);
break;
default:
break;
@ -140,13 +140,13 @@ void FloatingActionButtonSettingsEditor::updateWidget()
switch (ui->rippleStyleComboBox->currentIndex())
{
case 0:
m_fab->setRippleStyle(Material::CenteredRipple);
m_fab->setRippleStyle(MaterialConst::CenteredRipple);
break;
case 1:
m_fab->setRippleStyle(Material::PositionedRipple);
m_fab->setRippleStyle(MaterialConst::PositionedRipple);
break;
case 2:
m_fab->setRippleStyle(Material::NoRipple);
m_fab->setRippleStyle(MaterialConst::NoRipple);
break;
default:
break;

View File

@ -28,13 +28,13 @@ void FlatButtonSettingsEditor::setupForm()
{
switch (m_button->role())
{
case Material::Default:
case MaterialConst::Default:
ui->buttonRoleComboBox->setCurrentIndex(0);
break;
case Material::Primary:
case MaterialConst::Primary:
ui->buttonRoleComboBox->setCurrentIndex(1);
break;
case Material::Secondary:
case MaterialConst::Secondary:
ui->buttonRoleComboBox->setCurrentIndex(2);
break;
default:
@ -43,13 +43,13 @@ void FlatButtonSettingsEditor::setupForm()
switch (m_button->overlayStyle())
{
case Material::NoOverlay:
case MaterialConst::NoOverlay:
ui->hoverStyleComboBox->setCurrentIndex(0);
break;
case Material::TintedOverlay:
case MaterialConst::TintedOverlay:
ui->hoverStyleComboBox->setCurrentIndex(1);
break;
case Material::GrayOverlay:
case MaterialConst::GrayOverlay:
ui->hoverStyleComboBox->setCurrentIndex(2);
break;
default:
@ -58,13 +58,13 @@ void FlatButtonSettingsEditor::setupForm()
switch (m_button->rippleStyle())
{
case Material::CenteredRipple:
case MaterialConst::CenteredRipple:
ui->rippleStyleComboBox->setCurrentIndex(0);
break;
case Material::PositionedRipple:
case MaterialConst::PositionedRipple:
ui->rippleStyleComboBox->setCurrentIndex(1);
break;
case Material::NoRipple:
case MaterialConst::NoRipple:
ui->rippleStyleComboBox->setCurrentIndex(2);
break;
default:
@ -73,10 +73,10 @@ void FlatButtonSettingsEditor::setupForm()
switch (m_button->iconPlacement())
{
case Material::LeftIcon:
case MaterialConst::LeftIcon:
ui->iconPlacementComboBox->setCurrentIndex(0);
break;
case Material::RightIcon:
case MaterialConst::RightIcon:
ui->iconPlacementComboBox->setCurrentIndex(1);
break;
}
@ -111,13 +111,13 @@ void FlatButtonSettingsEditor::updateWidget()
switch (ui->buttonRoleComboBox->currentIndex())
{
case 0:
m_button->setRole(Material::Default);
m_button->setRole(MaterialConst::Default);
break;
case 1:
m_button->setRole(Material::Primary);
m_button->setRole(MaterialConst::Primary);
break;
case 2:
m_button->setRole(Material::Secondary);
m_button->setRole(MaterialConst::Secondary);
break;
default:
break;
@ -126,13 +126,13 @@ void FlatButtonSettingsEditor::updateWidget()
switch (ui->hoverStyleComboBox->currentIndex())
{
case 0:
m_button->setOverlayStyle(Material::NoOverlay);
m_button->setOverlayStyle(MaterialConst::NoOverlay);
break;
case 1:
m_button->setOverlayStyle(Material::TintedOverlay);
m_button->setOverlayStyle(MaterialConst::TintedOverlay);
break;
case 2:
m_button->setOverlayStyle(Material::GrayOverlay);
m_button->setOverlayStyle(MaterialConst::GrayOverlay);
break;
default:
break;
@ -141,13 +141,13 @@ void FlatButtonSettingsEditor::updateWidget()
switch (ui->rippleStyleComboBox->currentIndex())
{
case 0:
m_button->setRippleStyle(Material::CenteredRipple);
m_button->setRippleStyle(MaterialConst::CenteredRipple);
break;
case 1:
m_button->setRippleStyle(Material::PositionedRipple);
m_button->setRippleStyle(MaterialConst::PositionedRipple);
break;
case 2:
m_button->setRippleStyle(Material::NoRipple);
m_button->setRippleStyle(MaterialConst::NoRipple);
break;
default:
break;
@ -156,10 +156,10 @@ void FlatButtonSettingsEditor::updateWidget()
switch (ui->iconPlacementComboBox->currentIndex())
{
case 0:
m_button->setIconPlacement(Material::LeftIcon);
m_button->setIconPlacement(MaterialConst::LeftIcon);
break;
case 1:
m_button->setIconPlacement(Material::RightIcon);
m_button->setIconPlacement(MaterialConst::RightIcon);
break;
default:
break;
@ -236,7 +236,7 @@ void FlatButtonSettingsEditor::applyDefaultPreset()
ui->checkableCheckBox->setChecked(false);
ui->disabledCheckBox->setChecked(false);
updateWidget();
m_button->applyPreset(Material::FlatPreset);
m_button->applyPreset(MaterialConst::FlatPreset);
}
void FlatButtonSettingsEditor::applyCheckablePreset()
@ -255,7 +255,7 @@ void FlatButtonSettingsEditor::applyCheckablePreset()
ui->checkableCheckBox->setChecked(true);
ui->disabledCheckBox->setChecked(false);
updateWidget();
m_button->applyPreset(Material::CheckablePreset);
m_button->applyPreset(MaterialConst::CheckablePreset);
}
void FlatButtonSettingsEditor::init()

View File

@ -1,14 +1,45 @@
#include "plugindemoform.h"
#include "ui_plugindemoform.h"
#include <QMessageBox>
PluginDemoForm::PluginDemoForm(QWidget *parent) :
QWidget(parent),
ui(new Ui::PluginDemoForm)
{
ui->setupUi(this);
// QStringList list1 = {"Hello", "Material", "Auto Complete"};
// ui->qtmaterialautocomplete->setDataSource(list1);
m_dialog = new QtMaterialDialog;
m_dialog->setParent(this);
QWidget *dialogWidget = new QWidget;
QVBoxLayout *dialogWidgetLayout = new QVBoxLayout;
dialogWidget->setLayout(dialogWidgetLayout);
QtMaterialFlatButton *closeButton = new QtMaterialFlatButton("Close");
dialogWidgetLayout->addWidget(closeButton);
dialogWidgetLayout->setAlignment(closeButton, Qt::AlignBottom | Qt::AlignCenter);
closeButton->setMaximumWidth(150);
QVBoxLayout *dialogLayout = new QVBoxLayout;
m_dialog->setWindowLayout(dialogLayout);
dialogWidget->setMinimumHeight(300);
dialogLayout->addWidget(dialogWidget);
connect(closeButton, SIGNAL(pressed()), m_dialog, SLOT(hideDialog()));
}
PluginDemoForm::~PluginDemoForm()
{
delete ui;
}
void PluginDemoForm::on_qtmaterialflatbutton_3_clicked()
{
m_dialog->showDialog();
}

View File

@ -2,6 +2,8 @@
#define PLUGINDEMOFORM_H
#include <QWidget>
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
#include "qtmaterialdialog.h"
namespace Ui {
class PluginDemoForm;
@ -15,8 +17,12 @@ public:
explicit PluginDemoForm(QWidget *parent = nullptr);
~PluginDemoForm();
private slots:
void on_qtmaterialflatbutton_3_clicked();
private:
Ui::PluginDemoForm *ui;
QtMaterialDialog* m_dialog;
};
#endif // PLUGINDEMOFORM_H

View File

@ -6,24 +6,651 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>907</width>
<height>746</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QtMaterialToggle" name="material toggle">
<property name="geometry">
<rect>
<x>60</x>
<y>20</y>
<width>64</width>
<height>48</height>
</rect>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QtMaterialCheckBox" name="qtmaterialcheckbox">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>FloatActionButton</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QtMaterialAutoComplete" name="qtmaterialautocomplete">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="dataSource">
<stringlist>
<string>HELLO</string>
<string>WORLD</string>
<string>MATERIAL</string>
</stringlist>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>IconButton</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QtMaterialFloatingActionButton" name="qtmaterialfloatingactionbutton">
<property name="icon">
<iconset resource="../components/material_res.qrc">
<normaloff>:/icons/icons/navigation/svg/production/ic_more_vert_24px.svg</normaloff>:/icons/icons/navigation/svg/production/ic_more_vert_24px.svg</iconset>
</property>
<property name="mini">
<bool>false</bool>
</property>
</widget>
</item>
<item row="9" column="1" colspan="3">
<widget class="QtMaterialRadioButton" name="qtmaterialradiobutton">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>RadioButton 1</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>Slider</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>Progress</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>Avatar &amp; Badge</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QtMaterialAvatar" name="qtmaterialavatar_2">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="size">
<number>40</number>
</property>
<property name="letter">
<char>
<unicode>79</unicode>
</char>
</property>
<property name="icon">
<iconset resource="../components/material_res.qrc">
<normaloff>:/icons/icons/communication/svg/production/ic_call_24px.svg</normaloff>:/icons/icons/communication/svg/production/ic_call_24px.svg</iconset>
</property>
<widget class="QtMaterialBadge" name="qtmaterialbadge_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>60</width>
<height>54</height>
</rect>
</property>
<property name="relativePosition">
<pointf>
<x>15.000000000000000</x>
<y>15.000000000000000</y>
</pointf>
</property>
<property name="icon">
<iconset resource="../components/material_res.qrc">
<normaloff>:/icons/icons/toggle/svg/production/ic_star_24px.svg</normaloff>:/icons/icons/toggle/svg/production/ic_star_24px.svg</iconset>
</property>
</widget>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QtMaterialProgress" name="qtmaterialprogress">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="13" column="1" colspan="3">
<widget class="QtMaterialTextField" name="qtmaterialtextfield">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="label">
<string>Input Text</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QtMaterialFlatButton" name="qtmaterialflatbutton">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>FlatButton</string>
</property>
<property name="icon">
<iconset resource="../components/material_res.qrc">
<normaloff>:/icons/icons/maps/svg/production/ic_local_see_24px.svg</normaloff>:/icons/icons/maps/svg/production/ic_local_see_24px.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="overlayStyle">
<enum>MaterialConst::TintedOverlay</enum>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>RaiseButton</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>FlatButton</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QtMaterialToggle" name="qtmaterialtoggle"/>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>TextField</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QtMaterialAvatar" name="qtmaterialavatar">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="size">
<number>40</number>
</property>
<property name="letter">
<char>
<unicode>79</unicode>
</char>
</property>
<property name="icon">
<iconset resource="../components/material_res.qrc">
<normaloff>:/icons/icons/communication/svg/production/ic_call_24px.svg</normaloff>:/icons/icons/communication/svg/production/ic_call_24px.svg</iconset>
</property>
<widget class="QtMaterialBadge" name="qtmaterialbadge">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>60</width>
<height>54</height>
</rect>
</property>
<property name="relativePosition">
<pointf>
<x>15.000000000000000</x>
<y>15.000000000000000</y>
</pointf>
</property>
</widget>
</widget>
</item>
<item row="12" column="1" colspan="3">
<widget class="QtMaterialSlider" name="qtmaterialslider">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QtMaterialCircularProgress" name="qtmaterialcircularprogress">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="size">
<double>40.000000000000000</double>
</property>
</widget>
</item>
<item row="14" column="2">
<widget class="QtMaterialToggle" name="qtmaterialtoggle_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="11" column="1" colspan="3">
<widget class="QtMaterialRaisedButton" name="qtmaterialraisedbutton">
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>RAISEBUTTON</string>
</property>
<property name="role">
<enum>MaterialConst::Secondary</enum>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QtMaterialIconButton" name="qtmaterialiconbutton">
<property name="icon">
<iconset resource="../components/material_res.qrc">
<normaloff>:/icons/icons/content/svg/production/ic_mail_24px.svg</normaloff>:/icons/icons/content/svg/production/ic_mail_24px.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_14">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>Dialog</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>CirculaProgress</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QtMaterialFlatButton" name="qtmaterialflatbutton_3">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Show Dialog</string>
</property>
<property name="icon">
<iconset resource="../components/material_res.qrc">
<normaloff>:/icons/icons/communication/svg/production/ic_chat_bubble_24px.svg</normaloff>:/icons/icons/communication/svg/production/ic_chat_bubble_24px.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="role">
<enum>MaterialConst::Primary</enum>
</property>
<property name="overlayStyle">
<enum>MaterialConst::TintedOverlay</enum>
</property>
<property name="iconPlacement">
<enum>MaterialConst::RightIcon</enum>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>Toggle</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Roboto</family>
</font>
</property>
<property name="text">
<string>AutoComplete</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QtMaterialRadioButton" name="qtmaterialradiobutton_2">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>RadioButton 2</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<customwidgets>
<customwidget>
<class>QtMaterialAutoComplete</class>
<extends>QtMaterialTextField</extends>
<header>qtmaterialautocomplete.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialAvatar</class>
<extends>QWidget</extends>
<header>qtmaterialavatar.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialBadge</class>
<extends>QWidget</extends>
<header>qtmaterialbadge.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialCheckBox</class>
<extends>QWidget</extends>
<header>qtmaterialcheckbox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialCircularProgress</class>
<extends>QProgressBar</extends>
<header>qtmaterialcircularprogress.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialFloatingActionButton</class>
<extends>QtMaterialRaisedButton</extends>
<header>qtmaterialfab.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialFlatButton</class>
<extends>QPushButton</extends>
<header>qtmaterialflatbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialIconButton</class>
<extends>QWidget</extends>
<header>qtmaterialiconbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialProgress</class>
<extends>QProgressBar</extends>
<header>qtmaterialprogress.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialRadioButton</class>
<extends>QWidget</extends>
<header>qtmaterialradiobutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialRaisedButton</class>
<extends>QtMaterialFlatButton</extends>
<header>qtmaterialraisedbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialSlider</class>
<extends>QWidget</extends>
<header>qtmaterialslider.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialTextField</class>
<extends>QLineEdit</extends>
<header>qtmaterialtextfield.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QtMaterialToggle</class>
<extends>QWidget</extends>
<header>qtmaterialtoggle.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../components/material_res.qrc"/>
<include location="../components/material_res.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -47,10 +47,10 @@ void ProgressSettingsEditor::setupForm()
{
switch (m_progress->progressType())
{
case Material::DeterminateProgress:
case MaterialConst::DeterminateProgress:
ui->progressTypeComboBox->setCurrentIndex(0);
break;
case Material::IndeterminateProgress:
case MaterialConst::IndeterminateProgress:
ui->progressTypeComboBox->setCurrentIndex(1);
break;
default:
@ -67,10 +67,10 @@ void ProgressSettingsEditor::updateWidget()
switch (ui->progressTypeComboBox->currentIndex())
{
case 0:
m_progress->setProgressType(Material::DeterminateProgress);
m_progress->setProgressType(MaterialConst::DeterminateProgress);
break;
case 1:
m_progress->setProgressType(Material::IndeterminateProgress);
m_progress->setProgressType(MaterialConst::IndeterminateProgress);
break;
default:
break;