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

Strange problem, need help or suggestion



  • I've been working on this project for some time now, the GUI is for a hand held smart card reading device. I have a number of forms, each form follows the same design and the constructor for each form is very similar, one form I completed yesterday has today developed a fault.

    The fault is this, the position of the form is not where its supposed to be, according to the geometry reported in the constructor the geometry is supposed to be:

    0,20,240x300

    This is correct.

    When its rendered the actual form is appearing slightly shifted to the top left, I have no idea why this is happening and can see no reason for it in the source.

    I've also put debug statement in a button on the form which reports the same geometry as:

    -4,-14,240x300

    What could explain this? How can I trace what is changing the geometry?

    [Edit] I report the geometry as the last line before leaving the constructor, the geometry is correct. Then as the first line after object creation, i report the geometry again, still ok, the next line calls setWindowFlags:

       pForm->setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
    

    After returning from this I report the geometry again, now it's wrong...why?

    [Edit # 2] Fixed, don't ask me why it ever worked but for the past 5 weeks the code has been working ok, today it started exhibiting this problem. The fix was to move the call to setWindowFlags into the constructor after the call to setupUi, now its as before.


Log in to reply