Results 1 to 3 of 3

Thread: Problem with resize() on dual screen setup (X11/KDE)

  1. #1
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Problem with resize() on dual screen setup (X11/KDE)

    Hey board,

    I've got a problem with the QMainWindow::resize() function on a dual monitor setup. See the attached files to reproduce (if you have dual monitor setup of course!). The problem exists at least with Qt 4.6.0 on X11/KDE, but if I recall correctly I've seen it with older versions of Qt as well.

    Anyway, what basically seems to happen is that resize() cannot set a size larger than one screen before the window is drawn. In the example if call resize(2400, 600) before calling app->exec(), the window will then be shown with a size of 1600x600 (because my monitor has 1600 pixels horizontally).

    Then, I do a QTimer::singleShot of two seconds, and after these two seconds I call resize(2400,600) again. Now, the window has the desired size.

    Does anyone have a suggestion on a proper fix for this problem? Thanks!


    PS I had some problems with the attachments, so here are the sources (its not much anyway)

    main.cpp:
    Qt Code:
    1. #include <QtCore>
    2. #include <QtGui>
    3.  
    4. #include "Test.h"
    5.  
    6. int main (int argc, char **argv)
    7. {
    8. QApplication app (argc, argv);
    9.  
    10. w->move (0,0);
    11. w->resize(2400, 600);
    12. w->show();
    13.  
    14. Test lT(w);
    15. QTimer::singleShot (2000, &lT, SLOT(setSize()));
    16.  
    17. return app.exec();
    18. }
    To copy to clipboard, switch view to plain text mode 

    Test.h:
    Qt Code:
    1. #include <QtCore>
    2. #include <QtGui>
    3.  
    4. class Test : public QObject
    5. {
    6. Q_OBJECT
    7.  
    8. public:
    9. Test (QMainWindow *aMW)
    10. {
    11. mMW = aMW;
    12. }
    13.  
    14. public slots:
    15. void setSize ()
    16. {
    17. mMW->resize (2400, 600);
    18. }
    19.  
    20. private:
    21. };
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with resize() on dual screen setup (X11/KDE)

    I was hoping for some replies in the morning ...

    Anyway, I've been thinking, and I suppose it would help if I could get some signal when I'm sure that everything is drawn for the first time. I can then resize on that signal. However, looking at the QMainWindow documentation I see no such signal. Any suggestions?

  3. #3
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with resize() on dual screen setup (X11/KDE)

    For anyone having the same problem, it appears you can workaround this by calling qApp->processEvents() before qApp->exec() is called. Between these two calls you should now be able to resize. Obviously, this is a workaround and no real solution, so I'll submit a bugreport to Qt.

Similar Threads

  1. How to get screen resize event?
    By kamlesh.sangani in forum Qt Programming
    Replies: 8
    Last Post: 10th March 2010, 09:46
  2. How to resize the openfiledialog to 320x240 Screen?
    By augusbas in forum Qt Programming
    Replies: 4
    Last Post: 7th July 2009, 10:13
  3. Dual frame buffers /dev/fb0 and /dev/fb1
    By ghassett in forum Qt Programming
    Replies: 0
    Last Post: 28th May 2009, 19:57
  4. KDevelop debugger setup problem
    By vieraci in forum KDE Forum
    Replies: 13
    Last Post: 17th September 2007, 02:13
  5. Dual TCP/IP Client/Server
    By jimroos in forum Qt Programming
    Replies: 1
    Last Post: 29th June 2007, 22:58

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.