Build out AppBar settings form
This commit is contained in:
parent
8eab4220d0
commit
b40b8a1a4e
|
@ -1,5 +1,6 @@
|
||||||
#include "appbarsettingseditor.h"
|
#include "appbarsettingseditor.h"
|
||||||
#include <QtWidgets/QVBoxLayout>
|
#include <QtWidgets/QVBoxLayout>
|
||||||
|
#include <QColorDialog>
|
||||||
#include <qtmaterialappbar.h>
|
#include <qtmaterialappbar.h>
|
||||||
#include <lib/qtmaterialtheme.h>
|
#include <lib/qtmaterialtheme.h>
|
||||||
|
|
||||||
|
@ -23,10 +24,14 @@ AppBarSettingsEditor::AppBarSettingsEditor(QWidget *parent)
|
||||||
|
|
||||||
layout = new QVBoxLayout;
|
layout = new QVBoxLayout;
|
||||||
canvas->setLayout(layout);
|
canvas->setLayout(layout);
|
||||||
|
canvas->setMaximumHeight(300);
|
||||||
layout->addWidget(m_appBar);
|
layout->addWidget(m_appBar);
|
||||||
layout->addStretch(1);
|
layout->addStretch(1);
|
||||||
|
|
||||||
setupForm();
|
setupForm();
|
||||||
|
|
||||||
|
connect(ui->useThemeColorsCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateWidget()));
|
||||||
|
connect(ui->backgroundColorToolButton, SIGNAL(pressed()), this, SLOT(selectColor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
AppBarSettingsEditor::~AppBarSettingsEditor()
|
AppBarSettingsEditor::~AppBarSettingsEditor()
|
||||||
|
@ -36,8 +41,24 @@ AppBarSettingsEditor::~AppBarSettingsEditor()
|
||||||
|
|
||||||
void AppBarSettingsEditor::setupForm()
|
void AppBarSettingsEditor::setupForm()
|
||||||
{
|
{
|
||||||
|
ui->useThemeColorsCheckBox->setChecked(m_appBar->useThemeColors());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppBarSettingsEditor::updateWidget()
|
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:
|
protected slots:
|
||||||
void setupForm();
|
void setupForm();
|
||||||
void updateWidget();
|
void updateWidget();
|
||||||
|
void selectColor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AppBarSettingsForm *const ui;
|
Ui::AppBarSettingsForm *const ui;
|
||||||
|
|
|
@ -13,19 +13,53 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QWidget" name="formLayoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>0</x>
|
||||||
<y>70</y>
|
<y>0</y>
|
||||||
<width>171</width>
|
<width>221</width>
|
||||||
<height>16</height>
|
<height>231</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="useThemeColorsLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TODO</string>
|
<string>Use theme colors</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</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>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
Loading…
Reference in New Issue