[Solved]Paint issue in Widget



  • I'm trying my hands on clock in Widget from the reference "digiclock example":http://doc.qt.digia.com/qt/demos-embedded-digiflip.html

    we intended to improvise the project with other functionalities, so I begun with adding colon between the digits( for example 10:30), though am drawing the rectangle on the paint event. I'm not able see them on the screen.

    Below is the code snippet, i have tried to introduce a plane rectangle on paint event but its not visible on the screen

    @void DrawingDigits::paintEvent(QPaintEvent *event) {
    Q_UNUSED(event);

    QPainter painter(this);
    painter.setPen(Qt::red); 
    painter.drawRect(10,10,10,10);
    
    if (m_animator.state() == QTimeLine::Running) {
        paintFlip();
    } else {
        paintStatic();
    }
    

    }@

    Can anyone please let me know where am getting it wrong (Kindly refer the link for the complete code in case needed). I'm not getting any warning while debugging.


  • Moderators

    I would suspect that after you draw your rectangle, the paintFlip() and paintStatic() methods are repainting the entire area, covering up the rectangle you just drew.



  • ohh yes...those methods are painting the entire area, I should have thought in that area
    Thanx a ton mate :)


  • Moderators

    No problem! Be sure and edit your first post and add [Solved] to the title. Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.