Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDoubleSpinBox and QLocale
Qt 6.12 LTS is out! See what's new in the release blog

QDoubleSpinBox and QLocale

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.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.
  • guidupasG Offline
    guidupasG Offline
    guidupas
    wrote on last edited by
    #1

    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
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      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
      0
      • guidupasG Offline
        guidupasG Offline
        guidupas
        wrote on last edited by
        #3

        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
        0

        • Login

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