Search code examples
c++macosqtretina

Abnormal Size of Qt GUI Widget On MacOS


I wrote a program using QvtkWidget. When I successfully embedded QvtkWidget into my GUI. I found the size of my Button is abnormal.

I have already changed the layout. Nothing happened. I use Mac Mojave. Anyone knows something? Many thanks. Here are the results.

normal_in_Qt_creator

abnormal_after_compile

and this are my GUI layouts. I have already put my widget into Layout, Still abnormal size. I tested the codes on windows they work fine. So maybe there is something to do with my Mac Retina Screen.


Solution

  • You need to put your widget in a QLayout. Read also the Qt tutorial how to do that.

    In your case, click the right mouse key into the mainwidget and a context menu opens, and you select "Layout" and your desired layout (e.g. grid). Then you should see a proper layout in Qt's Designer without the red traffic-sign symbol over the central widget which is a warning about a missing layout.