Results 1 to 8 of 8

Thread: multi plots

  1. #1
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default multi plots

    Hello world,

    i use QtCreator and Qwt, i try to plot in real time 6 curve but i not a master in programmation and it's very difficult for me...

    can you help me to:
    1°) place my curve correctly
    2°) with the good size

    i do a project to place 6curve and 4button on a windows, the result is nice (http://imageshack.us/photo/my-images/851/myplots.jpg/) but i want to increase the size of my plot and have a good arrangement
    ==> the plots have to take the total windows (except button emplacement)

    How i have to modify this programm to have bigger plots with a good arrangement ?
    main.cpp
    Qt Code:
    1. #include <QApplication>
    2. #include "MyMainWindow.h"
    3. #include <QGridLayout>
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7. MyMainWindow fenetre;
    8. fenetre.setWindowFlags(Qt::Window);
    9.  
    10. QGridLayout *MyGridLayout = new QGridLayout;
    11. MyGridLayout->addWidget(fenetre.get_WindowNumber1(),0,0,3,3);
    12. MyGridLayout->addWidget(fenetre.get_WindowNumber2(),0,3,3,3);
    13. MyGridLayout->addWidget(fenetre.get_WindowNumber3(),0,6,3,3);
    14. MyGridLayout->addWidget(fenetre.get_WindowNumber4(),3,0,3,3);
    15. MyGridLayout->addWidget(fenetre.get_WindowNumber5(),3,3,3,3);
    16. MyGridLayout->addWidget(fenetre.get_WindowNumber6(),3,6,3,3);
    17. MyGridLayout->addWidget(fenetre.get_BUTTONRun(),0,8);
    18. MyGridLayout->addWidget(fenetre.get_BUTTONQuit(),0,9);
    19. MyGridLayout->addWidget(fenetre.get_BUTTONAbout(),1,8);
    20. MyGridLayout->addWidget(fenetre.get_BUTTONContact(),1,9);
    21. fenetre.setLayout(MyGridLayout);
    22. fenetre.show();
    23. return app.exec();
    24. }
    To copy to clipboard, switch view to plain text mode 
    MyMainWindow.h
    Qt Code:
    1. #ifndef MYMAINWINDOW_H
    2. #define MYMAINWINDOW_H
    3.  
    4. #include <QApplication>
    5. #include <QWidget>
    6. #include <QPushButton>
    7. #include <QMessageBox>
    8. #include <qwt_plot.h>
    9.  
    10. class MyMainWindow : public QWidget
    11. {
    12. Q_OBJECT
    13.  
    14. public:
    15. MyMainWindow();
    16. ~MyMainWindow();
    17. QPushButton* get_BUTTONRun();
    18. QPushButton* get_BUTTONQuit();
    19. QPushButton* get_BUTTONAbout();
    20. QPushButton* get_BUTTONContact();
    21. QWidget* get_WindowNumber1();
    22. QWidget* get_WindowNumber2();
    23. QWidget* get_WindowNumber3();
    24. QWidget* get_WindowNumber4();
    25. QWidget* get_WindowNumber5();
    26. QWidget* get_WindowNumber6();
    27.  
    28. private:
    29. QPushButton *BUTTONRun;
    30. QPushButton *BUTTONQuit;
    31. QPushButton *BUTTONAbout;
    32. QPushButton *BUTTONContact;
    33. QWidget *WindowNumber1;
    34. QWidget *WindowNumber2;
    35. QWidget *WindowNumber3;
    36. QWidget *WindowNumber4;
    37. QWidget *WindowNumber5;
    38. QWidget *WindowNumber6;
    39. QwtPlot *myPlot1;
    40. QwtPlot *myPlot2;
    41. QwtPlot *myPlot3;
    42. QwtPlot *myPlot4;
    43. QwtPlot *myPlot5;
    44. QwtPlot *myPlot6;
    45. };
    46. #endif // MYMAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 
    MyMainWindow.cpp
    Qt Code:
    1. #include "MyMainWindow.h"
    2.  
    3. MyMainWindow::MyMainWindow() : QWidget()
    4. {
    5. WindowNumber1= new QWidget(this);
    6. WindowNumber2= new QWidget(this);
    7. WindowNumber3= new QWidget(this);
    8. WindowNumber4= new QWidget(this);
    9. WindowNumber5= new QWidget(this);
    10. WindowNumber6= new QWidget(this);
    11. myPlot1=new QwtPlot(WindowNumber1);
    12. myPlot2=new QwtPlot(WindowNumber2);
    13. myPlot3=new QwtPlot(WindowNumber3);
    14. myPlot4=new QwtPlot(WindowNumber4);
    15. myPlot5=new QwtPlot(WindowNumber5);
    16. myPlot6=new QwtPlot(WindowNumber6);
    17.  
    18. BUTTONRun = new QPushButton("RUN", this);
    19. BUTTONQuit = new QPushButton("STOP", this);
    20. BUTTONAbout = new QPushButton("About", this);
    21. BUTTONContact = new QPushButton("Contact", this);
    22.  
    23. QObject::connect(BUTTONQuit, SIGNAL(clicked()), qApp, SLOT(quit()));
    24. QObject::connect(BUTTONAbout, SIGNAL(clicked()), qApp, SLOT(aboutQt()));
    25.  
    26. }
    27. MyMainWindow::~MyMainWindow()
    28. {
    29.  
    30. }
    31.  
    32. QPushButton* MyMainWindow::get_BUTTONRun()
    33. {
    34. return BUTTONRun;
    35. }
    36.  
    37. QPushButton* MyMainWindow::get_BUTTONQuit()
    38. {
    39. return BUTTONQuit;
    40. }
    41.  
    42. QPushButton* MyMainWindow::get_BUTTONAbout()
    43. {
    44. return BUTTONAbout;
    45. }
    46.  
    47. QPushButton* MyMainWindow::get_BUTTONContact()
    48. {
    49. return BUTTONContact;
    50. }
    51.  
    52. QWidget* MyMainWindow::get_WindowNumber1()
    53. {
    54. return WindowNumber1;
    55. }
    56.  
    57. QWidget* MyMainWindow::get_WindowNumber2()
    58. {
    59. return WindowNumber2;
    60. }
    61.  
    62. QWidget* MyMainWindow::get_WindowNumber3()
    63. {
    64. return WindowNumber3;
    65. }
    66.  
    67. QWidget* MyMainWindow::get_WindowNumber4()
    68. {
    69. return WindowNumber4;
    70. }
    71.  
    72. QWidget* MyMainWindow::get_WindowNumber5()
    73. {
    74. return WindowNumber5;
    75. }
    76.  
    77. QWidget* MyMainWindow::get_WindowNumber6()
    78. {
    79. return WindowNumber6;
    80. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: multi plots

    Try reworking on the column, row, row span, and column span when laying out the widgert, try using the numbers in this code
    Qt Code:
    1. // Row 0, Column 0, 1, 2. All these are 3-Rows in height, and 1-Column is Width
    2. MyGridLayout->addWidget(fenetre.get_WindowNumber1(),0,0,3,1);
    3. MyGridLayout->addWidget(fenetre.get_WindowNumber2(),0,1,3,1);
    4. MyGridLayout->addWidget(fenetre.get_WindowNumber3(),0,2,3,1);
    5.  
    6. // Row 3, Column 0, 1, 2. All these are 3-Rows in height, and 1-Column is Width
    7. MyGridLayout->addWidget(fenetre.get_WindowNumber4(),3,0,3,1);
    8. MyGridLayout->addWidget(fenetre.get_WindowNumber5(),3,1,3,1);
    9. MyGridLayout->addWidget(fenetre.get_WindowNumber6(),3,2,3,1);
    10.  
    11. //Buttons
    12. // Row 0, 1, 2, 3, Column 3. All these are 1-Row in height, and 1-Column is Width
    13. MyGridLayout->addWidget(fenetre.get_BUTTONRun() ,0,3,1,1);
    14. MyGridLayout->addWidget(fenetre.get_BUTTONQuit() ,1,3,1,1);
    15. MyGridLayout->addWidget(fenetre.get_BUTTONAbout() ,2,3,1,1);
    16. MyGridLayout->addWidget(fenetre.get_BUTTONContact(),3,3,1,1);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default Re: multi plots

    thank you a lot, i will try this.

    see you

  4. #4
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default Re: multi plots

    I have test yout code but it make problems...

    http://imageshack.us/photo/my-images/829/myplots.jpg/

    i don't understand how i can make a correct ploting...

  5. #5
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: multi plots

    I think you need to properly configure the min, max, and hint sizes for the widgets defined in QWT.

  6. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: multi plots

    Quote Originally Posted by Santosh Reddy View Post
    I think you need to properly configure the min, max, and hint sizes for the widgets defined in QWT.
    No much simpler - all plot widgets are uncontrolled by a layout ( only the parent widgets of the plots are ).

    QLayout problems are completely unrelated to Qwt ( it doesn't matter if you want to arrange QwtPlots or any other Qt widgets ) and insisting on posting in the wrong group will only result in getting no answer.

    Again: the newbie section is made for question like this one !

    Uwe

  7. The following user says thank you to Uwe for this useful post:

    Santosh Reddy (24th May 2011)

  8. #7
    Join Date
    May 2011
    Posts
    21
    Thanks
    1
    Thanked 5 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: multi plots

    And about this one ?

  9. #8
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: multi plots

    I agree with Uwe

Similar Threads

  1. qwt plots & inheritance
    By fatecasino in forum Qwt
    Replies: 1
    Last Post: 14th December 2010, 15:35
  2. Plots and Layouts
    By Ozzy in forum Qwt
    Replies: 5
    Last Post: 17th November 2009, 10:00
  3. Zooming two plots simultaneously
    By Ban-chan in forum Qwt
    Replies: 2
    Last Post: 2nd September 2009, 20:42
  4. Replies: 4
    Last Post: 23rd March 2009, 02:47
  5. Reg multiple plots in Qwt
    By Tavit in forum Qwt
    Replies: 4
    Last Post: 23rd June 2008, 14:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.