Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QDoubleSpinBox and QLocale

    General and Desktop
    2
    3
    1078
    Loading More Posts
    • 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.
    • guidupas
      guidupas last edited by

      Hello everybody!

      I am trying to use a set a QLocale in a QDoubleSpinBox, but its not working. The data input does not change at all.

      What am I missing?

      Thanks a lot.

      @
      QDoubleSpinBox *doubleSpinBoxEditor = new QDoubleSpinBox(parent);
      doubleSpinBoxEditor->setDecimals(4);
      doubleSpinBoxEditor->setAlignment(Qt::AlignRight);
      doubleSpinBoxEditor->setPrefix("$ ");

      doubleSpinBoxEditor->setLocale(QLocale(QLocale::Portuguese, QLocale::Brazil));
      return doubleSpinBoxEditor;
      

      @

      Att.
      Guilherme Cortada Dupas

      1 Reply Last reply Reply Quote 0
      • Jeroentjehome
        Jeroentjehome last edited by

        Hi,
        Your code looks valid. Maybe set a value in it to make sure that a 'redraw' has taken place. Do you also install a translator?

        It's just a coding standard thing, but it's not so great to return a pointer to a stack constructed variable.

        Greetz, Jeroen

        1 Reply Last reply Reply Quote 0
        • guidupas
          guidupas last edited by

          I did set the value and it stills not working. Any other ideas?

          @
          QDoubleSpinBox *doubleSpinBoxEditor = new QDoubleSpinBox(parent);
          doubleSpinBoxEditor->setRange(0.0000, 999999999999999.9999);
          doubleSpinBoxEditor->setDecimals(4);
          doubleSpinBoxEditor->setAlignment(Qt::AlignRight);
          doubleSpinBoxEditor->setPrefix("$ ");
          doubleSpinBoxEditor->setLocale(QLocale(QLocale::Portuguese, QLocale::Brazil));
          doubleSpinBoxEditor->setValue(0.0000);

          return doubleSpinBoxEditor;
          

          @

          Att.
          Guilherme Cortada Dupas

          1 Reply Last reply Reply Quote 0
          • First post
            Last post