Results 1 to 5 of 5

Thread: App freezes when new Qlabel(this) in Mainwindow or resize call

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2013
    Posts
    11
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: App freezes when new Qlabel(this) in Mainwindow or resize call

    Hi Santhosh

    Note that if I do the same code in MainWindow function, it's the same behavior. So, it isn't an issue of a reset called many times. In fact try out my code on the first resize event and you will see the issue.

    Thanks

    Sean

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

    Default Re: App freezes when new Qlabel(this) in Mainwindow or resize call

    Ok your problem is not with App freezing, you App works as expected when QLabel is created in resizeEvent(). the problem is when a widget is created with a parent and not added to a layout, it is my default placed at parent's (0,0), which in this is case is overlapping with the menu bar and you cannot click on menu any more.

    Just try this and you can see for yourself
    Qt Code:
    1. QLabel *label = new QLabel("QLabel", this);
    To copy to clipboard, switch view to plain text mode 

    QMainWidget has a special layout, you will need to use setCentralWidget(label) after QLabel creation to make the menu work
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jun 2013
    Posts
    11
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: App freezes when new Qlabel(this) in Mainwindow or resize call

    Thanks !

    Sean

Similar Threads

  1. Call MainWindow through QDialog
    By sousadaniel7 in forum Qt Programming
    Replies: 13
    Last Post: 2nd May 2012, 15:35
  2. Replies: 1
    Last Post: 12th April 2011, 09:53
  3. How to call a dialog from a mainwindow
    By luiz4um in forum Qt Programming
    Replies: 26
    Last Post: 29th June 2010, 10:41
  4. MainWindow won't resize, why does this work?
    By weevil in forum Qt Programming
    Replies: 1
    Last Post: 20th June 2010, 07:08
  5. QFile::resize takes forever and freezes the GUI
    By MaximA in forum Qt Programming
    Replies: 8
    Last Post: 27th May 2008, 09:53

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