Results 1 to 8 of 8

Thread: Repaint Widget in an other

  1. #1
    Join Date
    Sep 2006
    Posts
    8
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Repaint Widget in an other

    Hi,
    I actually try to repaint a widget with an other widget, but it seems that not work. So, perhaps I'm in a wrong way about how to use that.
    The code is really simple
    Qt Code:
    1. void
    2. QpulsarPopupEditorContainer::paintEvent(QPaintEvent *event)
    3. {
    4. // m_waitEditor, QWidget that contain a QLabel with text
    5. if(m_waitEditor)
    6. {
    7. QPaintEngine *l_paintEngine =m_waitEditor->paintEngine();
    8. QPainter *l_painter = l_paintEngine->painter();
    9. }
    10. else
    11. QWidget::paintEvent(event);
    12. }
    To copy to clipboard, switch view to plain text mode 

    Does anyone have a solution ?

    Thanks in advance

    Philippe

  2. #2
    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: Repaint Widget in an other

    How about:
    Qt Code:
    1. m_waitEditor->update(); // schedules a paint event
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    Sep 2006
    Posts
    8
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Repaint Widget in an other

    That not work in my case, the problem is that I try to get the painter from a widget and putting it in an other.
    When I arrive in the paint event, it display nothing. I think that my problem is in my paintEvent but I don't no what !

    Philippe

  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: Repaint Widget in an other

    What is it you are actually trying to achieve? Maybe there's a better way.. In Qt4 you cannot paint outside paintEvent(). See notes about Qt::WA_PaintOutsidePaintEvent.
    J-P Nurmi

  5. #5
    Join Date
    Sep 2006
    Posts
    8
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Repaint Widget in an other

    I do not try to paint outside, the problem is, when I paint in the paint event, I only have an empty widget. I try to use drawText and the result is the same.
    Perhaps there is a better way, but for now, I do not see which way

    Philippe

  6. #6
    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: Repaint Widget in an other


  7. #7
    Join Date
    Sep 2006
    Posts
    8
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Repaint Widget in an other

    No, the problem stay.
    I try to find if I can find an other solution with QWidget::stackUnder() but it seems that was no the solution too.

  8. #8
    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: Repaint Widget in an other

    How did you use the redirecting?

    Qt Code:
    1. QPainter::setRedirected(m_waitEditor, this);
    2. QPaintEvent event(m_waitEditor->rect());
    3. QApplication::sendEvent(m_waitEditor, &event);
    4. QPainter::restoreRedirected(m_waitEditor);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. Replies: 1
    Last Post: 5th November 2006, 23:50
  2. Pin/Unpin Dock Widget
    By charlesD in forum Newbie
    Replies: 1
    Last Post: 21st June 2006, 06:57
  3. force repaint
    By georgie in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2006, 13:16
  4. Replies: 4
    Last Post: 24th March 2006, 22:50
  5. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16

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.