fixed a signal emit error. Automatically select the first collection at startup. This way at least one collection is already selected.

This commit is contained in:
suter_a 2020-05-14 11:09:29 +02:00
parent 1a2853e548
commit df88345c55

View File

@ -110,6 +110,7 @@ PVarDialog::PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
newItem->setText(fCollList[i].fCollName); newItem->setText(fCollList[i].fCollName);
fCollectionView->addItem(newItem); fCollectionView->addItem(newItem);
} }
fCollectionView->setCurrentRow(0, QItemSelectionModel::Select);
fCollectionView->setSelectionMode(QAbstractItemView::ExtendedSelection); fCollectionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
QHBoxLayout *hLayout0 = new QHBoxLayout; QHBoxLayout *hLayout0 = new QHBoxLayout;
@ -212,7 +213,7 @@ void PVarDialog::add()
idx.push_back(fCollectionView->row(selected[i])); idx.push_back(fCollectionView->row(selected[i]));
} }
emit check_request(fVarEdit->toPlainText(), idx); emit add_request(fVarEdit->toPlainText(), idx);
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -221,7 +222,13 @@ void PVarDialog::add()
*/ */
void PVarDialog::help() void PVarDialog::help()
{ {
QMessageBox::information(this, "Var Help", "Syntax: var <var_name> = <expr>.\n<expr> can contain identifiers defined in the collections.\nExample:\nvar sigSC = pow(abs(pow($sigma,2.0)-pow(0.11,2.0)),0.5)"); QMessageBox::information(this, "Var Help",
"Syntax: var <var_name> = <expr>.\n"\
"<expr> can contain identifiers defined in the collections.\n"\
"An identifier is an addressed variable which is defined\n"\
"by a preceeding '$' before the variable name.\n"\
"Example: variable sigma -> identifier $sigma.\n"\
"Example:\nvar sigSC = pow(abs(pow($sigma,2.0)-pow(0.11,2.0)),0.5)");
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------