Change Input Style for numbers from "," to "."



  • Hallo zusammen, hey guys

    I'm working on a source code which uses a local definition for floating point numbers. If I have a "German" setup (for Windows) the program uses a comma for all float numbers --> this: , but I would like to unify all values to the "english number style" with a point for a floating point number.

    I already found out that with:

    QLocale::setDefault(QLocale::c());
    

    I can "show" numbers in "english"-style. But I can't find how to change also the input for a (e.g.) "QtVariantProperty"
    I have the following:

        QtVariantProperty *m_propShrinkingFactors;
        QtVariantProperty *m_propShrinkList[MaxArguments];
    .
    .
    .
    
        m_manager = new QsVariantPropertyManager(this);
        m_propShrinkingFactors = m_manager->addProperty(QtVariantPropertyManager::enumTypeId());
        for (int i = 0; i < m_numOfSchrinkingFactors; ++i) {
            m_propShrinkList[i] = m_manager->addProperty(QVariant::Double);
            m_propShrinkList[i]->setEnabled(true);
            m_propShrinkList[i]->setValue(m_item->shrinkingFactor(i) < 0.0 ? 1.0 : m_item->shrinkingFactor(i));
            m_propShrinkList[i]->setAttribute(QLatin1String("decimals"), 3);
            m_propShrinkingFactors->addSubProperty(m_propShrinkList[i]);
        }
        m_browser->addProperty(m_propShrinkingFactors);
    
    

    With this settings I get for the "visualization":
    0_1551164304673_screen1.PNG
    BUT if I have to input a number I have to write:
    0_1551164335313_screen2.PNG
    I hope someone of you can help me!

    Best,
    Martin



  • hmmmm ..... an update for the problem:
    After a restart I can use "english-style" numbers, therefore the specific problem is solved, BUT now I cant use UTF-8 sybols (Ä,Ü,Ö ....) anymore :-/
    So, I'm still unhappy .....


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.