Build out AppBar settings form
This commit is contained in:
parent
8eab4220d0
commit
b40b8a1a4e
|
@ -1,5 +1,6 @@
|
|||
#include "appbarsettingseditor.h"
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QColorDialog>
|
||||
#include <qtmaterialappbar.h>
|
||||
#include <lib/qtmaterialtheme.h>
|
||||
|
||||
|
@ -23,10 +24,14 @@ AppBarSettingsEditor::AppBarSettingsEditor(QWidget *parent)
|
|||
|
||||
layout = new QVBoxLayout;
|
||||
canvas->setLayout(layout);
|
||||
canvas->setMaximumHeight(300);
|
||||
layout->addWidget(m_appBar);
|
||||
layout->addStretch(1);
|
||||
|
||||
setupForm();
|
||||
|
||||
connect(ui->useThemeColorsCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateWidget()));
|
||||
connect(ui->backgroundColorToolButton, SIGNAL(pressed()), this, SLOT(selectColor()));
|
||||
}
|
||||
|
||||
AppBarSettingsEditor::~AppBarSettingsEditor()
|
||||
|
@ -36,8 +41,24 @@ AppBarSettingsEditor::~AppBarSettingsEditor()
|
|||
|
||||
void AppBarSettingsEditor::setupForm()
|
||||
{
|
||||
ui->useThemeColorsCheckBox->setChecked(m_appBar->useThemeColors());
|
||||
}
|
||||
|
||||
void AppBarSettingsEditor::updateWidget()
|
||||
{
|
||||
m_appBar->setUseThemeColors(ui->useThemeColorsCheckBox->isChecked());
|
||||
}
|
||||
|
||||
void AppBarSettingsEditor::selectColor()
|
||||
{
|
||||
QColorDialog dialog;
|
||||
if (dialog.exec()) {
|
||||
QColor color = dialog.selectedColor();
|
||||
QString senderName = sender()->objectName();
|
||||
if ("backgroundColorToolButton" == senderName) {
|
||||
m_appBar->setBackgroundColor(color);
|
||||
ui->backgroundColorLineEdit->setText(color.name(QColor::HexRgb));
|
||||
}
|
||||
}
|
||||
setupForm();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
protected slots:
|
||||
void setupForm();
|
||||
void updateWidget();
|
||||
void selectColor();
|
||||
|
||||
private:
|
||||
Ui::AppBarSettingsForm *const ui;
|
||||
|
|
|
@ -13,18 +13,52 @@
|
|||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QWidget" name="formLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>70</y>
|
||||
<width>171</width>
|
||||
<height>16</height>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>221</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TODO</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="useThemeColorsLabel">
|
||||
<property name="text">
|
||||
<string>Use theme colors</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="useThemeColorsCheckBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="backgroundColorLabel">
|
||||
<property name="text">
|
||||
<string>Background color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="backgroundColorLineEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="backgroundColorToolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
Loading…
Reference in New Issue