Child dialogs do not respond to touch input on Ubuntu
-
I have written a Qt Widget application to run on a touch tablet running Lubuntu 18.04.
My issue that is that my QDialog child classes frequently cannot process touch input. The dialog appears on screen using .show() or .exec(), but then no buttons on the Dialog can be touched. The buttons can be clicked with a mouse and works perfectly. This issue is intermittent and seemingly random.
Here is my QDialog class header:
#include <QDialog> #include <QLabel> #include <QPushButton> class MyMessageBox : public QDialog { public: MyMessageBox(QString messagePrompt, QWidget *parent = MyMessageBox::parent); MyMessageBox(QString messagePrompt, QString buttonTxt, QWidget *parent = MyMessageBox::parent); static QWidget *parent; private: };
And here is my class body:
#include "mymessagebox.h" #include <QVBoxLayout> #include "uiutils.h" QWidget *MyMessageBox::parent; MyMessageBox::MyMessageBox(QString messagePrompt, QWidget *parent) : MyMessageBox(messagePrompt, tr("OK"), parent) { } MyMessageBox::MyMessageBox(QString messagePrompt, QString buttonTxt, QWidget *parent) : QDialog(parent) { this->setStyleSheet( "MyMessageBox {border: 5px solid rgb(1, 80, 197); min-height: 300px;}" "QLabel {font: 60px 'Verdana'; color: black;}" "QPushButton {font: 32px 'Verdana'; color: white; background-color: rgb(7, 106, 254);}" ); QPushButton *okBtn = new QPushButton(buttonTxt); connect(okBtn, &QPushButton::clicked, this, &QDialog::close); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(new QLabel(UIUtils::wrapText(messagePrompt))); layout->addWidget(okBtn, Qt::AlignHCenter); layout->setAlignment(this, Qt::AlignHCenter); this->setLayout(layout); setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint); }
My parent class is a simple Widget that fills the screen, and calls these Dialogs boxes periodically,setting itself, or perhaps another child dialog, as the parent.
Things I have tried:
Using different window flags (Qt::Window, Qt::Popup, etc).
Explicitly call setParent(parent) in the constructorAnyone know why my dialog is not receiving touch input?