Results 1 to 6 of 6

Thread: how to avoid QCanvasText flickering (Qt336)

  1. #1
    Join Date
    Feb 2006
    Posts
    31

    Default how to avoid QCanvasText flickering (Qt336)

    Hi,

    I have QCanvas, QCanvasView, QCanvasText objects. I implemented a scrolling text function which will be triggered by a QTimer to move QCanvasText object to left 2 pixels in every 100 ms.

    How to avoid it flickering?

    Thanks.

  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: how to avoid QCanvasText flickering (Qt336)

    Depends how you implemented it.

  3. #3
    Join Date
    Feb 2006
    Posts
    31

    Default Re: how to avoid QCanvasText flickering (Qt336)

    Here is a segment of my code:

    m_canvasView = new QCanvasView(this);
    m_canvas = new QCanvas();
    m_canvasView->setCanvas(m_canvas);
    m_canvasText = new QCanvasText(m_canvas);
    m_canvasText->setText("whatever");

    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), SLOT(myTick()));
    m_timer->start(100);

    myTick()
    {
    m_x -= 2;
    m_canvasText->move(m_x, m_y);
    }

  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: how to avoid QCanvasText flickering (Qt336)


  5. #5
    Join Date
    Feb 2006
    Posts
    31

    Default Re: how to avoid QCanvasText flickering (Qt336)

    Thanks.

    I removed my QTimer, override QCanvasText::advance() instead. But, it didn't help.

    However, I adjusted the paramenter in setXVelocity() from -2 to -1 and adjusted the parameter in setAdvancedPeriod() from 50 ms to 30 ms; now, it looks much better.

    Is it a solution?

  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: how to avoid QCanvasText flickering (Qt336)

    Sure, if you're satisfied with the move. But the effect you had was not flicker (the picture wasn't "blinking"), the move just didn't feel smooth because of too few frames per second.

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.