Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Formatting Numbers
Forum Updated to NodeBB v4.3 + New Features

Formatting Numbers

Scheduled Pinned Locked Moved General and Desktop
15 Posts 2 Posters 8.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gRicky
    wrote on last edited by
    #6

    I don't think so because either the techniques I've followed, have given me back a string filled with "0", the problem is that the number of 0 returned are more than expected!

    Despite the fact I think the problem is different, how can I set the zeroDigit() property to be sure that it returns a '0'?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #7

      You can't set that value from inside Qt. It is set by the system. However, could you show us what your output is now then? I was under the impression from your previous posts that you did not get enough 0's. Now, you tell us, you get too many. So how does your output look?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gRicky
        wrote on last edited by
        #8

        I would like to show you an image which shows the output I'm receiving on the device simulator, but how can I link this image?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #9

          Just put the image on some public place (I use my public DropBox folder), and you can link it into your message using the small picture icon in the bar above the editor window.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gRicky
            wrote on last edited by
            #10

            Ok, this is the result I'm gettim from the simulator after the code is processed.

            !http://www.softwareprojects.it/images/blogimages/software/nokiaSimulator.png(nokia simulator image)!

            this is the URL of the image:
            http://www.softwareprojects.it/images/blogimages/software/nokiaSimulator.png

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gRicky
              wrote on last edited by
              #11

              [quote author="Andre" date="1333447407"]@ QTime t(hours, minutes, seconds); ui->chronoDisplay->setText(QTime::toString("h:mm::ss")); @ [/quote]

              Why this code worked just one time and now it doesn't work again?

              This is the error I'm receiving when I try to use the code above

              C:\Documents and Settings\tlp31\Documenti\C++_Project\chrono-build-simulator..\chrono\mainwindow.cpp:120: error: cannot call member function 'QString QTime::toString(const QString&) const' without object

              and this is the code:
              @ QTime t(hours, minutes, seconds);
              ui->chronoDisplay->setText(QTime::toString("h:mm::ss"));@

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #12

                You need to call t::toString, not QTime::toString in your second line. The error message describes that quite clearly, I think.

                Note: I now see that I wrote it wrong in my example. My apologies.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  gRicky
                  wrote on last edited by
                  #13

                  I'm sorry but it still doesn't work. The compiler says: [..] 121: error: 't' is not a class or namespace

                  How I have to initialize a QTime class properly?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #14

                    @
                    QTime time(hours, minutes, seconds);
                    ui->chronoDisplay->setText(time.toString("h:mm::ss"));
                    @
                    This should work.

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      gRicky
                      wrote on last edited by
                      #15

                      Yes it works, and with this modification also the UI is working properly.

                      Thank you Andre for your support in this matter.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved