Results 1 to 8 of 8

Thread: how i can increase the size of my plots and have a good organisation of this widget ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    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: how i can increase the size of my plots and have a good organisation of this widg

    Ok, I took a small liberty to modify your code hope you don't mine it. This would make all the plots expand to the window size, and also not allow the window to be smaller than a certain size. I checked its working on my machine.
    QwtLayout.jpg
    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.show();
    9. return app.exec();
    10. }
    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. explicit MyMainWindow(QWidget* parent = 0);
    16.  
    17. private:
    18. QPushButton *BUTTONRun;
    19. QPushButton *BUTTONQuit;
    20. QPushButton *BUTTONAbout;
    21. QPushButton *BUTTONContact;
    22.  
    23. QwtPlot *myPlot1;
    24. QwtPlot *myPlot2;
    25. QwtPlot *myPlot3;
    26. QwtPlot *myPlot4;
    27. QwtPlot *myPlot5;
    28. QwtPlot *myPlot6;
    29. };
    30. #endif // MYMAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 
    MyMainWindow.cpp
    Qt Code:
    1. #include "MyMainWindow.h"
    2. #include <QGridLayout>
    3. #include <QHBoxLayout>
    4.  
    5. MyMainWindow::MyMainWindow(QWidget* parent) : QWidget(parent)
    6. {
    7. QGridLayout* mainLayout = new QGridLayout();
    8. setLayout(mainLayout);
    9.  
    10. myPlot1 = new QwtPlot();
    11. myPlot2 = new QwtPlot();
    12. myPlot3 = new QwtPlot();
    13. myPlot4 = new QwtPlot();
    14. myPlot5 = new QwtPlot();
    15. myPlot6 = new QwtPlot();
    16.  
    17. myPlot1->setMinimumSize(200, 100);
    18. myPlot2->setMinimumSize(200, 100);
    19. myPlot3->setMinimumSize(200, 100);
    20. myPlot4->setMinimumSize(200, 100);
    21. myPlot5->setMinimumSize(200, 100);
    22. myPlot6->setMinimumSize(200, 100);
    23.  
    24. QWidget* buttonWidget = new QWidget();
    25. QGridLayout* buttonLayout = new QGridLayout();
    26.  
    27. BUTTONRun = new QPushButton("RUN");
    28. BUTTONQuit = new QPushButton("STOP");
    29. BUTTONAbout = new QPushButton("About");
    30. BUTTONContact = new QPushButton("Contact");
    31.  
    32. buttonLayout->addWidget(BUTTONRun ,0,0);
    33. buttonLayout->addWidget(BUTTONQuit ,0,1);
    34. buttonLayout->addWidget(BUTTONAbout ,1,0);
    35. buttonLayout->addWidget(BUTTONContact,1,1);
    36.  
    37. buttonWidget->setLayout(buttonLayout);
    38.  
    39. mainLayout->addWidget(myPlot1 ,0,0,1,1);
    40. mainLayout->addWidget(myPlot2 ,0,1,1,1);
    41. mainLayout->addWidget(myPlot3 ,0,2,1,1);
    42. mainLayout->addWidget(myPlot4 ,1,0,1,1);
    43. mainLayout->addWidget(myPlot5 ,1,1,1,1);
    44. mainLayout->addWidget(myPlot6 ,1,2,1,1);
    45. mainLayout->addWidget(buttonWidget ,0,3,1,1);
    46.  
    47. QObject::connect(BUTTONQuit, SIGNAL(clicked()), qApp, SLOT(quit()));
    48. QObject::connect(BUTTONAbout, SIGNAL(clicked()), qApp, SLOT(aboutQt()));
    49. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to Santosh Reddy for this useful post:

    21did21 (30th May 2011)

Similar Threads

  1. QSlider: Increase handle size -> How ?
    By ArneBurghardt in forum Qt Programming
    Replies: 6
    Last Post: 11th August 2016, 20:58
  2. increase the size of my plot
    By 21did21 in forum Qwt
    Replies: 4
    Last Post: 29th May 2011, 11:03
  3. QSystemTrayIcon - increase icon size
    By FredB in forum Qt Programming
    Replies: 0
    Last Post: 30th March 2011, 22:18
  4. Increase legend icon size?
    By torrentss in forum Qwt
    Replies: 2
    Last Post: 1st September 2010, 12:26
  5. Font size increase in QtableWidget
    By sosanjay in forum Qt Programming
    Replies: 1
    Last Post: 19th November 2009, 14:51

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
  •  
Qt is a trademark of The Qt Company.