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

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

[9]

[10] [10] //! [11]

[11] //! [12]

[12] //! [13]

[13] //! [14]

[14] //! [15]

[15] //! [16]

[16] //! [17]

Definition at line 170 of file calculator.cpp.

References abortOperation(), calculate(), display, factorSoFar, pendingAdditiveOperator, pendingMultiplicativeOperator, sumSoFar, and waitingForOperand.

Referenced by Calculator().

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

//! [11] //! [12]
    if (!pendingMultiplicativeOperator.isEmpty()) {
//! [12] //! [13]
        if (!calculate(operand, pendingMultiplicativeOperator)) {
            abortOperation();
          return;
        }
        display->setText(QString::number(factorSoFar));
        operand = factorSoFar;
        factorSoFar = 0.0;
        pendingMultiplicativeOperator.clear();
    }

//! [13] //! [14]
    if (!pendingAdditiveOperator.isEmpty()) {
//! [14] //! [15]
        if (!calculate(operand, pendingAdditiveOperator)) {
            abortOperation();
          return;
        }
        display->setText(QString::number(sumSoFar));
    } else {
        sumSoFar = operand;
    }

//! [15] //! [16]
    pendingAdditiveOperator = clickedOperator;
//! [16] //! [17]
    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