Results 1 to 7 of 7

Thread: Problem with showMaximized()

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Problem with showMaximized()

    Hi,

    in my QMainWindow-class I call showMaximized(), which works if I comment out following line:
    Qt Code:
    1. img->setPixmap ( QPixmap(":/sokrates_600") );
    To copy to clipboard, switch view to plain text mode 

    img is a Label in an QWidget-based class, which builds a page in a QStackedWidget, which is set to central widget in the mainclass. When the image from the resource is set, the windows reduced to the preferred size of the image-holding-widget.

    What's wrong with setPixmap, that it destroys my showMaximized()?


    Thanks,
    Lykurg

    Note: If the application appears it seems that it starts in full screen, but then immediately shirks.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Problem with showMaximized()

    Have you changed default size policies?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: Problem with showMaximized()

    Quote Originally Posted by jpn View Post
    Have you changed default size policies?
    No, nothing. I use the Designer and just drag and drop a label to the widget.
    I figured out, that if I don't apply a layout to the widget, the window is shown maximized. If I chose any layout, the window is shrinking.

    Lykurg

    Edit: Also if I code by hand same result:
    Qt Code:
    1. window_startscreen::window_startscreen ( QWidget *parent )
    2. : QWidget ( parent )
    3. {
    4. QLabel * img = new QLabel;
    5. img->setPixmap ( QPixmap ( ":/sokrates_600" ) );
    6.  
    7. QHBoxLayout *layout = new QHBoxLayout;
    8. layout->addWidget ( img );
    9. setLayout ( layout );
    10. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Lykurg; 8th July 2007 at 18:38.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Problem with showMaximized()

    Which exact version of Qt on which platform? I can't reproduce the problem. I tried with following minimalistic code but the window is shown maximized. Does this not work for you?
    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char* argv[])
    4. {
    5. QApplication app(argc, argv);
    6. QWidget window;
    7.  
    8. QLabel* label = new QLabel;
    9. label->setPixmap(QPixmap("test.png"));
    10.  
    11. QHBoxLayout* layout = new QHBoxLayout;
    12. layout->addWidget(label);
    13. window.setLayout(layout);
    14.  
    15. window.showMaximized();
    16. return app.exec();
    17. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: Problem with showMaximized()

    Well, your example works. I have attached a half-minimalistic example, which works but also don't:
    • Run make and start lykurg -> the window is small
    • edit mainwindow.ui in designer and remove the whole "datei"-menu
    • rebuild the project and start -> window is shown maximized???


    I use Qt 4.3.0. What's the Problem with the menubar?


    Thanks, Lykurg
    Attached Files Attached Files

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: Problem with showMaximized()

    ... and I use the linux-version.

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Problem with showMaximized()

    Just to mention, I was able to reproduce the problem on X11. However, I'm not exactly sure which part of generated code causes the faulty behavior.
    J-P Nurmi

Similar Threads

  1. [QMYSQL] connection problem
    By chaos_theory in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd July 2007, 10:52
  2. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 13:54
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 15:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 22:36
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

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.