ui: Added toggle for advanced settings
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
QtProjectWizzardContentSummary::QtProjectWizzardContentSummary(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
, m_layout(nullptr)
|
||||
, m_checkBox(nullptr)
|
||||
, m_checkBoxRow(0)
|
||||
, m_isForm(false)
|
||||
{
|
||||
}
|
||||
@@ -93,13 +98,21 @@ void QtProjectWizzardContentSummary::populateForm(QGridLayout* layout, int& row)
|
||||
layout->addWidget(separator, row++, 0, 1, -1);
|
||||
|
||||
QLabel* advancedLabel = createFormLabel("ADVANCED");
|
||||
layout->addWidget(advancedLabel, row++, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
|
||||
layout->addWidget(advancedLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
|
||||
|
||||
layout->setRowMinimumHeight(row++, 15);
|
||||
m_layout = layout;
|
||||
m_checkBoxRow = row;
|
||||
m_checkBox = new QCheckBox("Show advanced settings");
|
||||
layout->addWidget(m_checkBox, row++, QtProjectWizzardWindow::BACK_COL);
|
||||
connect(m_checkBox, SIGNAL(clicked(bool)), this, SLOT(advancedToggled(bool)));
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
layout->setRowMinimumHeight(row, 10);
|
||||
layout->setRowStretch(row, 1);
|
||||
|
||||
advancedToggled(false);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::load()
|
||||
@@ -135,3 +148,26 @@ bool QtProjectWizzardContentSummary::isScrollAble() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::advancedToggled(bool checked)
|
||||
{
|
||||
for (int row = m_checkBoxRow + 1; row < m_layout->rowCount() - 1; row++)
|
||||
{
|
||||
m_layout->setRowMinimumHeight(row, checked ? 15 : 0);
|
||||
}
|
||||
|
||||
for (int i = m_layout->count() - 1; i >= 0; i--)
|
||||
{
|
||||
int r, c, rs, cs;
|
||||
m_layout->getItemPosition(i, &r, &c, &rs, &cs);
|
||||
|
||||
if (r > m_checkBoxRow)
|
||||
{
|
||||
QLayoutItem *item = m_layout->itemAt(i);
|
||||
if (item && item->widget())
|
||||
{
|
||||
item->widget()->setVisible(checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
class QtProjectWizzardContentSummary
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
struct Element
|
||||
{
|
||||
@@ -31,9 +35,16 @@ protected:
|
||||
|
||||
virtual bool isScrollAble() const override;
|
||||
|
||||
private slots:
|
||||
void advancedToggled(bool checked);
|
||||
|
||||
private:
|
||||
std::vector<Element> m_elements;
|
||||
|
||||
QGridLayout* m_layout;
|
||||
QCheckBox* m_checkBox;
|
||||
int m_checkBoxRow;
|
||||
|
||||
bool m_isForm;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user