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. Draw dashline of 1 px width and opaque
Forum Updated to NodeBB v4.3 + New Features

Draw dashline of 1 px width and opaque

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 225 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.
  • T Offline
    T Offline
    Taytoo
    wrote on last edited by
    #1

    In paintevent(), I'm trying to draw horizontal Dash line of exactly 1 pixel width, but its being drawn 2 pixels wide and not opaque. Not sure what's going on.

    QPen pen;
    pen.setColor(QColor::fromRgb(0, 0, 140));
    pen.setStyle(Qt::PenStyle::DashLine);
    pen.setWidth(0);
    pen.setCosmetic(true);	
    

    Noticed another thing, seeing this issue when using drawLine, but when I use drawLines then the line width is 1px and color opaque.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Taytoo
      wrote on last edited by
      #2

      Turns out it was AntiAlias rendering hint that was causing it. Turning it off before drawing lines, results in proper 1 pixel line.

      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