Results 1 to 6 of 6

Thread: delay in qapplication

  1. #1
    Join Date
    Nov 2006
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default delay in qapplication

    I am using Visual Studio 2003 and qt 4.2.0.I am using a dll that written to access MSSQL Server database with qt libraries.

    Executable of the project runs properly on my pc. It exeutes a stored procedure and retrieves the results in a few seconds.
    But when i try it on another pc it takes 40 seconds to retrieve the database records(by executing the same stored proceudre.).

    I debugged the project and realized taht it is the
    QApplication a(argc, argv);
    line that takes the approximately 40 seconds.

    Anybody has any idea which setting causes that delay?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: delay in qapplication

    You'd have to debug more properly. Maybe the driver initialisation takes so long?

  3. #3
    Join Date
    Nov 2006
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: delay in qapplication

    Here is my code.
    Qt Code:
    1. #include "dbclientside.h"
    2. #include <QApplication>
    3. void execute()
    4. {
    5. //calls methods of dll to execute a stored procedure and retrieve the resultset
    6. //prints the resultset to stdout
    7. }
    8. int main(int argc, char* argv[])
    9. {
    10. QApplication a(argc, argv); //This line takes approximately 40 seconds.
    11.  
    12. execute(); //This line takes just 1 or 2 seconds.
    13.  
    14. return a.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

    If you mean QODBC driver, it is initialized in execute() method. And does not take so much time.

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

    Default Re: delay in qapplication

    Could you insert a breakpoint on the line constructing a QApplication object and then step into QApplication's constructor while debugging? Maybe it's something in QCoreApplication::init() what's taking so long.
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: delay in qapplication

    Quote Originally Posted by mandal View Post
    If you mean QODBC driver, it is initialized in execute() method. And does not take so much time.
    Plugins get initialised inside QCoreApplication constructor. I didn't mean your code to initialise the database.

    Do what JPN suggests - dive into QApplication code. Remember to compile in debug mode or else you won't get much info.

  6. #6
    Join Date
    Nov 2006
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: delay in qapplication

    Qt Code:
    1. void QApplicationPrivate::construct(
    2. #ifdef Q_WS_X11
    3. Display *dpy, Qt::HANDLE visual, Qt::HANDLE cmap
    4. #endif
    5. )
    6. {
    7. Q_INIT_RESOURCE(qstyle);
    8.  
    9. qt_is_gui_used = (qt_appType != QApplication::Tty);
    10. process_cmdline(); //<---- HERE WHERE MY CODE HANGS FOR 40 SECONDS
    11. // Must be called before initialize()
    12. qt_init(this, qt_appType
    13. #ifdef Q_WS_X11
    14. , dpy, visual, cmap
    15. #endif
    16. );
    17. initialize();
    18. eventDispatcher->startingUp();
    19.  
    20. #ifdef QT_EVAL
    21. extern void qt_gui_eval_init(uint);
    22. qt_gui_eval_init(application_type);
    23. #endif
    24. }
    To copy to clipboard, switch view to plain text mode 

    I debugged detailly and found the line causes the delay.This method is in qapplcation.cpp file.
    Any suggestions? Thanx a lot

Similar Threads

  1. Replies: 15
    Last Post: 21st April 2007, 17:46
  2. Setting style in QApplication
    By Doug Broadwell in forum Newbie
    Replies: 2
    Last Post: 28th October 2006, 21:56
  3. qapplication with open(/dev/name,O_RDWR) crashed???
    By ttbug in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 16th September 2006, 07:56
  4. Reponsabilities of QApplication and QMainWindow classes
    By yellowmat in forum Qt Programming
    Replies: 4
    Last Post: 4th September 2006, 16:21
  5. Can I create a QApplication inside a DLL?
    By oob2 in forum Qt Programming
    Replies: 6
    Last Post: 1st July 2006, 10:08

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.