Results 1 to 4 of 4

Thread: Windows Binary Not Re-Painting Correctly

  1. #1
    Join Date
    Aug 2006
    Posts
    90
    Thanks
    6
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Windows Binary Not Re-Painting Correctly

    I don't really know what the problem is... but when I compile my program and run it on another windows machine... it is very very chopy.

    On the machines that I compile it on it runs very smoothly, but that is not the case on any other machine.

    I think it is a painting issue. I did override this function:
    Qt Code:
    1. void MainForm::paintEvent(QPaintEvent * /* event */)
    2. {
    3. QPainter paintGo(this); // Green Circle
    4. QPainter paintStop(this); // Red Circle
    5.  
    6. showServiceStatus(paintGo, paintStop);
    7. }
    To copy to clipboard, switch view to plain text mode 

    I have a timer that goes off every half second. when that happens it calls a function that does an "update()" to repaint everything. It appears that things are ONLY getting repainted when this timer triggers. Am I doing something wrong here?

  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: Windows Binary Not Re-Painting Correctly

    Not likely. Maybe you're missing something on those other machines or maybe they're just much slower then the machine you compiled it on? Or maybe you used some compilation flags which don't work correctly on other configurations.

    BTW. This seems little incorrect:
    Qt Code:
    1. QPainter paintGo(this); // Green Circle
    2. QPainter paintStop(this); // Red Circle
    To copy to clipboard, switch view to plain text mode 
    Why do you use two painters on the same widget here?

  3. #3
    Join Date
    Aug 2006
    Posts
    90
    Thanks
    6
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Windows Binary Not Re-Painting Correctly

    Why do you use two painters on the same widget here?
    I did that because showServiceStatus() will draw two circles... kind of like a stop sign. One QPainter object draws the "Go" light, the other draw the "Stop" light.

    I created two objects because I feel it is cleaner from a software engineering point of view, but since I am very new to Qt... if you see something wrong with that please let me know.

    As for my real problem... I still don't know what to do. I checked to make sure my other machine had all of the DLLs the exe was linked against. If I figure it out I'll let you all... incase anyone has a simular problem

  4. #4
    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: Windows Binary Not Re-Painting Correctly

    Quote Originally Posted by bpetty
    I did that because showServiceStatus() will draw two circles... kind of like a stop sign. One QPainter object draws the "Go" light, the other draw the "Stop" light.

    I created two objects because I feel it is cleaner from a software engineering point of view, but since I am very new to Qt... if you see something wrong with that please let me know.
    Treat a QPainter object as a sheet of paper. You don't need two sheets of paper to draw two circles. You can draw one circle and then the other (on the same sheet). You made two sheets and you want to put then in the same place. I guess you won't see two circles this way...

    As for my real problem... I still don't know what to do. I checked to make sure my other machine had all of the DLLs the exe was linked against. If I figure it out I'll let you all... incase anyone has a simular problem
    Try using a single QPainter. Using two painters might be the cause of your problems.

    Qt Code:
    1. void MainForm::paintEvent(QPaintEvent *){
    2. QPainter painter(this);
    3. painter.setBrush(Qt::red);
    4. painter.drawEllipse(20, 20, 50, 50);
    5. painter.setBrush(Qt::blue);
    6. painter.drawEllipse(100, 100, 50, 50);
    7. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. making a portable binary on windows
    By patcito in forum Qt Programming
    Replies: 10
    Last Post: 29th May 2006, 09:02
  2. Qt and windows vista
    By munna in forum General Discussion
    Replies: 8
    Last Post: 11th January 2006, 22:33

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.