Field formula set focus when we add new variable to formula.

--HG--
branch : develop
This commit is contained in:
dismine 2013-10-04 19:51:03 +03:00
parent dbc2578c71
commit da8e2c55f9
5 changed files with 64 additions and 62 deletions

View File

@ -153,7 +153,7 @@ void DialogArc::ValChenged(int row){
QListWidgetItem *item = ui->listWidget->item( row ); QListWidgetItem *item = ui->listWidget->item( row );
if(ui->radioButtonLineAngles->isChecked()){ if(ui->radioButtonLineAngles->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineArc(item->text())) QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineArc(item->text()))
.arg("Значення кута лінії."); .arg(tr("Value angle of line."));
ui->labelDescription->setText(desc); ui->labelDescription->setText(desc);
return; return;
} }

View File

@ -59,7 +59,7 @@ void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){
NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour); NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour);
break; break;
default: default:
qWarning()<<"Get wrong scene object. Ignore."; qWarning()<<tr("Get wrong scene object. Ignore.");
break; break;
} }
this->show(); this->show();
@ -120,7 +120,7 @@ void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, No
break; break;
} }
default: default:
qWarning()<<"Get wrong tools. Ignore."; qWarning()<<tr("Get wrong tools. Ignore.");
break; break;
} }

View File

