Is there a way to display the chart on a specific part of the main screen?
-
-
@meria0503 said in Is there a way to display the chart on a specific part of the main screen?:
How should I use the button-click event to express it?
What is the problem?
Position your chart where you want it to be (https://doc.qt.io/qt-5/qwidget.html#geometry-prop) or use https://doc.qt.io/qt-5/layout.html -
@meria0503
@jsulm has already said. Qt has two possibilities for where you can position a widget:- Do not use layouts, and use
QWidget::setGeometry()
ormove()
. - Use layouts, and let Qt position and size your widget relative to other widgets.
If you use layouts for other elements of your main window, and then insist on placing your chart on the main window but outside of any layout, you will have problems with it running into other widgets.
Layouts are generally preferable to absolute positioning.
QMainWindow
is made for layouts. You do not "creating one more window" or need aQFrame
orQWidget
, assuming your "chart" is aQWidget
. - Do not use layouts, and use