Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61214

The "Calculator" example in Qt Examples->widget->widget->Calculator in 5.8.0 version is not working in Kubuntu 17.04 as well as Manjaro KDE 17.0.1

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P4: Low
    • None
    • 5.8.0
    • None

    Description

      In Kubuntu 17.04 and Manjaro KDE 17.0.1 updated
      -------------------------------------------------------------------

      Button class inherited from QToolButton class.

       In calculator.cpp class file in line 148

      Calculator::digitClicked()
      {
          Button *clickedButton = qobject_cast<Button *>(sender());
          int digitValue = clickedButton->text().toInt();
          
          // This line was added by me to debug and see the values
          qDebug() << "clicked : " << clickedButton->text() << "  Digit Value: " << clickedButton->text().toInt() << "\n";
          
          if (display->text() == "0" && digitValue == 0.0)
              return;
      
          if (waitingForOperand) {
              display->clear();
              waitingForOperand = false;
          }
          display->setText(display->text() + QString::number(digitValue));
          qDebug() << "display : " << display->text() << "\n";
      }
      

      When I run the code from konsole, the calculator display is not updated and when I press digits, for example 4, then 5, then 6

      clicked : "&4" Digit Value: 0
      clicked : "&5" Digit Value: 0
      clicked : "&6" Digit Value: 0
      
      For other buttons in the calculator for "=", "-", "*", "/", the button.text() returns correct QString i.e "=", "-", "*", "/" respectively.
      

      In Windows 7
      ----------------------
      There is no such problem in 32 bit mingw qt version 5.8 in windows 7.
      For that the result is updated in calculator display.
      Also

      clicked : "4" Digit Value: 4
      clicked : "5" Digit Value: 5
      clicked : "6" Digit Value: 6
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            chehrlic Christian Ehrlicher
            gmatbarua gmatbarua
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes