Fix compilation with Qt 6; Fix input of word operators (e.g. "xor") using keypad; Update some text strings; Update translations; Update examples

This commit is contained in:
Hanna K 2022-02-02 09:20:38 +01:00
parent e05e8aa468
commit 5bd4ad54fe
13 changed files with 4248 additions and 4198 deletions

View File

@ -75,13 +75,13 @@ _For more details about the syntax, and available functions, units, and variable
## Examples (expressions)
_Note that semicolon can be replaced with comma, if comma is not used as decimal or thousands separator._
_Note that semicolon can be replaced with comma in function arguments, if comma is not used as decimal or thousands separator._
### Basic functions and operators
sqrt 4 _= sqrt(4) = 4^(0.5) = 4^(1/2) = 2_
sqrt(25; 16; 9; 4) _= \[5; 4; 3; 2\]_
sqrt(25; 16; 9; 4) _= \[5 4 3 2\]_
sqrt(32) _= 4 × √(2) (in exact mode)_
@ -205,7 +205,7 @@ solve(x = y+ln(y); y) _= lambertw(e^x)_
solve2(5x=2y^2; sqrt(y)=2; x; y) _= 32/5_
multisolve(\[5x=2y+32; y=2z; z=2x\]; \[x; y; z\]) _= \[32/3; 128/3; 64/3\]_
multisolve(\[5x=2y+32, y=2z, z=2x\]; \[x, y, z\]) _= \[32/3 128/3 64/3\]_
dsolve(diff(y; x) 2y = 4x; 5) _= 6e^(2x) 2x 1_
@ -227,19 +227,19 @@ limit(ln(1 + 4x)/(3^x 1); 0) _= 4 / ln(3)_
### Matrices and vectors
((1; 2; 3); (4; 5; 6)) _= \[\[1; 2; 3\]; \[4; 5; 6\]\] (2×3 matrix)_
\[1, 2, 3; 4, 5, 6\] _= ((1; 2; 3); (4; 5; 6)) = \[1 2 3; 4 5 6\] (2×3 matrix)_
(1; 2; 3) × 2 2 _= \[1 × 2 2; 2 × 2 2; 3 × 2 2\] = \[0; 2; 4\]_
(1; 2; 3) × 2 2 _= \[(1 × 2 2), (2 × 2 2), (3 × 2 2)\] = \[0 2 4\]_
(1; 2; 3).(4; 5; 6) = dot((1; 2; 3); (4; 5; 6)) _= 32 (dot product)_
\[1 2 3\].\[4 5 6\] = dot(\[1 2 3\]; \[4 5 6\]) _= 32 (dot product)_
cross((1; 2; 3); (4; 5; 6)) _= \[3; 6; 3\] (cross product)_
cross(\[1 2 3\]; \[4 5 6\]) _= \[3 6 3\] (cross product)_
hadamard(\[\[1; 2; 3\]; \[4; 5; 6\]\]; \[\[7; 8; 9\]; \[10; 11; 12\]\]) _= \[\[7; 16; 27\]; \[40; 55; 72\]\] (hadamard product)_
\[1 2 3; 4 5 6\].×\[7 8 9; 10 11 12\] _= hadamard(\[1 2 3; 4 5 6\]; \[7 8 9; 10 11 12\]) = \[7 16 27; 40 55 72\] (hadamard product)_
((1; 2; 3); (4; 5; 6)) × ((7; 8); (9; 10); (11; 12)) _= \[\[58; 64\]; \[139; 154\]\] (matrix multiplication)_
\[1 2 3; 4 5 6\] × \[7 8; 9 10; 11 12\] _= \[58 64; 139 154\] (matrix multiplication)_
((1; 2); (3; 4))^-1 _= inverse(\[\[1; 2\]; \[3; 4\]\]) = \[\[2; 1\]; \[1.5; 0.5\]\]_
\[1 2; 3 4\]^-1 _= inverse(\[1 2; 3 4\]) = \[2 1; 1.5 0.5\]_
### Statistics
@ -247,7 +247,7 @@ mean(5; 6; 4; 2; 3; 7) _= 4.5_
stdev(5; 6; 4; 2; 3; 7) _≈ 1.87_
quartile((5; 6; 4; 2; 3; 7); 1) _= percentile(\[5; 6; 4; 2; 3; 7\]; 25) ≈ 2.9166667_
quartile(\[5 6 4 2 3 7\]; 1) _= percentile((5; 6; 4; 2; 3; 7); 25) ≈ 2.9166667_
normdist(7; 5) _≈ 0.053990967_

View File

