diff --git a/examples/appbarsettingseditor.cpp b/examples/appbarsettingseditor.cpp new file mode 100644 index 0000000..fac6618 --- /dev/null +++ b/examples/appbarsettingseditor.cpp @@ -0,0 +1,77 @@ +#include "appbarsettingseditor.h" +#include +#include + +AppBarSettingsEditor::AppBarSettingsEditor(QWidget *parent) + : QWidget(parent), + ui(new Ui::AppBarSettingsForm), + m_appbar(new QtMaterialAppBar(QChar('X'))) +{ + 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_appBar); + + setupForm(); +} + +AppBarSettingsEditor::~AppBarSettingsEditor() +{ + delete ui; +} + +void AppBarSettingsEditor::setupForm() +{ + //switch (m_avatar->type()) + //{ + //case Material::LetterAppBar: + // ui->typeComboBox->setCurrentIndex(0); + // break; + //case Material::ImageAppBar: + // ui->typeComboBox->setCurrentIndex(1); + // break; + //case Material::IconAppBar: + // ui->typeComboBox->setCurrentIndex(2); + // break; + //default: + // break; + //} + + //ui->disabledCheckBox->setChecked(!m_avatar->isEnabled()); + //ui->useThemeColorsCheckBox->setChecked(m_avatar->useThemeColors()); + //ui->sizeSpinBox->setValue(m_avatar->size()); +} + +void AppBarSettingsEditor::updateWidget() +{ + //switch (ui->typeComboBox->currentIndex()) + //{ + //case 0: + // m_avatar->setLetter(QChar('X')); + // break; + //case 1: + // m_avatar->setImage(QImage(":/images/assets/sikh.jpg")); + // break; + //case 2: + // m_avatar->setIcon(QtMaterialTheme::icon("communication", "message")); + // break; + //default: + // break; + //} + + //m_avatar->setDisabled(ui->disabledCheckBox->isChecked()); + //m_avatar->setUseThemeColors(ui->useThemeColorsCheckBox->isChecked()); + //m_avatar->setSize(ui->sizeSpinBox->value()); +} diff --git a/examples/appbarsettingseditor.h b/examples/appbarsettingseditor.h new file mode 100644 index 0000000..ebefee3 --- /dev/null +++ b/examples/appbarsettingseditor.h @@ -0,0 +1,26 @@ +#ifndef APPBARSETTINGSEDITOR_H +#define APPBARSETTINGSEDITOR_H + +#include +#include "ui_avatarsettingsform.h" + +class QtMaterialAppBar; + +class AppBarSettingsEditor : public QWidget +{ + Q_OBJECT + +public: + explicit AppBarSettingsEditor(QWidget *parent = 0); + ~AppBarSettingsEditor(); + +protected slots: + void setupForm(); + void updateWidget(); + +private: + Ui::AppBarSettingsForm *const ui; + QtMaterialAppBar *const m_appBar; +}; + +#endif // APPBARSETTINGSEDITOR_H diff --git a/examples/appbarsettingsform.ui b/examples/appbarsettingsform.ui new file mode 100644 index 0000000..c352576 --- /dev/null +++ b/examples/appbarsettingsform.ui @@ -0,0 +1,32 @@ + + + AppBarSettingsForm + + + + 0 + 0 + 474 + 387 + + + + Form + + + + + 10 + 70 + 171 + 16 + + + + TODO + + + + + + diff --git a/examples/examples.pro b/examples/examples.pro index 99d8639..2066db1 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -20,7 +20,8 @@ SOURCES = mainwindow.cpp \ snackbarsettingseditor.cpp \ dialogsettingseditor.cpp \ drawersettingseditor.cpp \ - scrollbarsettingseditor.cpp + scrollbarsettingseditor.cpp \ + appbarsettingseditor.cpp HEADERS = mainwindow.h \ avatarsettingseditor.h \ badgesettingseditor.h \ @@ -39,7 +40,8 @@ HEADERS = mainwindow.h \ snackbarsettingseditor.h \ dialogsettingseditor.h \ drawersettingseditor.h \ - scrollbarsettingseditor.h + scrollbarsettingseditor.h \ + appbarsettingseditor.h LIBS += $$top_builddir/components/$(OBJECTS_DIR)/libcomponents.a INCLUDEPATH += $$top_srcdir/components/ TARGET = examples-exe