Logo Search packages:      
Sourcecode: qt-at-spi version File versions  Download package

void Calculator::unaryOperatorClicked (  ) [private, slot]

[7]

[8] [8] //! [9]

Definition at line 141 of file calculator.cpp.

References abortOperation(), display, and waitingForOperand.

Referenced by Calculator().

{
    Button *clickedButton = qobject_cast<Button *>(sender());
    QString clickedOperator = clickedButton->text();
    double operand = display->text().toDouble();
    double result = 0.0;

    if (clickedOperator == tr("Sqrt")) {
        if (operand < 0.0) {
            abortOperation();
            return;
        }
        result = sqrt(operand);
    } else if (clickedOperator == tr("x\262")) {
        result = pow(operand, 2.0);
    } else if (clickedOperator == tr("1/x")) {
        if (operand == 0.0) {
          abortOperation();
          return;
        }
        result = 1.0 / operand;
    }
    display->setText(QString::number(result));
    waitingForOperand = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index