Results 1 to 11 of 11

Thread: How to enhance the display time of a QDialog like QWidget

  1. #1
    Join Date
    Jul 2014
    Location
    Manila Philippines
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to enhance the display time of a QDialog like QWidget

    When the form is a QDialog, it first display the main frame before its children widgets. I want it to be faster like when the form is QWidget it display the form and children at same time.

    The form contains button that has images and QGraphicsDropShadowEffect and I know that it is the cause of slow UI. Even it is slow I want all of the widgets and form to display at the same time using QDialog. The code is old and I need to modify its dependent modules / procedures when I'm gonna change it to QWidget. Here are the codes regarding the form maybe one of these cause the issue.

    Qt Code:
    1. this->setWindowFlags( Qt::Dialog | Qt::CustomizeWindowHint );
    2. this->setAutoFillBackground(true);
    3. this->setWindowModality(Qt::WindowModal);
    4. this->setModal(true);
    To copy to clipboard, switch view to plain text mode 

  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: How to enhance the display time of a QDialog like QWidget

    I am not sure what you are saying.

    The window shows up empty and then its contents starts appearing?

    Cheers,
    _

  3. #3
    Join Date
    Jul 2014
    Location
    Manila Philippines
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to enhance the display time of a QDialog like QWidget

    Yes. For example I have a dialog and its children are 3 push button. When I call the dialog it will pop up first before its children. But when it is widget it will show up once. Im using qt 4.7.3

  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: How to enhance the display time of a QDialog like QWidget

    Since you have expensive graphics effects on some of the children, have you tried without them?

    Cheers,
    _

  5. #5
    Join Date
    Jul 2014
    Location
    Manila Philippines
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to enhance the display time of a QDialog like QWidget

    Yes recently I tried it already I remove the stylesheet on mainwindow and when I call a QDialog it still hapens but just a blink of an eye.

  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: How to enhance the display time of a QDialog like QWidget

    Even without the drop shadow effect? Wow.

    You could try positioning the window off-screen before showing and then moving it into view.

    Cheers,
    _

  7. #7
    Join Date
    Jul 2014
    Location
    Manila Philippines
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to enhance the display time of a QDialog like QWidget

    Is it normal that it is happening in our app? Our pro file includes 50folders and each folder have 3-10 classes. Even on the mainwindow form it happens too.

    Is your suggestion ok even in this scenario?:
    I show the widget, I hide it , and show it again and it still happened, the parent widget is shown first before its children. And some of it is exec() and not show().
    Last edited by reginaldt; 9th July 2014 at 03:45. Reason: updated contents

  8. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to enhance the display time of a QDialog like QWidget

    Our pro file includes 50folders and each folder have 3-10 classes.
    The size and organization of your project files has nothing to do with run-time performance. It might affect how long it takes to build the project, but once it is running it is just a big lump of code.

    It sounds like your child widgets are doing a lot of unnecessary repainting. Put a qDebug() in your child widget paintEvent() and the parent widget showEvent() and see how many times the child is painted when the parent is shown.

  9. #9
    Join Date
    Jul 2014
    Location
    Manila Philippines
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to enhance the display time of a QDialog like QWidget

    The paint event is called every second because I update the display time.

  10. #10
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to enhance the display time of a QDialog like QWidget

    I update the display time
    I have no idea what that means, and it doesn't answer the question anyway. The question is not how many times you think the window is being repainted, it is how many times Qt is actually repainting it. Adding some code in the paintEvent() for the label that counts the number of times it is executed for each of your "update the display time" calls will tell you if there is excessive painting happening.

  11. #11
    Join Date
    Jul 2014
    Location
    Manila Philippines
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to enhance the display time of a QDialog like QWidget

    Sorry I didnt explain I mean the form have a QLabel that update its display every second that's the reason I think every second the qdebug I put on paintevent is keep showing. I cant determine if there is other cause of paint event aside from that. And on my qmainwindow I have a QMovie thats why I it keeps showing the Qdebug I put on paintevent too. But the showevent only called once on both.

Similar Threads

  1. QDialog resizeEvent not happening in time?
    By Urthas in forum Newbie
    Replies: 3
    Last Post: 15th September 2010, 06:11
  2. Display QDialog on Top of all.
    By sudhansu in forum Qt Programming
    Replies: 6
    Last Post: 22nd April 2010, 08:42
  3. Replies: 5
    Last Post: 21st March 2009, 09:10
  4. Display a QWidget on two X-Server at the same time
    By tarod in forum Qt Programming
    Replies: 0
    Last Post: 1st July 2008, 12:55
  5. QDialog to QWidget
    By baray98 in forum Qt Programming
    Replies: 2
    Last Post: 3rd June 2008, 07:55

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.