Qt setGeometry: Unable to set geometry

前端 未结 2 810
一生所求
一生所求 2020-12-29 09:15

Why?

setGeometry: Unable to set geometry 22x22+320+145 on QWidgetWindow/\'WidgetClassWindow\'. Resulting geometry:  116x22+320+145 (frame: 8, 30, 8, 8, custo         


        
相关标签:
2条回答
  • 2020-12-29 09:44

    Try to use: ajustSize()

    Looks To be the problem: Why am I getting QWindowsWindow::setGeometry: Unable to set geometry warning with Qt 5.12.0

    A possible solution: Qt Unable to set geometry

    0 讨论(0)
  • 2020-12-29 09:59

    This warning happens (at least to me) when the size of the widget results to be very small.

    Set a minimum size for your widget (so it will be automatically positioned), like:

     // Widget constructor
    
     QVBoxLayout* vLayout = new QVBoxLayout();
     setLayout(vLayout);
    
     setMinimumSize(200,200);
    

    You should also parent your widget to a QMainWindow, but will still work.

    0 讨论(0)
提交回复
热议问题