Compare commits
No commits in common. "master" and "debug" have entirely different histories.
26
README.md
26
README.md
|
@ -1,6 +1,10 @@
|
|||
# Qt Material Design Desktop Widgets []() [](https://gitter.im/qt-material-widgets/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
# Qt Material Design Desktop Widgets
|
||||
|
||||
YouTube video preview [available here](http://www.youtube.com/watch?v=21UMeNVBPU4).
|
||||
[](https://gitter.im/qt-material-widgets/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
## :hatched_chick: Update!
|
||||
|
||||
I finally took the time to go through and clean up this code. The build includes an executable with a preview, and some settings to play around with for each widget. A YouTube video preview is [available here](http://www.youtube.com/watch?v=21UMeNVBPU4).
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
|
@ -20,19 +24,6 @@ YouTube video preview [available here](http://www.youtube.com/watch?v=21UMeNVBPU
|
|||
<img src="gifs/appbar.gif" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Auto Complete
|
||||
</td>
|
||||
<td>
|
||||
<code>QtMaterialAutoComplete</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
<img src="gifs/autocomplete.gif" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Avatar
|
||||
|
@ -273,7 +264,6 @@ YouTube video preview [available here](http://www.youtube.com/watch?v=21UMeNVBPU
|
|||
#### Implemented components
|
||||
|
||||
- [x] App Bar
|
||||
- [x] Auto Complete
|
||||
- [x] Avatar
|
||||
- [x] Badge
|
||||
- [x] Check Box
|
||||
|
@ -295,10 +285,10 @@ YouTube video preview [available here](http://www.youtube.com/watch?v=21UMeNVBPU
|
|||
|
||||
#### Work in progress
|
||||
|
||||
- [x] Autocomplete
|
||||
- [ ] Divider
|
||||
- [ ] List
|
||||
- [ ] List Item
|
||||
- [ ] Menu
|
||||
- [ ] Paper
|
||||
- [ ] Snackbar Layout
|
||||
- [ ] Table
|
||||
|
@ -310,8 +300,8 @@ YouTube video preview [available here](http://www.youtube.com/watch?v=21UMeNVBPU
|
|||
- [ ] Discrete Slider
|
||||
- [ ] Grid List
|
||||
- [ ] Icon Menu
|
||||
- [ ] Menu
|
||||
- [ ] Search Field
|
||||
- [ ] Select Field
|
||||
- [ ] Stepper
|
||||
- [ ] Subheaders
|
||||
- [ ] Toolbar
|
||||
|
|
|
@ -42,12 +42,7 @@ SOURCES = \
|
|||
qtmaterialautocomplete.cpp \
|
||||
qtmaterialpaper.cpp \
|
||||
qtmaterialtable.cpp \
|
||||
layouts/qtmaterialsnackbarlayout.cpp \
|
||||
qtmaterialautocomplete_internal.cpp \
|
||||
qtmaterialmenu.cpp \
|
||||
qtmaterialmenu_internal.cpp \
|
||||
qtmateriallist.cpp \
|
||||
qtmateriallistitem.cpp
|
||||
layouts/qtmaterialsnackbarlayout.cpp
|
||||
HEADERS = \
|
||||
qtmaterialavatar_p.h \
|
||||
qtmaterialavatar.h \
|
||||
|
@ -117,14 +112,6 @@ HEADERS = \
|
|||
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
|
||||
layouts/qtmaterialsnackbarlayout_p.h
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
#include <QtWidgets/QGraphicsDropShadowEffect>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QEvent>
|
||||
#include <QTimer>
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#include "qtmaterialautocomplete_internal.h"
|
||||
#include "qtmaterialflatbutton.h"
|
||||
|
||||
/*!
|
||||
|
@ -36,35 +33,25 @@ void QtMaterialAutoCompletePrivate::init()
|
|||
{
|
||||
Q_Q(QtMaterialAutoComplete);
|
||||
|
||||
menu = new QWidget;
|
||||
frame = new QWidget;
|
||||
stateMachine = new QtMaterialAutoCompleteStateMachine(menu);
|
||||
menuLayout = new QVBoxLayout;
|
||||
maxWidth = 0;
|
||||
menu = new QWidget;
|
||||
menuLayout = new QVBoxLayout;
|
||||
maxWidth = 0;
|
||||
|
||||
menu->setParent(q->parentWidget());
|
||||
frame->setParent(q->parentWidget());
|
||||
|
||||
menu->installEventFilter(q);
|
||||
frame->installEventFilter(q);
|
||||
|
||||
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
||||
effect->setBlurRadius(11);
|
||||
effect->setColor(QColor(0, 0, 0, 50));
|
||||
effect->setOffset(0, 3);
|
||||
|
||||
frame->setGraphicsEffect(effect);
|
||||
frame->setVisible(false);
|
||||
|
||||
menu->setGraphicsEffect(effect);
|
||||
menu->setLayout(menuLayout);
|
||||
menu->setVisible(false);
|
||||
|
||||
menuLayout->setContentsMargins(0, 0, 0, 0);
|
||||
menuLayout->setSpacing(0);
|
||||
|
||||
QObject::connect(q, SIGNAL(textEdited(QString)), q, SLOT(updateResults(QString)));
|
||||
|
||||
stateMachine->start();
|
||||
QObject::connect(q, SIGNAL(textChanged(QString)), q, SLOT(updateResults(QString)));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -100,7 +87,7 @@ void QtMaterialAutoComplete::updateResults(QString text)
|
|||
QString lookup(trimmed.toLower());
|
||||
QStringList::iterator i;
|
||||
for (i = d->dataSource.begin(); i != d->dataSource.end(); ++i) {
|
||||
if (i->toLower().indexOf(lookup) != -1) {
|
||||
if (i->toLower().startsWith(lookup)) {
|
||||
results.push_back(*i);
|
||||
}
|
||||
}
|
||||
|
@ -117,16 +104,19 @@ void QtMaterialAutoComplete::updateResults(QString text)
|
|||
item->setCornerRadius(0);
|
||||
item->setHaloVisible(false);
|
||||
item->setFixedHeight(50);
|
||||
item->setOverlayStyle(Material::TintedOverlay);
|
||||
d->menuLayout->addWidget(item);
|
||||
item->installEventFilter(this);
|
||||
//item->installEventFilter(this);
|
||||
}
|
||||
} else if (diff < 0) {
|
||||
for (int c = 0; c < -diff; c++) {
|
||||
QWidget *widget = d->menuLayout->itemAt(0)->widget();
|
||||
if (widget) {
|
||||
d->menuLayout->removeWidget(widget);
|
||||
delete widget;
|
||||
//widget->setParent(0);
|
||||
//qDebug() << widget->parent();
|
||||
//qDebug() << widget->parentWidget();
|
||||
//delete widget;
|
||||
widget->deleteLater();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -146,9 +136,9 @@ void QtMaterialAutoComplete::updateResults(QString text)
|
|||
}
|
||||
|
||||
if (!results.count()) {
|
||||
emit d->stateMachine->shouldClose();
|
||||
} else {
|
||||
emit d->stateMachine->shouldOpen();
|
||||
d->menu->hide();
|
||||
} else if (d->menu->isHidden()) {
|
||||
d->menu->show();
|
||||
}
|
||||
|
||||
d->menu->setFixedHeight(results.length()*50);
|
||||
|
@ -171,7 +161,6 @@ bool QtMaterialAutoComplete::QtMaterialAutoComplete::event(QEvent *event)
|
|||
QWidget *widget = static_cast<QWidget *>(parent());
|
||||
if (widget) {
|
||||
d->menu->setParent(widget);
|
||||
d->frame->setParent(widget);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -185,58 +174,15 @@ bool QtMaterialAutoComplete::eventFilter(QObject *watched, QEvent *event)
|
|||
{
|
||||
Q_D(QtMaterialAutoComplete);
|
||||
|
||||
if (d->frame == watched)
|
||||
switch (event->type())
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::Paint: {
|
||||
QPainter painter(d->frame);
|
||||
painter.fillRect(d->frame->rect(), Qt::white);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case QEvent::MouseButtonPress: {
|
||||
qDebug() << "mouse pressl";
|
||||
d->menu->hide();
|
||||
break;
|
||||
}
|
||||
else if (d->menu == watched)
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::Resize:
|
||||
case QEvent::Move: {
|
||||
d->frame->setGeometry(d->menu->geometry());
|
||||
break;
|
||||
}
|
||||
case QEvent::Show: {
|
||||
d->frame->show();
|
||||
d->menu->raise();
|
||||
break;
|
||||
}
|
||||
case QEvent::Hide: {
|
||||
d->frame->hide();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::MouseButtonPress: {
|
||||
emit d->stateMachine->shouldFade();
|
||||
QtMaterialFlatButton *widget;
|
||||
if ((widget = static_cast<QtMaterialFlatButton *>(watched))) {
|
||||
QString text(widget->text());
|
||||
setText(text);
|
||||
emit itemSelected(text);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QtMaterialTextField::eventFilter(watched, event);
|
||||
}
|
||||
|
|
|
@ -15,9 +15,6 @@ public:
|
|||
|
||||
void setDataSource(const QStringList &data);
|
||||
|
||||
signals:
|
||||
void itemSelected(QString);
|
||||
|
||||
protected slots:
|
||||
void updateResults(QString text);
|
||||
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
#include "qtmaterialautocomplete_internal.h"
|
||||
#include <QSignalTransition>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QtWidgets/QGraphicsOpacityEffect>
|
||||
#include <QDebug>
|
||||
|
||||
/*!
|
||||
* \class QtMaterialAutoCompleteStateMachine
|
||||
* \internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
*/
|
||||
QtMaterialAutoCompleteStateMachine::QtMaterialAutoCompleteStateMachine(QWidget *menu)
|
||||
: QStateMachine(menu),
|
||||
m_menu(menu),
|
||||
m_closedState(new QState),
|
||||
m_openState(new QState),
|
||||
m_closingState(new QState)
|
||||
{
|
||||
Q_ASSERT(menu);
|
||||
|
||||
addState(m_closedState);
|
||||
addState(m_openState);
|
||||
addState(m_closingState);
|
||||
setInitialState(m_closedState);
|
||||
|
||||
QSignalTransition *transition;
|
||||
|
||||
transition = new QSignalTransition(this, SIGNAL(shouldOpen()));
|
||||
transition->setTargetState(m_openState);
|
||||
m_closedState->addTransition(transition);
|
||||
|
||||
transition = new QSignalTransition(this, SIGNAL(shouldClose()));
|
||||
transition->setTargetState(m_closedState);
|
||||
m_openState->addTransition(transition);
|
||||
|
||||
transition = new QSignalTransition(this, SIGNAL(shouldFade()));
|
||||
transition->setTargetState(m_closingState);
|
||||
m_openState->addTransition(transition);
|
||||
|
||||
m_closedState->assignProperty(menu, "visible", false);
|
||||
m_openState->assignProperty(menu, "visible", true);
|
||||
|
||||
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
|
||||
menu->setGraphicsEffect(effect);
|
||||
|
||||
m_openState->assignProperty(effect, "opacity", 1);
|
||||
m_closingState->assignProperty(effect, "opacity", 0);
|
||||
m_closedState->assignProperty(effect, "opacity", 0);
|
||||
|
||||
QPropertyAnimation *animation;
|
||||
|
||||
animation = new QPropertyAnimation(effect, "opacity", this);
|
||||
animation->setDuration(240);
|
||||
addDefaultAnimation(animation);
|
||||
|
||||
transition = new QSignalTransition(animation, SIGNAL(finished()));
|
||||
transition->setTargetState(m_closedState);
|
||||
m_closingState->addTransition(transition);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
*/
|
||||
QtMaterialAutoCompleteStateMachine::~QtMaterialAutoCompleteStateMachine()
|
||||
{
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef QTMATERIALAUTOCOMPLETESTATEMACHINE_H
|
||||
#define QTMATERIALAUTOCOMPLETESTATEMACHINE_H
|
||||
|
||||
#include <QStateMachine>
|
||||
#include "qtmaterialautocomplete.h"
|
||||
|
||||
class QtMaterialAutoCompleteStateMachine : public QStateMachine
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QtMaterialAutoCompleteStateMachine(QWidget *menu);
|
||||
~QtMaterialAutoCompleteStateMachine();
|
||||
|
||||
signals:
|
||||
void shouldOpen();
|
||||
void shouldClose();
|
||||
void shouldFade();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QtMaterialAutoCompleteStateMachine)
|
||||
|
||||
QWidget *const m_menu;
|
||||
QState *const m_closedState;
|
||||
QState *const m_openState;
|
||||
QState *const m_closingState;
|
||||
};
|
||||
|
||||
#endif // QTMATERIALAUTOCOMPLETESTATEMACHINE_H
|
|
@ -6,7 +6,6 @@
|
|||
class QWidget;
|
||||
class QVBoxLayout;
|
||||
class QtMaterialAutoCompleteOverlay;
|
||||
class QtMaterialAutoCompleteStateMachine;
|
||||
|
||||
class QtMaterialAutoCompletePrivate : public QtMaterialTextFieldPrivate
|
||||
{
|
||||
|
@ -19,12 +18,10 @@ public:
|
|||
|
||||
void init();
|
||||
|
||||
QWidget *menu;
|
||||
QWidget *frame;
|
||||
QtMaterialAutoCompleteStateMachine *stateMachine;
|
||||
QVBoxLayout *menuLayout;
|
||||
QStringList dataSource;
|
||||
int maxWidth;
|
||||
QWidget *menu;
|
||||
QVBoxLayout *menuLayout;
|
||||
QStringList dataSource;
|
||||
int maxWidth;
|
||||
};
|
||||
|
||||
#endif // QTMATERIALAUTOCOMPLETE_P_H
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "qtmaterialavatar.h"
|
||||
#include "qtmaterialavatar_p.h"
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include "lib/qtmaterialstyle.h"
|
||||
|
||||
/*!
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <QPropertyAnimation>
|
||||
#include <QParallelAnimationGroup>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include "qtmaterialcircularprogress_internal.h"
|
||||
#include "lib/qtmaterialstyle.h"
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
#include "qtmateriallist.h"
|
||||
#include "qtmateriallist_p.h"
|
|
@ -1,4 +0,0 @@
|
|||
#ifndef QTMATERIALLIST_H
|
||||
#define QTMATERIALLIST_H
|
||||
|
||||
#endif // QTMATERIALLIST_H
|
|
@ -1,4 +0,0 @@
|
|||
#ifndef QTMATERIALLIST_P_H
|
||||
#define QTMATERIALLIST_P_H
|
||||
|
||||
#endif // QTMATERIALLIST_P_H
|
|
@ -1,2 +0,0 @@
|
|||
#include "qtmateriallistitem.h"
|
||||
#include "qtmateriallistitem_p.h"
|
|
@ -1,4 +0,0 @@
|
|||
#ifndef QTMATERIALLISTITEM_H
|
||||
#define QTMATERIALLISTITEM_H
|
||||
|
||||
#endif // QTMATERIALLISTITEM_H
|
|
@ -1,4 +0,0 @@
|
|||
#ifndef QTMATERIALLISTITEM_P_H
|
||||
#define QTMATERIALLISTITEM_P_H
|
||||
|
||||
#endif // QTMATERIALLISTITEM_P_H
|
|
@ -1,11 +0,0 @@
|
|||
#include "qtmaterialmenu.h"
|
||||
#include "qtmaterialmenu_p.h"
|
||||
|
||||
QtMaterialMenu::QtMaterialMenu(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QtMaterialMenu::~QtMaterialMenu()
|
||||
{
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef QTMATERIALMENU_H
|
||||
#define QTMATERIALMENU_H
|
||||
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
class QtMaterialMenu : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QtMaterialMenu(QWidget *parent = 0);
|
||||
~QtMaterialMenu();
|
||||
};
|
||||
|
||||
#endif // QTMATERIALMENU_H
|
|
@ -1,4 +0,0 @@
|
|||
#ifndef QTMATERIALMENU_INTERNAL_H
|
||||
#define QTMATERIALMENU_INTERNAL_H
|
||||
|
||||
#endif // QTMATERIALMENU_INTERNAL_H
|
|
@ -1,4 +0,0 @@
|
|||
#ifndef QTMATERIALMENU_P_H
|
||||
#define QTMATERIALMENU_P_H
|
||||
|
||||
#endif // QTMATERIALMENU_P_H
|
|
@ -2,7 +2,6 @@
|
|||
#include "qtmaterialprogress_p.h"
|
||||
#include <QPropertyAnimation>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include "qtmaterialprogress_internal.h"
|
||||
#include "lib/qtmaterialstyle.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "qtmaterialscrollbar.h"
|
||||
#include "qtmaterialscrollbar_p.h"
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QDebug>
|
||||
#include "qtmaterialscrollbar_internal.h"
|
||||
#include "lib/qtmaterialstyle.h"
|
||||
|
@ -198,8 +197,7 @@ void QtMaterialScrollBar::paintEvent(QPaintEvent *event)
|
|||
|
||||
painter.drawRect(trimmed);
|
||||
|
||||
const qreal q = (Qt::Horizontal == orientation() ? w : h) /
|
||||
static_cast<qreal>(maximum()-minimum()+pageStep()-1);
|
||||
const qreal q = h / static_cast<qreal>(maximum()-minimum()+pageStep()-1);
|
||||
|
||||
QRect handle = Qt::Horizontal == orientation()
|
||||
? QRect(sliderPosition()*q, y, pageStep()*q, h)
|
||||
|
|
|
@ -25,11 +25,11 @@ QtMaterialScrollBarStateMachine::QtMaterialScrollBarStateMachine(QtMaterialScrol
|
|||
|
||||
QEventTransition *transition;
|
||||
|
||||
transition = new QEventTransition(parent, QEvent::Enter);
|
||||
transition = new QEventTransition(parent, QEvent::HoverEnter);
|
||||
transition->setTargetState(m_focusState);
|
||||
m_blurState->addTransition(transition);
|
||||
|
||||
transition = new QEventTransition(parent, QEvent::Leave);
|
||||
transition = new QEventTransition(parent, QEvent::HoverLeave);
|
||||
transition->setTargetState(m_blurState);
|
||||
m_focusState->addTransition(transition);
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ private:
|
|||
Q_DISABLE_COPY(QtMaterialScrollBarStateMachine)
|
||||
|
||||
QtMaterialScrollBar *const m_scrollBar;
|
||||
QState *const m_focusState;
|
||||
QState *const m_blurState;
|
||||
QState *m_focusState;
|
||||
QState *m_blurState;
|
||||
qreal m_opacity;
|
||||
};
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ QtMaterialSnackbarStateMachine::QtMaterialSnackbarStateMachine(QtMaterialSnackba
|
|||
|
||||
animation = new QPropertyAnimation(this, "offset", this);
|
||||
animation->setEasingCurve(QEasingCurve::OutCubic);
|
||||
animation->setDuration(300);
|
||||
animation->setDuration(400);
|
||||
addDefaultAnimation(animation);
|
||||
|
||||
hiddenState->assignProperty(this, "offset", 1);
|
||||
|
|
|
@ -18,8 +18,6 @@ AutoCompleteSettingsEditor::AutoCompleteSettingsEditor(QWidget *parent)
|
|||
canvas->setStyleSheet("QWidget { background: white; }");
|
||||
layout->addWidget(canvas);
|
||||
|
||||
canvas->setMinimumHeight(900); //
|
||||
|
||||
//ui->setupUi(widget);
|
||||
layout->setContentsMargins(20, 20, 20, 20);
|
||||
|
||||
|
@ -88,7 +86,6 @@ AutoCompleteSettingsEditor::AutoCompleteSettingsEditor(QWidget *parent)
|
|||
m_autocomplete->setDataSource(states);
|
||||
|
||||
layout->addWidget(m_autocomplete);
|
||||
layout->addSpacing(600);
|
||||
layout->setAlignment(m_autocomplete, Qt::AlignCenter);
|
||||
|
||||
setupForm();
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QColorDialog>
|
||||
#include <qtmaterialdialog.h>
|
||||
#include <qtmaterialflatbutton.h>
|
||||
|
||||
DialogSettingsEditor::DialogSettingsEditor(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
|
@ -32,7 +31,7 @@ DialogSettingsEditor::DialogSettingsEditor(QWidget *parent)
|
|||
QVBoxLayout *dialogWidgetLayout = new QVBoxLayout;
|
||||
dialogWidget->setLayout(dialogWidgetLayout);
|
||||
|
||||
QtMaterialFlatButton *closeButton = new QtMaterialFlatButton("Close");
|
||||
QPushButton *closeButton = new QPushButton("Close");
|
||||
dialogWidgetLayout->addWidget(closeButton);
|
||||
dialogWidgetLayout->setAlignment(closeButton, Qt::AlignBottom | Qt::AlignCenter);
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ SOURCES = mainwindow.cpp \
|
|||
drawersettingseditor.cpp \
|
||||
scrollbarsettingseditor.cpp \
|
||||
appbarsettingseditor.cpp \
|
||||
autocompletesettingseditor.cpp \
|
||||
menusettingseditor.cpp
|
||||
autocompletesettingseditor.cpp
|
||||
HEADERS = mainwindow.h \
|
||||
avatarsettingseditor.h \
|
||||
badgesettingseditor.h \
|
||||
|
@ -44,8 +43,7 @@ HEADERS = mainwindow.h \
|
|||
drawersettingseditor.h \
|
||||
scrollbarsettingseditor.h \
|
||||
appbarsettingseditor.h \
|
||||
autocompletesettingseditor.h \
|
||||
menusettingseditor.h
|
||||
autocompletesettingseditor.h
|
||||
LIBS += $$top_builddir/components/$(OBJECTS_DIR)/libcomponents.a
|
||||
INCLUDEPATH += $$top_srcdir/components/
|
||||
TARGET = examples-exe
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "flatbuttonsettingseditor.h"
|
||||
#include <QColorDialog>
|
||||
#include <QDebug>
|
||||
#include <qtmaterialflatbutton.h>
|
||||
|
||||
FlatButtonSettingsEditor::FlatButtonSettingsEditor(QWidget *parent)
|
||||
|
@ -222,40 +221,40 @@ void FlatButtonSettingsEditor::selectColor()
|
|||
|
||||
void FlatButtonSettingsEditor::applyDefaultPreset()
|
||||
{
|
||||
ui->buttonRoleComboBox->setCurrentIndex(0);
|
||||
ui->rippleStyleComboBox->setCurrentIndex(1);
|
||||
ui->iconPlacementComboBox->setCurrentIndex(0);
|
||||
ui->hoverStyleComboBox->setCurrentIndex(2);
|
||||
ui->textAlignmentComboBox->setCurrentIndex(1);
|
||||
ui->transparentCheckBox->setChecked(true);
|
||||
ui->cornerRadiusSpinBox->setValue(3);
|
||||
ui->overlayOpacityDoubleSpinBox->setValue(0.13);
|
||||
ui->fontSizeDoubleSpinBox->setValue(10);
|
||||
ui->useThemeColorsCheckBox->setChecked(true);
|
||||
ui->showHaloCheckBox->setChecked(true);
|
||||
ui->checkableCheckBox->setChecked(false);
|
||||
ui->disabledCheckBox->setChecked(false);
|
||||
updateWidget();
|
||||
m_button->setRole(Material::Default);
|
||||
m_button->setRippleStyle(Material::PositionedRipple);
|
||||
m_button->setIconPlacement(Material::LeftIcon);
|
||||
m_button->setOverlayStyle(Material::GrayOverlay);
|
||||
m_button->setBackgroundMode(Qt::TransparentMode);
|
||||
m_button->setCornerRadius(3);
|
||||
m_button->setBaseOpacity(0.13);
|
||||
m_button->setFontSize(10);
|
||||
m_button->setUseThemeColors(true);
|
||||
m_button->setHaloVisible(true);
|
||||
m_button->setCheckable(false);
|
||||
m_button->setEnabled(true);
|
||||
m_button->setTextAlignment(Qt::AlignHCenter);
|
||||
m_button->applyPreset(Material::FlatPreset);
|
||||
setupForm();
|
||||
}
|
||||
|
||||
void FlatButtonSettingsEditor::applyCheckablePreset()
|
||||
{
|
||||
ui->buttonRoleComboBox->setCurrentIndex(0);
|
||||
ui->rippleStyleComboBox->setCurrentIndex(1);
|
||||
ui->iconPlacementComboBox->setCurrentIndex(0);
|
||||
ui->hoverStyleComboBox->setCurrentIndex(2);
|
||||
ui->textAlignmentComboBox->setCurrentIndex(1);
|
||||
ui->transparentCheckBox->setChecked(true);
|
||||
ui->cornerRadiusSpinBox->setValue(3);
|
||||
ui->overlayOpacityDoubleSpinBox->setValue(0.13);
|
||||
ui->fontSizeDoubleSpinBox->setValue(10);
|
||||
ui->useThemeColorsCheckBox->setChecked(true);
|
||||
ui->showHaloCheckBox->setChecked(true);
|
||||
ui->checkableCheckBox->setChecked(true);
|
||||
ui->disabledCheckBox->setChecked(false);
|
||||
updateWidget();
|
||||
m_button->setRole(Material::Default);
|
||||
m_button->setRippleStyle(Material::PositionedRipple);
|
||||
m_button->setIconPlacement(Material::LeftIcon);
|
||||
m_button->setOverlayStyle(Material::GrayOverlay);
|
||||
m_button->setBackgroundMode(Qt::TransparentMode);
|
||||
m_button->setCornerRadius(3);
|
||||
m_button->setBaseOpacity(0.13);
|
||||
m_button->setFontSize(10);
|
||||
m_button->setUseThemeColors(true);
|
||||
m_button->setHaloVisible(true);
|
||||
m_button->setCheckable(true);
|
||||
m_button->setEnabled(true);
|
||||
m_button->setTextAlignment(Qt::AlignHCenter);
|
||||
m_button->applyPreset(Material::CheckablePreset);
|
||||
setupForm();
|
||||
}
|
||||
|
||||
void FlatButtonSettingsEditor::init()
|
||||
|
@ -311,7 +310,8 @@ void FlatButtonSettingsEditor::init()
|
|||
connect(ui->buttonTextLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateWidget()));
|
||||
connect(ui->defaultPresetPushButton, SIGNAL(pressed()), this, SLOT(applyDefaultPreset()));
|
||||
connect(ui->checkablePresetPushButton, SIGNAL(pressed()), this, SLOT(applyCheckablePreset()));
|
||||
connect(m_button, SIGNAL(clicked(bool)), ui->checkedCheckBox, SLOT(setChecked(bool)));
|
||||
connect(m_button, SIGNAL(toggled(bool)), this, SLOT(setupForm()));
|
||||
|
||||
ui->buttonRoleComboBox->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "scrollbarsettingseditor.h"
|
||||
#include "appbarsettingseditor.h"
|
||||
#include "autocompletesettingseditor.h"
|
||||
#include "menusettingseditor.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
|
@ -62,7 +61,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ScrollBarSettingsEditor *scrollBar = new ScrollBarSettingsEditor;
|
||||
AppBarSettingsEditor *appBar = new AppBarSettingsEditor;
|
||||
AutoCompleteSettingsEditor *autocomplete = new AutoCompleteSettingsEditor;
|
||||
MenuSettingsEditor *menu = new MenuSettingsEditor;
|
||||
|
||||
stack->addWidget(appBar);
|
||||
stack->addWidget(autocomplete);
|
||||
|
@ -75,7 +73,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
stack->addWidget(fab);
|
||||
stack->addWidget(flatButton);
|
||||
stack->addWidget(iconButton);
|
||||
stack->addWidget(menu);
|
||||
stack->addWidget(progress);
|
||||
stack->addWidget(radioButton);
|
||||
stack->addWidget(raisedButton);
|
||||
|
@ -97,7 +94,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
list->addItem("Floating Action Button");
|
||||
list->addItem("Flat Button");
|
||||
list->addItem("Icon Button");
|
||||
list->addItem("Menu");
|
||||
list->addItem("Progress");
|
||||
list->addItem("Radio Button");
|
||||
list->addItem("Raised Button");
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
#include "menusettingseditor.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QDebug>
|
||||
#include <qtmaterialmenu.h>
|
||||
|
||||
MenuSettingsEditor::MenuSettingsEditor(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
//ui(new Ui::MenuSettingsForm),
|
||||
m_menu(new QtMaterialMenu)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
setLayout(layout);
|
||||
|
||||
QWidget *widget = new QWidget;
|
||||
layout->addWidget(widget);
|
||||
|
||||
QWidget *canvas = new QWidget;
|
||||
canvas->setStyleSheet("QWidget { background: white; }");
|
||||
layout->addWidget(canvas);
|
||||
|
||||
//ui->setupUi(widget);
|
||||
layout->setContentsMargins(20, 20, 20, 20);
|
||||
|
||||
layout = new QVBoxLayout;
|
||||
canvas->setLayout(layout);
|
||||
|
||||
layout->addWidget(m_menu);
|
||||
layout->addSpacing(600);
|
||||
layout->setAlignment(m_menu, Qt::AlignCenter);
|
||||
|
||||
setupForm();
|
||||
}
|
||||
|
||||
MenuSettingsEditor::~MenuSettingsEditor()
|
||||
{
|
||||
//delete ui;
|
||||
}
|
||||
|
||||
void MenuSettingsEditor::setupForm()
|
||||
{
|
||||
}
|
||||
|
||||
void MenuSettingsEditor::updateWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void MenuSettingsEditor::selectColor()
|
||||
{
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef MENUSETTINGSEDITOR_H
|
||||
#define MENUSETTINGSEDITOR_H
|
||||
|
||||
#include <QWidget>
|
||||
//#include "ui_menusettingsform.h"
|
||||
|
||||
#include "lib/qtmaterialoverlaywidget.h"
|
||||
|
||||
class QtMaterialMenu;
|
||||
|
||||
class MenuSettingsEditor : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MenuSettingsEditor(QWidget *parent = 0);
|
||||
~MenuSettingsEditor();
|
||||
|
||||
protected slots:
|
||||
void setupForm();
|
||||
void updateWidget();
|
||||
void selectColor();
|
||||
|
||||
private:
|
||||
//Ui::MenuSettingsForm *const ui;
|
||||
QtMaterialMenu *const m_menu;
|
||||
};
|
||||
|
||||
#endif // MENUSETTINGSEDITOR_H
|
|
@ -7,8 +7,7 @@
|
|||
ScrollBarSettingsEditor::ScrollBarSettingsEditor(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui(new Ui::ScrollBarSettingsForm),
|
||||
m_verticalScrollbar(new QtMaterialScrollBar),
|
||||
m_horizontalScrollbar(new QtMaterialScrollBar)
|
||||
m_scrollbar(new QtMaterialScrollBar)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
setLayout(layout);
|
||||
|
@ -29,17 +28,11 @@ ScrollBarSettingsEditor::ScrollBarSettingsEditor(QWidget *parent)
|
|||
|
||||
QTextEdit *edit = new QTextEdit;
|
||||
edit->setText("<p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p>");
|
||||
edit->setLineWrapMode(QTextEdit::NoWrap);
|
||||
edit->update();
|
||||
edit->setMaximumHeight(200);
|
||||
|
||||
edit->setVerticalScrollBar(m_verticalScrollbar);
|
||||
edit->setHorizontalScrollBar(m_horizontalScrollbar);
|
||||
|
||||
//m_verticalScrollbar->setHideOnMouseOut(false);
|
||||
|
||||
//m_horizontalScrollbar->setHideOnMouseOut(false);
|
||||
m_horizontalScrollbar->setOrientation(Qt::Horizontal);
|
||||
edit->setVerticalScrollBar(m_scrollbar);
|
||||
m_scrollbar->setHideOnMouseOut(false);
|
||||
|
||||
layout->addWidget(edit);
|
||||
layout->setAlignment(edit, Qt::AlignHCenter);
|
||||
|
|
|
@ -20,8 +20,7 @@ protected slots:
|
|||
|
||||
private:
|
||||
Ui::ScrollBarSettingsForm *const ui;
|
||||
QtMaterialScrollBar *const m_verticalScrollbar;
|
||||
QtMaterialScrollBar *const m_horizontalScrollbar;
|
||||
QtMaterialScrollBar *const m_scrollbar;
|
||||
};
|
||||
|
||||
#endif // SCROLLBARSETTINGSEDITOR_H
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 77 KiB |
Loading…
Reference in New Issue