Esempio n. 1
0
void ToolTip::mouseDoubleClickEvent(QMouseEvent *event)
{
    sendEventToWidget(event);
}
Esempio n. 2
0
void ToolTip::mousePressEvent(QMouseEvent *event)
{
    hide();
    sendEventToWidget(event);
}
Esempio n. 3
0
void ToolTip::mouseReleaseEvent(QMouseEvent *event)
{
    sendEventToWidget(event);
}
Esempio n. 4
0
// main app processing loop
void Gui::update(void) {
    static bool isPressing = false;
    static int16_t pressing_x, pressing_y;
    static uint16_t stamp = millis();

    // Retrieve a point
    TSPoint p = ts->getPoint();

    // we have some minimum pressure we consider 'valid'
    // pressure of 0 means no pressing!
    if (p.z < MINPRESSURE || p.z > MAXPRESSURE) {
        uint16_t stampnow = millis() - stamp;

        // this serves as a debouncer/filter for those seemingly super crapola resistive panels
        // we are going to release this key after 5k millis regardless
        if ((stampnow > DEBOUNCE_DELAY && stampnow < 5000) && isPressing) {
            sendEventToWidget(pressing_x, pressing_y, GUI_EVENT_RELEASE);
            isPressing = false;
            stamp = millis();
        }
        return;
    }

    stamp = millis();

    // if the finger is still on the screen we don't need to do any work until it is released
    if (isPressing)
        return;

    // given a rotation for this tft, set th input device to map correctly to the display's orientation
    if (rotation == 0) {
        p.x = map(p.x, TS_MINX, TS_MAXX, 0, _tft->width());
        p.y = map(p.y, TS_MINY, TS_MAXY, 0, _tft->height());
    }
    else if (rotation == 90) {

        p.x = map(p.y, TS_MINY, TS_MAXY, 0, _tft->width());
        p.y = map(p.x, TS_MINX, TS_MAXX, _tft->height(), 0);
    }
    else if (rotation == 180) {

        p.x = map(p.x, TS_MINX, TS_MAXX, _tft->width(), 0);
        p.y = map(p.y, TS_MINY, TS_MAXY, _tft->height(), 0);
    }
    else if (rotation == 270) {
        int16_t oldx = p.x;
        p.x = map(p.y, TS_MINY, TS_MAXY, _tft->width(), 0);
        p.y = map(oldx, TS_MINX, TS_MAXX, 0, _tft->height());
    }

    Serial.print("x: ");
    Serial.print(p.x);
    Serial.print(" y: ");
    Serial.println(p.y);

    pressing_x = p.x;
    pressing_y = p.y;

    sendEventToWidget(p.x, p.y, GUI_EVENT_PRESS);

    isPressing = true;
}