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. Two Charts (widgets) in a Window
Qt 6.11 is out! See what's new in the release blog

Two Charts (widgets) in a Window

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.1k 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.
  • B Offline
    B Offline
    BadHombre
    wrote on last edited by BadHombre
    #1

    Hi Guys,

    i have a Question.
    can sb tell me how to set two widgets in a window ?

    For example i Created two

    QChartView *chartView = new QChartView(chart);
    QChartView *chartView1 = new QChartView(chart1);

    normally i am using
    window = new QMainWindow();
    window->setCentralWidget(chartView);

    to set the chartView in the middle.
    Is it possible to set now both Chartviews side by side ?

    Thanks For your Help!!!

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Carmoneer
      wrote on last edited by
      #2

      This is a quick and dirty example, but something like this:

      QFrame* centralFrame = new QFrame();
      
      QHBoxLayout* myLayout = new QHBoxLayout;
      myLayout->addwidget(chartView);
      myLayout->addwidget(chartView1);
      
      centralFrame->setLayout(myLayout);
      
      setCentralWidget(centralFrame);
      

      Cheers!

      1 Reply Last reply
      2
      • B Offline
        B Offline
        BadHombre
        wrote on last edited by
        #3

        Perfect! Thanks carmoneer

        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