Two Charts (widgets) in a Window



  • 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!!!



  • 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!



  • Perfect! Thanks carmoneer


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.