X11, Frameless dialog not visible after hiding/showing it quickly

  • Hi,

    I am working in a project where I have two windows A and B.

    • I show window A when the "customContextMenuRequested" is emmited in B (this signal is emmited when right clicking on B)--.
    • Then in the "showEvent" of A, I install an event filter on B to catch the left clicks on B.
    • When left clicking on B, the "eventFiler" method of A is called and hides A.
    • In the "hideEvent" of A, I remove the event filter set on B.

    When I left-click/right-click rapidly on window B with window A is created with "Qt::FramelessWindowHint", at a certain point, window A does not show anymore.
    I can still right-click and left-click on B and the "showEvent" and "hideEvent" of A are still called but the window is not visible on the desktop.
    The problem does not occur when A has a frame, or when I run the program without a window manager.
    It does not occur either on Windows.

    I extracted the issue from the actual program and try managed to reproduce it with the following code:

    "MyWidget" is the class of object A, with overloaded events:

    @#include <QDialog>
    #include <QWidget>
    #include <QMouseEvent>

    class MyWidget : public QDialog

    QWidget* m_pwWidget;

    MyWidget(QWidget* pwWidget) : QDialog(NULL,Qt::FramelessWindowHint), m_pwWidget(pwWidget) {}
    virtual bool eventFilter(QObject , QEvent p_peEvent)
    case QEvent::MouseButtonPress:
    >(p_peEvent)->button() == Qt::LeftButton)
    return false;
    virtual void showEvent(QShowEvent
    virtual void hideEvent(QHideEvent *)
    public slots:
    void customContextMenuSlot(QPoint)

    The main function follows:

    @int main(int argc, char** argv)
    QApplication app(argc,argv);

    QWidget* B = new QWidget;
    MyWidget* A = new MyWidget(B);


    It is a little bit harder to reproduce the issue in release than in debug.

    Does anyone knows if something is wrong in the previous code, or if it might be a window manager compatibility issue, or a bug in qt.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    It doesn't look wrong, so you may have found something. You should have a look at the "bug report system":http://bureports.qt-project.org to see if it's something known. If not please consider opening a new report providing a minimal compilable example (with the code you are showing here)

  • Hi thibault,

    Found your post when searching for the QDialog not showing issue. I also encounter similar problem on X11. After hiding/showing a frameless QDialog rapidly, it is not visible on screen anymore. I have dumped the properties of the widget tree, all the widgets are visible. So I suspect it could be related to X11.

    If I removed the Qt::FramelessWindowHint, the QDialog will be shown correctly all the time.

    Have you found any solution/workaround for the problem you reported?


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.