Fix encoding of non-ASCII strings
tr() only takes UTF-8 as input, so we must recode to UTF-8. But we can use QLatin1String elsewhere. Task-number: QTBUG-26086 Change-Id: I5932ddc96fb817dbe01106e5f6f2b10f58472d6b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>bb10
parent
dd9bdf5654
commit
5f5555f4d3
|
|
@ -184,7 +184,7 @@ Window::Window()
|
|||
rotationAngleSpinBox = new QSpinBox;
|
||||
rotationAngleSpinBox->setRange(0, 359);
|
||||
rotationAngleSpinBox->setWrapping(true);
|
||||
rotationAngleSpinBox->setSuffix("\xB0");
|
||||
rotationAngleSpinBox->setSuffix(QLatin1String("\xB0"));
|
||||
|
||||
rotationAngleLabel = new QLabel(tr("&Rotation Angle:"));
|
||||
rotationAngleLabel->setBuddy(rotationAngleSpinBox);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ Window::Window()
|
|||
|
||||
operationComboBoxes[i] = new QComboBox;
|
||||
operationComboBoxes[i]->addItem(tr("No transformation"));
|
||||
operationComboBoxes[i]->addItem(tr("Rotate by 60\xB0"));
|
||||
operationComboBoxes[i]->addItem(tr("Rotate by 60\xC2\xB0"));
|
||||
operationComboBoxes[i]->addItem(tr("Scale to 75%"));
|
||||
operationComboBoxes[i]->addItem(tr("Translate by (50, 50)"));
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ static bool createConnection()
|
|||
query.exec("insert into albums values(4, 'Stray Dogs', 2, 2003)");
|
||||
query.exec("insert into albums values(5, "
|
||||
"'One day you`ll dance for me, New York City', 2, 2004)");
|
||||
query.exec("insert into albums values(6, 'Ompa Til Du D\xf8r', 3, 2001)");
|
||||
query.exec("insert into albums values(6, 'Ompa Til Du D\xc3\xb8r', 3, 2001)");
|
||||
query.exec("insert into albums values(7, 'Evig Pint', 3, 2002)");
|
||||
query.exec("insert into albums values(8, 'Maestro', 3, 2005)");
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ Calculator::Calculator(QWidget *parent)
|
|||
}
|
||||
|
||||
Button *pointButton = createButton(tr("."), SLOT(pointClicked()));
|
||||
Button *changeSignButton = createButton(tr("\261"), SLOT(changeSignClicked()));
|
||||
Button *changeSignButton = createButton(tr("\302\261"), SLOT(changeSignClicked()));
|
||||
|
||||
Button *backspaceButton = createButton(tr("Backspace"), SLOT(backspaceClicked()));
|
||||
Button *clearButton = createButton(tr("Clear"), SLOT(clear()));
|
||||
|
|
@ -84,13 +84,13 @@ Calculator::Calculator(QWidget *parent)
|
|||
Button *setMemoryButton = createButton(tr("MS"), SLOT(setMemory()));
|
||||
Button *addToMemoryButton = createButton(tr("M+"), SLOT(addToMemory()));
|
||||
|
||||
Button *divisionButton = createButton(tr("\367"), SLOT(multiplicativeOperatorClicked()));
|
||||
Button *timesButton = createButton(tr("\327"), SLOT(multiplicativeOperatorClicked()));
|
||||
Button *divisionButton = createButton(tr("\303\267"), SLOT(multiplicativeOperatorClicked()));
|
||||
Button *timesButton = createButton(tr("\303\227"), SLOT(multiplicativeOperatorClicked()));
|
||||
Button *minusButton = createButton(tr("-"), SLOT(additiveOperatorClicked()));
|
||||
Button *plusButton = createButton(tr("+"), SLOT(additiveOperatorClicked()));
|
||||
|
||||
Button *squareRootButton = createButton(tr("Sqrt"), SLOT(unaryOperatorClicked()));
|
||||
Button *powerButton = createButton(tr("x\262"), SLOT(unaryOperatorClicked()));
|
||||
Button *powerButton = createButton(tr("x\302\262"), SLOT(unaryOperatorClicked()));
|
||||
Button *reciprocalButton = createButton(tr("1/x"), SLOT(unaryOperatorClicked()));
|
||||
Button *equalButton = createButton(tr("="), SLOT(equalClicked()));
|
||||
//! [4]
|
||||
|
|
@ -165,7 +165,7 @@ void Calculator::unaryOperatorClicked()
|
|||
return;
|
||||
}
|
||||
result = sqrt(operand);
|
||||
} else if (clickedOperator == tr("x\262")) {
|
||||
} else if (clickedOperator == tr("x\302\262")) {
|
||||
result = pow(operand, 2.0);
|
||||
} else if (clickedOperator == tr("1/x")) {
|
||||
if (operand == 0.0) {
|
||||
|
|
@ -384,9 +384,9 @@ bool Calculator::calculate(double rightOperand, const QString &pendingOperator)
|
|||
sumSoFar += rightOperand;
|
||||
} else if (pendingOperator == tr("-")) {
|
||||
sumSoFar -= rightOperand;
|
||||
} else if (pendingOperator == tr("\327")) {
|
||||
} else if (pendingOperator == tr("\303\227")) {
|
||||
factorSoFar *= rightOperand;
|
||||
} else if (pendingOperator == tr("\367")) {
|
||||
} else if (pendingOperator == tr("\303\267")) {
|
||||
if (rightOperand == 0.0)
|
||||
return false;
|
||||
factorSoFar /= rightOperand;
|
||||
|
|
|
|||
Loading…
Reference in New Issue