KDABLabs / kdabtv

This repository contains the code of the examples showcased in the KDAB TV video series.
https://www.kdab.com/kdabtv
MIT License
268 stars 77 forks source link

CornerButton example bug - error on touchscreen #3

Open poltpolt opened 1 year ago

poltpolt commented 1 year ago

When using a touchscreen all works fine if I pick any of the 2 actions added.

But if I open the BurgerMenu popup ,then decide that I don't want to choose any of the actions in the CornerButton so I click elsewhere in the app or click the CornerButton again to close the popup . Then touchscreen stops working in the app at all.

interestingly enough this mod I have made (being a beginner), works :

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    button = BurgerButton::addButtonToCorner(this);
    auto action = new QAction("About KDAB", this);
    this->addAction(action);

    action = new QAction("Help", this);
    this->addAction(action);
    contextMenu.addAction(action);
    connect(button,&BurgerButton::clicked,this, &MainWindow::myAction);
}

void MainWindow::myAction()
{
    qDebug()<<"myAction";
    QPoint globalPos = button->mapToGlobal(button->rect().bottomLeft());
    QAction* selectedAction = contextMenu.exec(globalPos);
}
jesperkdab commented 1 year ago

That is indeed peculiar. I'm doing nothing special in this code, besides calling: setPopupMode(QToolButton::InstantPopup);

So my subspecies is that some state inside Qt isn't properly cleared when touching outside.

Feel free to use the example to file a bug with Qt.

Cheers Jesper.