Results 1 to 4 of 4

Thread: qt3 to qt4 conversion: debug messages

  1. #1
    Join Date
    Oct 2007
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default qt3 to qt4 conversion: debug messages

    Hi,

    I am converting a rather large project that runs on qt3 on Linux to run on qt4 on XP (because there is no qt3 opensource for XP).

    (XP runs as a vmware client on the Debian Sid Linux host).

    I get lots of:
    QWidget::repaint: Recursive repaint detected
    and
    QPainter::begin: Widget painting can only begin as a result of a paintEvent

    And no icons show up in the main window and no editor windows open up.

    So in an attempt to find what in the code is doing that I did a qt debug library build from its shortcut in Qt by Trolltech v4.3.1 (OpenSource).

    Then I added CONFIG += debug and CONFIG += console to the pro file and reran qmake and redid the make.

    But to my surprise I got no added messages at all.

    Is there a way to find out what in the code makes those messages appear? There are over a 100 modules and 1000's of lines of code :-(

    Hugo

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qt3 to qt4 conversion: debug messages

    QWidget::repaint: Recursive repaint detected
    Happens when calling repaint() from a paint event. This shouldn't be done.
    Solution: review the code and fix it.

    QPainter::begin: Widget painting can only begin as a result of a paintEvent
    Happens when painting on widgets outside paint events. In Qt 3 this was possible but not in Qt 4. In 4 you can only draw on a widget in its paintEvent.
    The solution for this one is to examine all the code and rewrite those parts.
    So, wherever you see
    Qt Code:
    1. QPainter p(someWidget)
    To copy to clipboard, switch view to plain text mode 
    outside the widgets paint event, then you must rewrite that code.

  3. #3
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qt3 to qt4 conversion: debug messages

    Many Qt3 programs would paint outside of paint events. This was common for graphs, when you would want to plot a point as soon as some new data came in. One good way to port this style of painting, is to paint to a pixmap instead of the widget. You can paint to a pixmap at any time, then call update() to schedule a paint event. Then in the paintEvent() just draw the pixmap.

  4. #4
    Join Date
    Oct 2007
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qt3 to qt4 conversion: debug messages

    Thanks!

    This proves a formidable challenge. gdb showed that the recursive repaints came from processEvents calls that were all over the place. Eliminating those got rid of the message but leaves the app screen looking ridiculous: an empty frame while a very complicated plot is drawn consisting of thousands of lines.

    Hugo

Similar Threads

  1. What is debug mode for without MSVC?
    By firegun9 in forum Newbie
    Replies: 1
    Last Post: 5th September 2007, 17:21
  2. Qt4 open src mingw from a PC to another
    By nvictor in forum Installation and Deployment
    Replies: 11
    Last Post: 1st May 2007, 17:41
  3. Adding custom defines when on debug build
    By chus in forum Qt Programming
    Replies: 2
    Last Post: 2nd March 2007, 11:38
  4. Replies: 11
    Last Post: 22nd March 2006, 19:06
  5. Qt4 no debug messages
    By TheKedge in forum Newbie
    Replies: 3
    Last Post: 23rd January 2006, 17:52

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.