bool QWaylandMaterialDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local,
                                             const QPointF &global, Qt::MouseButtons b,
                                             Qt::KeyboardModifiers mods)

{
    Q_UNUSED(global);

    // Figure out what area mouse is in
    if (closeButtonRect().contains(local)) {
        if (clickButton(b, Close))
            QWindowSystemInterface::handleCloseEvent(window());
    } else if (maximizeButtonRect().contains(local)) {
        if (clickButton(b, Maximize))
            window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState
                                                                    : Qt::WindowMaximized);
    } else if (minimizeButtonRect().contains(local)) {
        if (clickButton(b, Minimize))
            window()->setWindowState(Qt::WindowMinimized);
    } else if (local.y() <= margins().top()) {
        processMouseTop(inputDevice, local, b, mods);
    } else if (local.y() > window()->height() - margins().bottom() + margins().top()) {
        processMouseBottom(inputDevice, local, b, mods);
    } else if (local.x() <= margins().left()) {
        processMouseLeft(inputDevice, local, b, mods);
    } else if (local.x() > window()->width() - margins().right() + margins().left()) {
        processMouseRight(inputDevice, local, b, mods);
    } else {
        waylandWindow()->restoreMouseCursor(inputDevice);
        setMouseButtons(b);
        return false;
    }

    setMouseButtons(b);
    return true;
}
Example #2
0
void DialogyWidget::keyPressEvent(QKeyEvent* e)
{
#ifdef Q_OS_MAC
    if (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period) {
        if (!clickButton(QDialogButtonBox::Cancel)) {
            e->ignore();
        }
    }
    else
#endif
    if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
        switch (e->key()) {
            case Qt::Key_Enter:
            case Qt::Key_Return:
                if (!clickButton(QDialogButtonBox::Ok)) {
                    e->ignore();
                }
                break;
            case Qt::Key_Escape:
                if (!clickButton(QDialogButtonBox::Cancel)) {
                    e->ignore();
                }
                break;
            default:
                e->ignore();
        }
    }
    else {
        e->ignore();
    }
}
static void select_single_click_handler(ClickRecognizerRef recognizer, void* context)
{
    if (actions_menu_is_displayed())
    {
        int16_t pickedItem = actions_menu_get_selected_index();
        if (pickedItem == 0)
        {
            nw_send_reply_text(text_buffer);
            actions_menu_hide();
            window_stack_pop(true);
        }
        else
        {
            char* copySource = actions_menu_get_action_text(pickedItem);
            int sourceLength = strlen(copySource);

            if (sourceLength + pos < MAX_CHARS)
            {
                strcpy(&text_buffer[pos], copySource);
                pos += sourceLength;
                drawNotepadText();
                actions_menu_hide();
            }
        }

        return;
    }

    clickButton(MID);
}
Example #4
0
Clock::Clock(QWidget *parent) : QWidget(parent)
{
    MINSET = 0;
    SECSET = 59;
    MSECSET = 99;
    msec = MSECSET;
    sec = SECSET;
    min = MINSET;
    showColon = true;
    runClock = false;
    slider = new QSlider(Qt::Horizontal);
    slider->setRange(1,120);
    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(moveSlider(int)));
    player = new QMediaPlayer;
    setWindowIcon(QIcon(":/png/icon.ico"));
    label = new QLabel();
    button = new QPushButton("PUSH ME!", this);
    connect(button, SIGNAL(clicked()), this, SLOT(clickButton()));
    lcd = new QLCDNumber(this);
    lcd->setDigitCount(9);
    lcd->display("4LoVe");
    QGridLayout *mainWindow = new QGridLayout();
    mainWindow->addWidget(button, 0, 1);
    mainWindow->addWidget(lcd, 0, 0);
    mainWindow->addWidget(label, 1, 0);
    mainWindow->addWidget(slider, 1, 1);
    label->setText("Take Care of Your Waist!");
    setLayout(mainWindow);
    setWindowTitle("Take Care Of Your Waist");
    QTimer *qtimer = new QTimer();
    connect(qtimer, SIGNAL(timeout()), this, SLOT(refreshTime()));
    qtimer->start(10);
    refreshTime();

}
Example #5
0
void GTUtilsPrimerLibrary::clearLibrary(HI::GUITestOpStatus &os) {
    const int size = librarySize(os);
    CHECK(size > 0, );
    GTWidget::click(os, table(os));
    selectAll(os);
    clickButton(os, Remove);
}
Example #6
0
void GTUtilsPrimerLibrary::addPrimer(HI::GUITestOpStatus &os, const QString &name, const QString &data) {
    AddPrimerDialogFiller::Parameters parameters;
    parameters.name = name;
    parameters.primer = data;
    GTUtilsDialog::waitForDialog(os, new AddPrimerDialogFiller(os, parameters));
    clickButton(os, Add);
    GTGlobals::sleep(50);
}
static void down_single_click_handler(ClickRecognizerRef recognizer, void* context)
{
    if (actions_menu_is_displayed())
    {
        actions_menu_move_down();
        return;
    }

    clickButton(BOT);
}
void TestMainWindow::testCrazyMonkeyClicks() {
    clickButton("Apply to video");
    clickButton("Filter up");
    clickButton("Apply to video");
    clickButton("Filter down");
    clickButton("Save configuration");
    clickButton("Add Edge filter");
    QTabWidget* tabWidget = mw->findChildren<QTabWidget*>().first();
    tabWidget->setCurrentIndex(1);
    clickButton("PSNR");
    clickButton("Bitrate");
    clickButton("Red histogram");
    TestAnalysisTab::loadVideo(QFINDTESTDATA("blumeYuv420_planar_176x144.yuv"));
    clickButton("PSNR");
    clickButton("Bitrate");
    clickButton("Red histogram");
    tabWidget->setCurrentIndex(0);
    clickButton("Remove filter");
    clickButton("Save configuration");
    clickButton("Add Contrast filter");
    TestFilterTab::loadVideo(QFINDTESTDATA("blumeYuv420_planar_176x144.yuv"));
    clickButton("Add Vintage filter");
    clickButton("Apply to video");
    triggerAction("Redo");
    triggerAction("Redo");
    triggerAction("Redo");
    clickButton("Add Vintage filter");
    triggerAction("Redo");
    triggerAction("Undo");
    tabWidget->setCurrentIndex(1);
    triggerAction("New");
    clickButton("Add video");





}
static void down_single_click_handler(ClickRecognizerRef recognizer, void* context) {
    
    clickButton(BOT);
}
static void select_single_click_handler(ClickRecognizerRef recognizer, void* context) {
    
    clickButton(MID);
}
// Modify these common button handlers
static void up_single_click_handler(ClickRecognizerRef recognizer, void* context) {
    
    clickButton(TOP);
    
}