Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Paint issue in Widget
Forum Updated to NodeBB v4.3 + New Features

[Solved]Paint issue in Widget

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Craig27
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      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.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Craig27
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

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

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved