Results 1 to 10 of 10

Thread: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole screen?

  1. #1
    Join Date
    Mar 2015
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Question QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole screen?

    I put QwtPlot in QTabWidget, then QMainWindow::showMaximized when construct MainWindow doesn't fill the whole screen. although it looks like Maximized by the Maximize button. Is there any way to solve this problem?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole scr

    You'll need to be a bit more forthcoming with details.

    Did the main window not show maximized?
    Did the tabwidget not fill the window?
    Did the plot not fill the tabwidget?

    Cheers,
    _

  3. #3
    Join Date
    Mar 2015
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole scr

    Thank you for your reply. Details:
    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6.  
    7. QTabWidget *tw = new QTabWidget();
    8.  
    9. QwtPlot *pt = new QwtPlot();
    10. tw->insertTab(0, pt, "pt");
    11.  
    12. QStatusBar *bar = QMainWindow::statusBar();
    13. QLabel *detailLabel = new QLabel("test");
    14. bar->addWidget(detailLabel, 1);
    15.  
    16. setCentralWidget(tw);
    17.  
    18.  
    19. showMaximized();
    20. }
    To copy to clipboard, switch view to plain text mode 
    tt.jpg
    Last edited by anda_skoa; 24th March 2015 at 04:49. Reason: fixed code tag

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole scr

    Do you do anything with the main window instance other than creating it?

    Cheers,
    _

  5. #5
    Join Date
    Mar 2015
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole scr

    No. I just modified the MainWindow construct method code as above. I use qt 5.4.0.

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole scr

    Ok, just to verify: you are not calling show() on it in main(), right?

    Because that is what gets usually generated by templates.

    Cheers,
    _

  7. #7
    Join Date
    Mar 2015
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole scr

    I call show() in main as below. To solve the problem, I create new project by templates and only just modify MainWindow::MainWindow.
    Qt Code:
    1. #include "mainwindow.h"
    2. #include <QApplication>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. MainWindow w;
    8. w.show();
    9.  
    10. return a.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 
    Extra information: if not add statusbar, then everything ok. Or not add qwtplot tab, everything is ok too.

  8. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole scr

    Quote Originally Posted by likeforever View Post
    I call show() in main as below.
    So let me get this straight:

    I asked you if you do anything else with the instance other than creating it.
    You said you do not.
    Now you say you do.

    Why not call showMaximized() instead of hoping that the show() does not change the state you requested inside the window's constructor?
    Luck based programming?

    Cheers,
    _

  9. #9
    Join Date
    Mar 2015
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole scr

    Thank you for your patient answer.
    I tried showMaximized inside main() or remove show() in main, but it can't work too.

  10. #10
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot in QTabWidget, then QMainWindow::showMaximized doesn't fill the whole scr

    Hmm.

    Have you tried without the
    Qt Code:
    1. ui->setupUi(this);
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. How to get splitter objects to fill the screen when maximized
    By jshafferman in forum Qt Programming
    Replies: 1
    Last Post: 8th March 2011, 21:53
  2. Fill Screen with a single colour.
    By TotalNovice in forum Newbie
    Replies: 2
    Last Post: 26th November 2010, 09:54
  3. QTabWidget fill all parent widget
    By kaszewczyk in forum Newbie
    Replies: 5
    Last Post: 19th February 2010, 10:27
  4. making qmainwindow dynamically resizable to fit to screen
    By Amit_3117 in forum Qt Programming
    Replies: 4
    Last Post: 16th October 2009, 12:59
  5. Open a QMainWindow in full screen mode?
    By probine in forum Qt Programming
    Replies: 7
    Last Post: 29th November 2006, 13:44

Tags for this Thread

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.