Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] QInputDialog::getDouble : Width issue



  • Hi everybody,

    I'm upgrading my software from Qt 4.7.4 to Qt 5.4.0 Beta (I'm waiting for the release the 4th Dec).

    I find a weird issue and I want to be sure it's not a mistake from myself before post a bug report.

    If I call the method QInputDialog::getDouble (from the context menu of my QGLWidget inherited class) like that:
    @
    void CViewer3D_v2::ZFar()
    {
    bool ok;
    double value = QInputDialog::getDouble(this, "zFar", "Enter a decimal number", xd_ZFar, 0, DBL_MAX, 2, &ok);
    if(ok)
    {
    SetZFar(value);
    }
    }
    @

    The dialog has a really big width, more than my screen can display, I think it's something like 1800px.
    Although, if I call in the same context QInputDialog::getInt method, I don't get any trouble.

    Have any idea, please?


  • Lifetime Qt Champion

    Hi,

    Intriguing, can you reproduce this with a minimal compilable example ?



  • Hi,

    Yes, I can. If I create an empty project and the same lines, I get the same width issue:
    @
    #include "qinputdialogtest.h"

    #include <QInputDialog>

    QInputDialogTest::QInputDialogTest(QWidget *parent)
    : QMainWindow(parent)
    {
    ui.setupUi(this);
    bool ok;
    double value = QInputDialog::getDouble(this, "zFar", "Enter a decimal number", 30., 0, DBL_MAX, 2, &ok);
    }
    @

    Here the result on my screens:
    !http://imgur.com/MQU5gpF(QInputDialog::getDouble UI result)!

    Edit: I failed to post the image, please follow this link imgur link:
    "http://imgur.com/MQU5gpF":http://imgur.com/MQU5gpF


  • Lifetime Qt Champion

    Looks like it's because of DBL_MAX. Most likely, the widget is expanded to allow showing the maximum double value which it pretty big.


Log in to reply