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]Stippling pattern with QTabletEvent
Forum Updated to NodeBB v4.3 + New Features

[Solved]Stippling pattern with QTabletEvent

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 412 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.
  • D Offline
    D Offline
    DanqueDynasty
    wrote on last edited by
    #1

    I have a program that utilizes the QTabletEvent to handle wacom tablet input. I have a bug where the press event will timeout periodically, creating a stippling pattern. The implementation of the code:
    @//variables involved
    QPoint drawPath[3];
    bool deviceDown = false;
    void Foo::tabletEvent(QTabletEvent *event)
    {
    switch(event->type)
    {
    case QEvent::TabletPress:
    if(!deviceDown)
    {
    deviceDown = true;
    drawPath[0] = drawPath[1] = drawPath[2] = event->pos();
    }
    break;
    case QEvent::TabletRelease:
    if(deviceDown) deviceDown = false;
    break;
    case QEvent::TabletMove:
    drawPath[2] = drawPath[1];
    drawPath[1] = drawPath[0];
    drawPath[0] = event->pos();

    if(deviceDown)
    {
      //drawCode
    }
     break;
    

    }
    }
    @

    And this is the result:
    !https://t.co/kuzSaMPSUZ(Drawing Example)!

    Thanks in advance.

    Edit: Solved it, it was all in the draw code, had to call up drawPath[2] instead of drawPath[1] in painter.drawLines();

    Swing Innovations: http://swinginnovations.com/

    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