Divider: one pixel heigth, cleaned up the demo removing the underline of the textfields and removing the padding/spacing of the layout (and a stretch)

This commit is contained in:
fperillo 2017-10-05 23:19:00 +02:00
parent 403addec6d
commit 16c112d16d
2 changed files with 21 additions and 21 deletions

View File

@ -3,12 +3,14 @@
#include <QColorDialog>
#include <QLabel>
#include <qtmaterialdivider.h>
#include <qtmaterialtextfield.h>
DividerSettingsEditor::DividerSettingsEditor(QWidget *parent)
: QWidget(parent),
ui(new Ui::DividerSettingsForm),
m_divider(new QtMaterialDivider)
m_divider1(new QtMaterialDivider),
m_divider2(new QtMaterialDivider),
m_textfield1(new QtMaterialTextField),
m_textfield2(new QtMaterialTextField)
{
QVBoxLayout *layout = new QVBoxLayout;
setLayout(layout);
@ -21,30 +23,24 @@ DividerSettingsEditor::DividerSettingsEditor(QWidget *parent)
layout->addWidget(canvas);
ui->setupUi(widget);
// layout->setContentsMargins(20, 20, 20, 20);
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins(20, 20, 20, 20);
// layout->setContentsMargins(0, 0, 0, 0);
QLabel *lbl = new QLabel;
lbl->setText( "1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 " );
m_textfield1->setLabel( "First Name" );
m_textfield1->setPlaceholderText( "Placeholder" );
m_textfield1->setShowUnderline( false );
QtMaterialTextField *txt1 = new QtMaterialTextField;
txt1->setLabel( "First Name" );
txt1->setPlaceholderText( "Placeholder" );
QtMaterialTextField *txt2 = new QtMaterialTextField;
txt2->setLabel( "Middle Name" );
QtMaterialDivider *div2 = new QtMaterialDivider;
div2->setInsetSize( 40 );
m_textfield2->setLabel( "Middle Name" );
m_textfield2->setShowUnderline( false );
layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
canvas->setLayout(layout);
layout->addWidget(txt1);
layout->addWidget(m_divider);
layout->addWidget(txt2);
layout->addWidget(div2);
layout->addWidget(lbl);
layout->addWidget(m_textfield1);
layout->addWidget(m_divider1);
layout->addWidget(m_textfield2);
layout->addWidget(m_divider2);
layout->addStretch();
setupForm();

View File

@ -3,6 +3,7 @@
#include <QWidget>
#include "ui_dividersettingsform.h"
#include <qtmaterialtextfield.h>
class QtMaterialDivider;
@ -20,7 +21,10 @@ protected slots:
private:
Ui::DividerSettingsForm *const ui;
QtMaterialDivider *const m_divider;
QtMaterialDivider *const m_divider1;
QtMaterialDivider *const m_divider2;
QtMaterialTextField *const m_textfield1;
QtMaterialTextField *const m_textfield2;
};
#endif // DIVIDERSETTINGSEDITOR_H