@ -147,14 +147,14 @@ QString DialogHistory::Record(const VToolRecord &tool){
case Tool::ArrowTool: case Tool::ArrowTool:
break; break;
case Tool::SinglePointTool: case Tool::SinglePointTool:
record = QString("%1 - Базова точка").arg(data->GetPoint(tool.getId()).name()); record = QString(tr("%1 - Base point")).arg(data->GetPoint(tool.getId()).name());
break; break;
case Tool::EndLineTool: case Tool::EndLineTool:
domElement = doc->elementById(QString().setNum(tool.getId())); domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){ if(domElement.isElement()){
basePointId = domElement.attribute("basePoint", "").toLongLong(); basePointId = domElement.attribute("basePoint", "").toLongLong();
} }
record = QString("%1_%2 - Відрізок з точки %1 до точки %2").arg(data->GetPoint(basePointId).name(), record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
break; break;
case Tool::LineTool: case Tool::LineTool:
@ -163,7 +163,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
firstPointId = domElement.attribute("firstPoint", "").toLongLong(); firstPointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong();
} }
record = QString("%1_%2 - Лінія з точки %1 до точки %2").arg(data->GetPoint(firstPointId).name(), record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(firstPointId).name(),
data->GetPoint(secondPointId).name()); data->GetPoint(secondPointId).name());
break; break;
case Tool::AlongLineTool: case Tool::AlongLineTool:
@ -172,12 +172,12 @@ QString DialogHistory::Record(const VToolRecord &tool){
basePointId = domElement.attribute("firstPoint", "").toLongLong(); basePointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong();
} }
record = QString("%3 - Точка на відрізку %1_%2").arg(data->GetPoint(basePointId).name(), record = QString(tr("%3 - Point along line %1_%2")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(secondPointId).name(), data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
break; break;
case Tool::ShoulderPointTool: case Tool::ShoulderPointTool:
record = QString("%1 - Плечева точка").arg(data->GetPoint(tool.getId()).name()); record = QString(tr("%1 - Point of soulder")).arg(data->GetPoint(tool.getId()).name());
break; break;
case Tool::NormalTool: case Tool::NormalTool:
domElement = doc->elementById(QString().setNum(tool.getId())); domElement = doc->elementById(QString().setNum(tool.getId()));
@ -185,7 +185,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
basePointId = domElement.attribute("firstPoint", "").toLongLong(); basePointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong();
} }
record = QString("%3 - Перпендикуляр до відрузку %1_%2").arg(data->GetPoint(basePointId).name(), record = QString(tr("%3 - Normal to line %1_%2")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(secondPointId).name(), data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
break; break;
@ -196,7 +196,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
basePointId = domElement.attribute("secondPoint", "").toLongLong(); basePointId = domElement.attribute("secondPoint", "").toLongLong();
thirdPointId = domElement.attribute("thirdPoint", "").toLongLong(); thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
} }
record = QString("%4 - Бісектриса кута %1_%2_%3").arg(data->GetPoint(firstPointId).name(), record = QString(tr("%4 - Bisector of angle %1_%2_%3")).arg(data->GetPoint(firstPointId).name(),
data->GetPoint(basePointId).name(), data->GetPoint(basePointId).name(),
data->GetPoint(thirdPointId).name(), data->GetPoint(thirdPointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
@ -209,7 +209,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
p1Line2 = domElement.attribute("p1Line2", "").toLongLong(); p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
p2Line2 = domElement.attribute("p2Line2", "").toLongLong(); p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
} }
record = QString("%5 - Точка перетину відрузку %1_%2 і %3_%4").arg(data->GetPoint(p1Line1).name(), record = QString(tr("%5 - Point of intersection lines %1_%2 and %3_%4")).arg(data->GetPoint(p1Line1).name(),
data->GetPoint(p2Line1).name(), data->GetPoint(p2Line1).name(),
data->GetPoint(p1Line2).name(), data->GetPoint(p1Line2).name(),
data->GetPoint(p2Line2).name(), data->GetPoint(p2Line2).name(),
@ -217,20 +217,20 @@ QString DialogHistory::Record(const VToolRecord &tool){
break; break;
case Tool::SplineTool:{ case Tool::SplineTool:{
VSpline spl = data->GetSpline(tool.getId()); VSpline spl = data->GetSpline(tool.getId());
record = QString("Сплайн %1_%2").arg(data->GetPoint(spl.GetP1()).name(), record = QString(tr("Curve %1_%2")).arg(data->GetPoint(spl.GetP1()).name(),
data->GetPoint(spl.GetP4()).name()); data->GetPoint(spl.GetP4()).name());
} }
break; break;
case Tool::ArcTool:{ case Tool::ArcTool:{
VArc arc = data->GetArc(tool.getId()); VArc arc = data->GetArc(tool.getId());
record = QString("Дуга з центром в точці %1").arg(data->GetPoint(arc.GetCenter()).name()); record = QString(tr("Arc with center in point %1")).arg(data->GetPoint(arc.GetCenter()).name());
} }
break; break;
case Tool::SplinePathTool:{ case Tool::SplinePathTool:{
VSplinePath splPath = data->GetSplinePath(tool.getId()); VSplinePath splPath = data->GetSplinePath(tool.getId());
QVector<VSplinePoint> points = splPath.GetSplinePath(); QVector<VSplinePoint> points = splPath.GetSplinePath();
if(points.size() != 0 ){ if(points.size() != 0 ){
record = QString("Шлях сплайну %1").arg(data->GetPoint(points[0].P()).name()); record = QString(tr("Curve point %1")).arg(data->GetPoint(points[0].P()).name());
for(qint32 i = 1; i< points.size(); ++i){ for(qint32 i = 1; i< points.size(); ++i){
QString name = QString("_%1").arg(data->GetPoint(points[i].P()).name()); QString name = QString("_%1").arg(data->GetPoint(points[i].P()).name());
record.append(name); record.append(name);
@ -245,13 +245,13 @@ QString DialogHistory::Record(const VToolRecord &tool){
firstPointId = domElement.attribute("firstPoint", "").toLongLong(); firstPointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong();
} }
record = QString("%4 - Точка дотику дуги з центром в точці %1 і відрізку %2_%3").arg(data->GetPoint(center).name(), record = QString(tr("%4 - Point of contact arc with center in point %1 and line %2_%3")).arg(data->GetPoint(center).name(),
data->GetPoint(firstPointId).name(), data->GetPoint(firstPointId).name(),
data->GetPoint(secondPointId).name(), data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
break; break;
default: default:
qWarning()<<"Get wrong tool type. Ignore."; qWarning()<<tr("Get wrong tool type. Ignore.");
break; break;
} }
return record; return record;
@ -260,7 +260,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
void DialogHistory::InitialTable(){ void DialogHistory::InitialTable(){
ui->tableWidget->setSortingEnabled(false); ui->tableWidget->setSortingEnabled(false);
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" ")); ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" "));
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("Інструмент")); ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Tool")));
} }
void DialogHistory::ShowPoint(){ void DialogHistory::ShowPoint(){

View File

@ -261,7 +261,7 @@ void DialogIncrements::clickedToolButtonAdd(){
qint32 num = 1; qint32 num = 1;
QString name; QString name;
do{ do{
name = QString("Позначення %1").arg(num); name = QString(tr("Denotation %1")).arg(num);
num++; num++;
}while(data->IncrementTableContains(name)); }while(data->IncrementTableContains(name));
@ -269,7 +269,7 @@ void DialogIncrements::clickedToolButtonAdd(){
qreal base = 0; qreal base = 0;
qreal ksize = 0; qreal ksize = 0;
qreal kgrowth = 0; qreal kgrowth = 0;
QString description = QString("Опис"); QString description = QString(tr("Description"));
VIncrementTableRow incrementRow = VIncrementTableRow(id, base, ksize, kgrowth, description); VIncrementTableRow incrementRow = VIncrementTableRow(id, base, ksize, kgrowth, description);
data->AddIncrementTableRow(name, incrementRow); data->AddIncrementTableRow(name, incrementRow);
@ -302,7 +302,7 @@ void DialogIncrements::clickedToolButtonAdd(){
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 4, item); ui->tableWidgetIncrement->setItem(currentRow, 4, item);
item = new QTableWidgetItem("Опис"); item = new QTableWidgetItem(tr("Description"));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 5, item); ui->tableWidgetIncrement->setItem(currentRow, 5, item);
@ -428,37 +428,37 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
void DialogIncrements::InitialStandartTable(){ void DialogIncrements::InitialStandartTable(){
ui->tableWidgetStandart->setSortingEnabled(false); ui->tableWidgetStandart->setSortingEnabled(false);
ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Позначення"))); ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Denotation")));
ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Розрах. знач."))); ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value")));
ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Базове знач."))); ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value")));
ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("В розмірі"))); ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size")));
ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("В рості"))); ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth")));
ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Опис"))); ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description")));
} }
void DialogIncrements::InitialIncrementTable(){ void DialogIncrements::InitialIncrementTable(){
ui->tableWidgetIncrement->setSortingEnabled(false); ui->tableWidgetIncrement->setSortingEnabled(false);
ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Позначення"))); ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Denotation")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Розрах. знач."))); ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Базове знач."))); ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("В розмірі"))); ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("В рості"))); ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Опис"))); ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description")));
} }
void DialogIncrements::InitialLinesTable(){ void DialogIncrements::InitialLinesTable(){
ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Лінія"))); ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Line")));
ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Довжина"))); ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length")));
} }
void DialogIncrements::InitialSplinesTable(){ void DialogIncrements::InitialSplinesTable(){
ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Лінія"))); ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Curve")));
ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Довжина"))); ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length")));
} }
void DialogIncrements::InitialArcsTable(){ void DialogIncrements::InitialArcsTable(){
ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Лінія"))); ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Arc")));
ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Довжина"))); ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length")));
} }
void DialogIncrements::DialogAccepted(){ void DialogIncrements::DialogAccepted(){

View File

@ -52,7 +52,7 @@ void DialogTool::showEvent(QShowEvent *event){
if(isInitialized){ if(isInitialized){
return; return;
} }
isInitialized = true;//перший показ вікна вже відбувся isInitialized = true;//first show windows are held
} }
void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
@ -69,7 +69,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
} }
} else { } else {
if(idDetail <= 0){ if(idDetail <= 0){
qWarning()<<"Wrong details id."<<Q_FUNC_INFO; qWarning()<<tr("Wrong details id.")<<Q_FUNC_INFO;
return; return;
} }
VDetail det = data->GetDetail(idDetail); VDetail det = data->GetDetail(idDetail);
@ -93,12 +93,12 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
void DialogTool::FillComboBoxTypeLine(QComboBox *box) const{ void DialogTool::FillComboBoxTypeLine(QComboBox *box) const{
QStringList list; QStringList list;
list<<"Лінія"<<"Без лінії"; list<<tr("Line")<<tr("No line");
box->addItems(list); box->addItems(list);
} }
QString DialogTool::GetTypeLine(const QComboBox *box) const{ QString DialogTool::GetTypeLine(const QComboBox *box) const{
if(box->currentText()=="Лінія"){ if(box->currentText()==tr("Line")){
return QString("hair"); return QString("hair");
} else { } else {
return QString("none"); return QString("none");
@ -107,13 +107,13 @@ QString DialogTool::GetTypeLine(const QComboBox *box) const{
void DialogTool::SetupTypeLine(QComboBox *box, const QString &value){ void DialogTool::SetupTypeLine(QComboBox *box, const QString &value){
if(value == "hair"){ if(value == "hair"){
qint32 index = box->findText("Лінія"); qint32 index = box->findText(tr("Line"));
if(index != -1){ if(index != -1){
box->setCurrentIndex(index); box->setCurrentIndex(index);
} }
} }
if(value == "none"){ if(value == "none"){
qint32 index = box->findText("Без лінії"); qint32 index = box->findText(tr("No line"));
if(index != -1){ if(index != -1){
box->setCurrentIndex(index); box->setCurrentIndex(index);
} }
@ -140,6 +140,7 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){
QListWidgetItem *item = listWidget->currentItem(); QListWidgetItem *item = listWidget->currentItem();
QString val = item->text(); QString val = item->text();
lineEdit->setText(lineEdit->text().append(val)); lineEdit->setText(lineEdit->text().append(val));
lineEdit->setFocus();
} }
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){
@ -164,7 +165,7 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
QString errorMsg; QString errorMsg;
qreal result = cal.eval(edit->text(),&errorMsg); qreal result = cal.eval(edit->text(),&errorMsg);
if(!errorMsg.isEmpty()){ if(!errorMsg.isEmpty()){
label->setText("Помилка."); label->setText(tr("Error"));
flag = false; flag = false;
} else { } else {
label->setText(QString().setNum(result)); label->setText(QString().setNum(result));
@ -303,6 +304,7 @@ void DialogTool::PutVal(QListWidgetItem *item){
Q_CHECK_PTR(lineEditFormula); Q_CHECK_PTR(lineEditFormula);
QString val = item->text(); QString val = item->text();
lineEditFormula->setText(lineEditFormula->text().append(val)); lineEditFormula->setText(lineEditFormula->text().append(val));
lineEditFormula->setFocus();
} }
void DialogTool::ValChenged(int row){ void DialogTool::ValChenged(int row){
@ -343,7 +345,7 @@ void DialogTool::ValChenged(int row){
} }
if(radioButtonLengthLine->isChecked()){ if(radioButtonLengthLine->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLine(item->text())) QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLine(item->text()))
.arg("Довжина лінії"); .arg(tr("Line length"));
labelDescription->setText(desc); labelDescription->setText(desc);
return; return;
} }