Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. wrong connected line with multi-touch in iOS using my code
Forum Updated to NodeBB v4.3 + New Features

wrong connected line with multi-touch in iOS using my code

Scheduled Pinned Locked Moved Mobile and Embedded
ioswidgetqt5.4creator
1 Posts 1 Posters 861 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.
  • M Offline
    M Offline
    mkdh
    wrote on last edited by mkdh
    #1

    I deploy my code on android.
    Then, it will draw separable line by each finger.
    Question 1:
    But when I deploy my code on iOS(iPad),
    it will connect the line between the different finger. ,That is not what I want.
    Why ? And how to correct it?

    Question 2:
    I put a pushbutton on my code.
    The below text is my current code.
    But I can't click the button on my android and iOS.
    Should I change some thing in my code?

    Question 3:
    In fact, I just want to ZoomIn or ZoomOut my graph by finger.
    I watch some video in Qt studio. But I don't find any example....

    TouchTest::TouchTest(QWidget *parent) :
        QWidget(parent),
        ui(new Ui::TouchTest)
    {
        ui->setupUi(this);
        this->setAttribute(Qt::WA_AcceptTouchEvents, true);
        connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(onClear_clicked()));
    }
    
    bool TouchTest::event(QEvent *e){
        switch (e->type()) {
        case QEvent::TouchBegin: {
            return true;
        }
        case QEvent::TouchUpdate:{
        }
        case QEvent::TouchEnd:
        {
            QTouchEvent *te = static_cast<QTouchEvent *>(e);
            this->addLine(te);
            return true;
        }
        case QEvent::Paint:
        {
            paintEvent((QPaintEvent *)e);
        }
        default:;
        }
        return QWidget::event(e);
    }
    
    void TouchTest::addLine(QTouchEvent *e)
    {
        QLineF line;
        QList<QTouchEvent::TouchPoint> touchPoints = e->touchPoints();
        foreach (QTouchEvent::TouchPoint i , touchPoints){
            qDebug()<<"i.pos()"<<i.pos()<<"i.lastPos()"<<i.lastPos();
            line.setP1(i.lastPos());
            line.setP2(i.pos());
            this->lines.push_back(line);
        }
        this->update();
    }
    
    void TouchTest::paintEvent(QPaintEvent *event){
        QPainter painter(this);
        painter.drawLines(this->lines);
        painter.end();
    }
    
    void TouchTest::onClear_clicked()
    {
        this->lines.clear();
        this->update();
    }
    
    TouchTest::~TouchTest()
    {
        delete ui;
    }
    

    PS:
    QVector<QLineF> lines;

    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