Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Child dialogs do not respond to touch input on Ubuntu
Forum Updated to NodeBB v4.3 + New Features

Child dialogs do not respond to touch input on Ubuntu

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 149 Views
  • 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.
  • S Offline
    S Offline
    Smeeth
    wrote on last edited by
    #1

    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 constructor

    Anyone know why my dialog is not receiving touch input?

    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