Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is there a way to display the chart on a specific part of the main screen?
Qt 6.11 is out! See what's new in the release blog

Is there a way to display the chart on a specific part of the main screen?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 678 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    meria0503
    wrote on last edited by
    #1

    I want to display the chart on a specific part of the main screen. How should I use the button-click event to express it?

    I'd appreciate it if you could give me an example.

    I am sorry that the translation is not smooth because I am not good at English.

    jsulmJ 1 Reply Last reply
    0
    • M meria0503

      I want to display the chart on a specific part of the main screen. How should I use the button-click event to express it?

      I'd appreciate it if you could give me an example.

      I am sorry that the translation is not smooth because I am not good at English.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      3
      • jsulmJ jsulm

        @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

        M Offline
        M Offline
        meria0503
        wrote on last edited by
        #3

        @jsulm Instead of creating one more window, I want to express the chart in a specific part of the main window. I wonder if I have to use a specific space such as QFrame or QWidget.

        JonBJ 1 Reply Last reply
        0
        • M meria0503

          @jsulm Instead of creating one more window, I want to express the chart in a specific part of the main window. I wonder if I have to use a specific space such as QFrame or QWidget.

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by JonB
          #4

          @meria0503
          @jsulm has already said. Qt has two possibilities for where you can position a widget:

          • Do not use layouts, and use QWidget::setGeometry() or move().
          • 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 a QFrame or QWidget, assuming your "chart" is a QWidget.

          M 1 Reply Last reply
          2
          • JonBJ JonB

            @meria0503
            @jsulm has already said. Qt has two possibilities for where you can position a widget:

            • Do not use layouts, and use QWidget::setGeometry() or move().
            • 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 a QFrame or QWidget, assuming your "chart" is a QWidget.

            M Offline
            M Offline
            meria0503
            wrote on last edited by
            #5

            @JonB

            I solved it in a different way.

            I transferred the QchartView from a promote.

            ui->graphicsView->setChart(chart); << I used this method.
            
            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved