Results 1 to 1 of 1

Thread: QWidget::paintEvent() called repeatedly when using static Qt libraries

  1. #1
    Join Date
    Dec 2010
    Posts
    35
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWidget::paintEvent() called repeatedly when using static Qt libraries

    Environment: Qt 4.7.0. Windows Vista

    I've been developing an application with custom graphics (Qt primitives- n OpenGL-based). The main display window extends QMainWindow.

    For the QMainWindow::centralWidget I subclassed QWidget and added that to the QMainWindow. The centralWidget uses a QBoxLayout with vertical orientation.

    I then add a number of other custom QWidgets and QGLWidgets to this central widget. All of them, including the central widget do a 'setAutoFillBackground(true);' when created. This allows me to control the update of the widgets using a timer (e.g., connect(panelUpdateTimer, SIGNAL(timeout()), centralWidget, SLOT(repaint())) ; ).

    This all works nicely when I use the distributed Qt libraries on Windows Vista and using the Qt DLLs.

    However, I want to release my application with everything compiled into a nice tight package.

    I created a 'static' version of the Qt libraries using the following 'configure' line:
    Qt Code:
    1. configure -static -debug -opensource -qt-sql-mysql
    2. -qt-sql-odbc -graphicssystem runtime -qt-style-windowsvista
    To copy to clipboard, switch view to plain text mode 
    When I build my application against that structure, the centralWidget : : paintEvent() method is called continuously and not under my control. The event type (parameter) is a 'QEvent::Paint'.

    Am I missing something with the way I built the Qt libraries or is this a known bug or?

    Thanks.


    Added after 1 40 minutes:


    Figgered this out.....

    I re-built my application using the main Qt (DLL-based) structure and the problem went away (the centralWidget : : paintEvent() method is only called under my control, either via the timer or window resizing events).

    I then copied my application back to my Linux workstation and it works as expected there. So I was building confidence that I hadn't introduced a bug in my code and concentrated more on the Qt structure I built.

    Notice I build my Qt static libraries with '-graphicssystem runtime'. The Qt documentation doesn't really say what is used if I don't specify a QT_GRAPHICSSYSTEM value at runtime. The application is displayed so something is used, right?!?

    Well, I set QT_GRAPHICSSYSTEM to 'raster' and fired it back up. Behaves as expected. I also tried 'opengl' and 'native' and it also behaves as expected.

    Whew.
    Last edited by redBeard; 16th April 2011 at 00:38.

Similar Threads

  1. paintEvent not getting called with QMainWindow
    By DiamonDogX in forum Qt Programming
    Replies: 12
    Last Post: 15th June 2011, 23:23
  2. Replies: 2
    Last Post: 16th February 2011, 14:59
  3. No paintEvent is called
    By HeReSY in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2011, 17:11
  4. Replies: 0
    Last Post: 29th April 2010, 06:44
  5. QWidget::paintEvent() behaviour
    By Caius Aérobus in forum Qt Programming
    Replies: 5
    Last Post: 11th April 2008, 18: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.