@ -132,7 +132,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) : QDialog(parent) {
parseCombo = combo;
connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(parsingModeChanged(int)));
l2->addWidget(combo, r, 1); r++;
BOX_G(tr("Simplified percentage"), settings->simplified_percentage, simplifiedPercentageToggled(bool));
BOX_G(tr("Simplified percentage calculation"), settings->simplified_percentage, simplifiedPercentageToggled(bool));
BOX_G(tr("Read precision"), settings->evalops.parse_options.read_precision != DONT_READ_PRECISION, readPrecisionToggled(bool));
BOX_G(tr("Limit implicit multiplication"), settings->evalops.parse_options.limit_implicit_multiplication, limitImplicitToggled(bool));
l2->addWidget(new QLabel(tr("Interval calculation:"), this), r, 0);
@ -185,9 +185,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) : QDialog(parent) {
l2->addWidget(combo, r, 1); r++;
l2->addWidget(new QLabel(tr("Rounding:"), this), r, 0);
combo = new QComboBox(this);
combo->addItem(tr("Round halfway upwards"), 0);
combo->addItem(tr("Round halfway to even"), 1);
combo->addItem(tr("Truncate"), 2);
combo->addItem(tr("Round halfway numbers away from zero"), 0);
combo->addItem(tr("Round halfway numbers to even"), 1);
combo->addItem(tr("Truncate all numbers"), 2);
combo->setCurrentIndex(combo->findData(settings->rounding_mode));
connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(roundingChanged(int)));
l2->addWidget(combo, r, 1); r++;

View File

@ -1544,8 +1544,8 @@ void QalculateWindow::onOperatorClicked(const QString &str) {
if(str.length() >= 3) {
s_low = str.toLower();
if(str == "NOT") s = "!";
else if(s == "not") s = str + " ";
else if(s == "nor" || s == "mod" || s == "rem" || s == "comb" || s == "perm" || s == "xor" || s == "bitand" || s == "bitor" || s == "nand" || s == "cross" || s == "dot" || s == "and" || s == "or" || s == "per" || s == "times" || s == "minus" || s == "plus" || s == "div") s = " " + str + " ";
else if(s_low == "not") s = str + " ";
else if(s_low == "nor" || s_low == "mod" || s_low == "rem" || s_low == "comb" || s_low == "perm" || s_low == "xor" || s_low == "bitand" || s_low == "bitor" || s_low == "nand" || s_low == "cross" || s_low == "dot" || s_low == "and" || s_low == "or" || s_low == "per" || s_low == "times" || s_low == "minus" || s_low == "plus" || s_low == "div") s = " " + str + " ";
else s = str;
} else {
s = str;
@ -5876,7 +5876,13 @@ bool QalculateWindow::editKeyboardShortcut(keyboard_shortcut *new_ks, keyboard_s
keyEdit->setFocus();
while(dialog->exec() == QDialog::Accepted && !keyEdit->keySequence().isEmpty()) {
QString key = keyEdit->keySequence().toString();
if(keyEdit->keySequence() == QKeySequence::Undo || keyEdit->keySequence() == QKeySequence::Redo || keyEdit->keySequence() == QKeySequence::Copy || keyEdit->keySequence() == QKeySequence::Paste || keyEdit->keySequence() == QKeySequence::Delete || keyEdit->keySequence() == QKeySequence::Cut || keyEdit->keySequence() == QKeySequence::SelectAll || keyEdit->keySequence() == QKeySequence::Backspace || (keyEdit->keySequence().count() == 1 && (keyEdit->keySequence()[0] < Qt::Key_F1 || (keyEdit->keySequence()[0] >= Qt::Key_Space && keyEdit->keySequence()[0] < Qt::Key_Back)))) {
if(keyEdit->keySequence() == QKeySequence::Undo || keyEdit->keySequence() == QKeySequence::Redo || keyEdit->keySequence() == QKeySequence::Copy || keyEdit->keySequence() == QKeySequence::Paste || keyEdit->keySequence() == QKeySequence::Delete || keyEdit->keySequence() == QKeySequence::Cut || keyEdit->keySequence() == QKeySequence::SelectAll || keyEdit->keySequence() == QKeySequence::Backspace ||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
(keyEdit->keySequence().count() == 1 && keyEdit->keySequence()[0].keyboardModifiers() == Qt::NoModifier && (keyEdit->keySequence()[0].key() < Qt::Key_F1 || (keyEdit->keySequence()[0].key() >= Qt::Key_Space && keyEdit->keySequence()[0].key() < Qt::Key_Back)))
#else
(keyEdit->keySequence().count() == 1 && (keyEdit->keySequence()[0] < Qt::Key_F1 || (keyEdit->keySequence()[0] >= Qt::Key_Space && keyEdit->keySequence()[0] < Qt::Key_Back)))
#endif
) {
QMessageBox::critical(this, tr("Error"), tr("Reserved key combination"), QMessageBox::Ok);
keyEdit->clear();
keyEdit->setFocus();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff