|
@@ -1,4 +1,4 @@
|
|
|
-#include "CreateProjView.h"
|
|
|
+#include "CreateProjWidget.h"
|
|
|
|
|
|
#include <Widgets/LineEdit.h>
|
|
|
#include <Widgets/Button.h>
|
|
@@ -9,7 +9,7 @@
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
-CreateProjView::CreateProjView(QWidget *parent) : QWidget(parent)
|
|
|
+CreateProjWidget::CreateProjWidget(QWidget *parent) : QWidget(parent)
|
|
|
{
|
|
|
initWindow();
|
|
|
initialize();
|
|
@@ -17,29 +17,29 @@ CreateProjView::CreateProjView(QWidget *parent) : QWidget(parent)
|
|
|
connectSignalsAndSlots();
|
|
|
}
|
|
|
|
|
|
-const QString CreateProjView::projName() const
|
|
|
+const QString CreateProjWidget::projName() const
|
|
|
{
|
|
|
return m_nameLineEdit->text();
|
|
|
}
|
|
|
|
|
|
-bool CreateProjView::importanceSelected() const
|
|
|
+bool CreateProjWidget::importanceSelected() const
|
|
|
{
|
|
|
return m_importanceCheckBox->isChecked();
|
|
|
}
|
|
|
|
|
|
-bool CreateProjView::schemeSelected() const
|
|
|
+bool CreateProjWidget::schemeSelected() const
|
|
|
{
|
|
|
return m_schemeCheckBox->isChecked();
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::clearInputs()
|
|
|
+void CreateProjWidget::clearInputs()
|
|
|
{
|
|
|
m_nameLineEdit->clear();
|
|
|
m_importanceCheckBox->setChecked(false);
|
|
|
m_schemeCheckBox->setChecked(false);
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::initWindow()
|
|
|
+void CreateProjWidget::initWindow()
|
|
|
{
|
|
|
setWindowTitle("新建工程");
|
|
|
setWindowFlags(Qt::Window);
|
|
@@ -47,7 +47,7 @@ void CreateProjView::initWindow()
|
|
|
resize(400, 200);
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::initialize()
|
|
|
+void CreateProjWidget::initialize()
|
|
|
{
|
|
|
m_gridLayout = new QGridLayout(this);
|
|
|
m_nameLabel = new QLabel(this);
|
|
@@ -65,7 +65,7 @@ void CreateProjView::initialize()
|
|
|
m_cancelButton = new PushButton("取消", this);
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::initLayout()
|
|
|
+void CreateProjWidget::initLayout()
|
|
|
{
|
|
|
m_gridLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
|
|
m_gridLayout->setContentsMargins(50, 20, 50, 20);
|
|
@@ -84,16 +84,16 @@ void CreateProjView::initLayout()
|
|
|
m_gridLayout->addWidget(m_cancelButton, 10, 5, 1, 1, Qt::AlignLeft);
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::connectSignalsAndSlots()
|
|
|
+void CreateProjWidget::connectSignalsAndSlots()
|
|
|
{
|
|
|
- connect(m_nameLineEdit, &LineEdit::textChanged, this, &CreateProjView::slotTextChanged);
|
|
|
- connect(m_importanceCheckBox, &CheckBox::stateChanged, this, &CreateProjView::slotCheckBoxChanged);
|
|
|
- connect(m_schemeCheckBox, &CheckBox::stateChanged, this, &CreateProjView::slotCheckBoxChanged);
|
|
|
- connect(m_createButton, &PushButton::clicked, this, &CreateProjView::slotCreateClicked);
|
|
|
- connect(m_cancelButton, &PushButton::clicked, this, &CreateProjView::slotCancelClicked);
|
|
|
+ connect(m_nameLineEdit, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
+ connect(m_importanceCheckBox, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
|
|
|
+ connect(m_schemeCheckBox, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
|
|
|
+ connect(m_createButton, &PushButton::clicked, this, &CreateProjWidget::slotCreateClicked);
|
|
|
+ connect(m_cancelButton, &PushButton::clicked, this, &CreateProjWidget::slotCancelClicked);
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::updateCreateButtonState()
|
|
|
+void CreateProjWidget::updateCreateButtonState()
|
|
|
{
|
|
|
bool nameValid = m_nameLineEdit->text().length() > 0;
|
|
|
bool typeValid = m_importanceCheckBox->isChecked() || m_schemeCheckBox->isChecked();
|
|
@@ -101,24 +101,24 @@ void CreateProjView::updateCreateButtonState()
|
|
|
m_createButton->setEnabled(nameValid && typeValid);
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::slotTextChanged(const QString &text)
|
|
|
+void CreateProjWidget::slotTextChanged(const QString &text)
|
|
|
{
|
|
|
m_nameLineEdit->setText(text.trimmed());
|
|
|
updateCreateButtonState();
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::slotCheckBoxChanged(int)
|
|
|
+void CreateProjWidget::slotCheckBoxChanged(int)
|
|
|
{
|
|
|
updateCreateButtonState();
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::slotCreateClicked()
|
|
|
+void CreateProjWidget::slotCreateClicked()
|
|
|
{
|
|
|
emit signalCreate();
|
|
|
close();
|
|
|
}
|
|
|
|
|
|
-void CreateProjView::slotCancelClicked()
|
|
|
+void CreateProjWidget::slotCancelClicked()
|
|
|
{
|
|
|
close();
|
|
|
}
|