From 565c697a44f92e2132c639a5a3874d4bbdddadea Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 6 Oct 2013 19:22:21 +0300 Subject: [PATCH] Wrong field will be red. --HG-- branch : develop --- dialogs/dialogalongline.cpp | 2 + dialogs/dialogalongline.ui | 78 ++++++++++++++++++++- dialogs/dialogarc.cpp | 3 + dialogs/dialogarc.ui | 117 ++++++++++++++++++++++++++++++- dialogs/dialogbisector.cpp | 2 + dialogs/dialogbisector.ui | 78 ++++++++++++++++++++- dialogs/dialogdetail.ui | 2 +- dialogs/dialogendline.cpp | 2 + dialogs/dialogendline.ui | 78 ++++++++++++++++++++- dialogs/dialoglineintersect.cpp | 1 + dialogs/dialoglineintersect.ui | 39 ++++++++++- dialogs/dialognormal.cpp | 2 + dialogs/dialognormal.ui | 78 ++++++++++++++++++++- dialogs/dialogpointofcontact.cpp | 2 + dialogs/dialogpointofcontact.ui | 78 ++++++++++++++++++++- dialogs/dialogshoulderpoint.cpp | 2 + dialogs/dialogshoulderpoint.ui | 78 ++++++++++++++++++++- dialogs/dialogsinglepoint.cpp | 1 + dialogs/dialogsinglepoint.ui | 39 ++++++++++- dialogs/dialogtool.cpp | 21 +++++- dialogs/dialogtool.h | 2 + mainwindow.cpp | 2 + mainwindow.ui | 6 +- 23 files changed, 690 insertions(+), 23 deletions(-) diff --git a/dialogs/dialogalongline.cpp b/dialogs/dialogalongline.cpp index 7633d0e30..87cf627c6 100644 --- a/dialogs/dialogalongline.cpp +++ b/dialogs/dialogalongline.cpp @@ -34,6 +34,8 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogAlongLine::DialogAccepted); diff --git a/dialogs/dialogalongline.ui b/dialogs/dialogalongline.ui index b5a3b3b60..acfb90561 100644 --- a/dialogs/dialogalongline.ui +++ b/dialogs/dialogalongline.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -100,7 +137,44 @@ - + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index 2cfea8689..5c5d864a5 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -194,14 +194,17 @@ void DialogArc::CheckState(){ } void DialogArc::EvalRadius(){ + labelEditFormula = ui->labelEditRadius; Eval(ui->lineEditRadius, flagRadius, timerRadius, ui->labelResultRadius); } void DialogArc::EvalF1(){ + labelEditFormula = ui->labelEditF1; Eval(ui->lineEditF1, flagF1, timerF1, ui->labelResultF1); } void DialogArc::EvalF2(){ + labelEditFormula = ui->labelEditF2; Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2); } diff --git a/dialogs/dialogarc.ui b/dialogs/dialogarc.ui index 590d45ae8..26d4e43bb 100644 --- a/dialogs/dialogarc.ui +++ b/dialogs/dialogarc.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Radius @@ -116,13 +153,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + First angle degree @@ -208,13 +282,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Second angle degree diff --git a/dialogs/dialogbisector.cpp b/dialogs/dialogbisector.cpp index c03837c6a..83520735d 100644 --- a/dialogs/dialogbisector.cpp +++ b/dialogs/dialogbisector.cpp @@ -34,6 +34,8 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogBisector::DialogAccepted); diff --git a/dialogs/dialogbisector.ui b/dialogs/dialogbisector.ui index 1425f6b1a..a4253118a 100644 --- a/dialogs/dialogbisector.ui +++ b/dialogs/dialogbisector.ui @@ -21,13 +21,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -97,13 +134,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogdetail.ui b/dialogs/dialogdetail.ui index acecad702..7f1370ed1 100644 --- a/dialogs/dialogdetail.ui +++ b/dialogs/dialogdetail.ui @@ -28,7 +28,7 @@ - + 0 diff --git a/dialogs/dialogendline.cpp b/dialogs/dialogendline.cpp index def24c322..386f37b09 100644 --- a/dialogs/dialogendline.cpp +++ b/dialogs/dialogendline.cpp @@ -39,6 +39,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget * radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogEndLine::DialogAccepted); diff --git a/dialogs/dialogendline.ui b/dialogs/dialogendline.ui index d99626dfe..2b4c079ee 100644 --- a/dialogs/dialogendline.ui +++ b/dialogs/dialogendline.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -141,13 +178,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialoglineintersect.cpp b/dialogs/dialoglineintersect.cpp index 795a6f132..5f18a1a31 100644 --- a/dialogs/dialoglineintersect.cpp +++ b/dialogs/dialoglineintersect.cpp @@ -29,6 +29,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod number = 0; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogLineIntersect::DialogAccepted); + labelEditNamePoint = ui->labelEditNamePoint; flagName = false; QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected); diff --git a/dialogs/dialoglineintersect.ui b/dialogs/dialoglineintersect.ui index 8cc5124f8..25b5f8e95 100644 --- a/dialogs/dialoglineintersect.ui +++ b/dialogs/dialoglineintersect.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialognormal.cpp b/dialogs/dialognormal.cpp index 8e79ee9d4..5d52eb5ee 100644 --- a/dialogs/dialognormal.cpp +++ b/dialogs/dialognormal.cpp @@ -36,6 +36,8 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogNormal::DialogAccepted); diff --git a/dialogs/dialognormal.ui b/dialogs/dialognormal.ui index 7af8b7327..26d182650 100644 --- a/dialogs/dialognormal.ui +++ b/dialogs/dialognormal.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -100,13 +137,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogpointofcontact.cpp b/dialogs/dialogpointofcontact.cpp index 2c7151103..2f0d85b14 100644 --- a/dialogs/dialogpointofcontact.cpp +++ b/dialogs/dialogpointofcontact.cpp @@ -33,6 +33,8 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m radioButtonIncrements = ui.radioButtonIncrements; radioButtonLengthLine = ui.radioButtonLengthLine; lineEditFormula = ui.lineEditFormula; + labelEditFormula = ui.labelEditFormula; + labelEditNamePoint = ui.labelEditNamePoint; flagFormula = false; bOk = ui.buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogPointOfContact::DialogAccepted); diff --git a/dialogs/dialogpointofcontact.ui b/dialogs/dialogpointofcontact.ui index 0f6218720..4e28260b2 100644 --- a/dialogs/dialogpointofcontact.ui +++ b/dialogs/dialogpointofcontact.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Radius @@ -100,13 +137,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogshoulderpoint.cpp b/dialogs/dialogshoulderpoint.cpp index be28ab325..4197aaebe 100644 --- a/dialogs/dialogshoulderpoint.cpp +++ b/dialogs/dialogshoulderpoint.cpp @@ -35,6 +35,8 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogShoulderPoint::DialogAccepted); diff --git a/dialogs/dialogshoulderpoint.ui b/dialogs/dialogshoulderpoint.ui index a6be756bd..f0b4d9e27 100644 --- a/dialogs/dialogshoulderpoint.ui +++ b/dialogs/dialogshoulderpoint.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -100,13 +137,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogsinglepoint.cpp b/dialogs/dialogsinglepoint.cpp index b6807a1ec..276dd9542 100644 --- a/dialogs/dialogsinglepoint.cpp +++ b/dialogs/dialogsinglepoint.cpp @@ -33,6 +33,7 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) : ui->doubleSpinBoxX->setRange(0,PaperSize/PrintDPI*25.4); ui->doubleSpinBoxY->setRange(0,PaperSize/PrintDPI*25.4); bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + labelEditNamePoint = ui->labelEditName; flagName = false; CheckState(); connect(bOk, &QPushButton::clicked, this, &DialogSinglePoint::DialogAccepted); diff --git a/dialogs/dialogsinglepoint.ui b/dialogs/dialogsinglepoint.ui index d6c3f1aa9..eb2d385d1 100644 --- a/dialogs/dialogsinglepoint.ui +++ b/dialogs/dialogsinglepoint.ui @@ -64,7 +64,7 @@ - + 170 @@ -73,6 +73,43 @@ 17 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Point name diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index c997d9812..ccb701f24 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -28,8 +28,8 @@ DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent):QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0), - lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), - radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0), + lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), labelEditNamePoint(0), + labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0), radioButtonLengthLine(0), idDetail(0), mode(mode){ Q_CHECK_PTR(data); timerFormula = new QTimer(this); @@ -146,9 +146,13 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){ Q_CHECK_PTR(edit); Q_CHECK_PTR(timer); + Q_CHECK_PTR(labelEditFormula); if(edit->text().isEmpty()){ flag = false; CheckState(); + QPalette palette = labelEditFormula->palette(); + palette.setColor(labelEditFormula->foregroundRole(), Qt::red); + labelEditFormula->setPalette(palette); return; } timer->start(1000); @@ -158,8 +162,11 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) Q_CHECK_PTR(edit); Q_CHECK_PTR(timer); Q_CHECK_PTR(label); + Q_CHECK_PTR(labelEditFormula); + QPalette palette = labelEditFormula->palette(); if(edit->text().isEmpty()){ flag = false; + palette.setColor(labelEditFormula->foregroundRole(), Qt::red); } else { Calculator cal(data); QString errorMsg; @@ -167,13 +174,16 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) if(!errorMsg.isEmpty()){ label->setText(tr("Error")); flag = false; + palette.setColor(labelEditFormula->foregroundRole(), Qt::red); } else { label->setText(QString().setNum(result)); flag = true; + palette.setColor(labelEditFormula->foregroundRole(), QColor(76,76,76)); } } CheckState(); timer->stop(); + labelEditFormula->setPalette(palette); } void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, @@ -207,13 +217,20 @@ void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){ } void DialogTool::NamePointChanged(){ + Q_CHECK_PTR(labelEditNamePoint); QLineEdit* edit = qobject_cast(sender()); if (edit){ QString name = edit->text(); if(name.isEmpty() || name.contains(" ")){ flagName = false; + QPalette palette = labelEditNamePoint->palette(); + palette.setColor(labelEditNamePoint->foregroundRole(), Qt::red); + labelEditNamePoint->setPalette(palette); } else { flagName = true; + QPalette palette = labelEditNamePoint->palette(); + palette.setColor(labelEditNamePoint->foregroundRole(), QColor(76,76,76)); + labelEditNamePoint->setPalette(palette); } } CheckState(); diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index e48d68aa9..b3655df27 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -79,6 +79,8 @@ protected: QListWidget *listWidget; QLabel *labelResultCalculation; QLabel *labelDescription; + QLabel *labelEditNamePoint; + QLabel *labelEditFormula; QRadioButton *radioButtonSizeGrowth; QRadioButton *radioButtonStandartTable; QRadioButton *radioButtonIncrements; diff --git a/mainwindow.cpp b/mainwindow.cpp index ee35f0263..e4a612332 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -108,6 +108,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->actionAbout_Qt, &QAction::triggered, this, &MainWindow::AboutQt); connect(ui->actionAbout_Valentina, &QAction::triggered, this, &MainWindow::About); connect(ui->actionExit, &QAction::triggered, this, &MainWindow::close); + + ui->toolBox->setCurrentIndex(0); } void MainWindow::ActionNewDraw(){ diff --git a/mainwindow.ui b/mainwindow.ui index f04705dd9..5a99c2733 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -40,7 +40,7 @@ - 4 + 0 @@ -303,7 +303,7 @@ 0 0 - 150 + 137 58 @@ -379,7 +379,7 @@ 0 0 - 150 + 137 58