Qt World Summit: Submit your Presentation

No cursor or text visible in QLineEdit, on top QGraphicsView

  • Hi

    I have a QMainWindow which contains a graphicsview and scene. Where images, text, videos and similar are rendered. I have added a QLineEdit as a child to the MainWindows (i.e. a sibling to the scene etc.). I can see the LineEdit and the placeholder-text I have set and I can make it focused, but no cursor or input text is visible. I can get the text that I have input via keyboard (even touch keyboard) so I know that it works, I just can't see it. I'm running Windows 8.1 and Qt 5.4.1.

  • I have now explored the issue a bit further, as long as the GraphicsView is the same size as the screen (1920x1080) or larger the QMainWindow (which is set to be fullscreen) doesn't receive any paintevents, which is probably why the LineEdit isn't repainted after it is first shown. Why is that? Is there any solution for my problem?

  • For the moment I have made the GraphicsView 1 pixel shorter than the screen layout (i.e. 1920x1079) which makes everything work perfectly. I'm using an QGLWidget as the viewport for the GraphicsView. When I try to use the new QOpenGLWidget instead the (normal) widgets that are added on top of the graphics view are rendered correctly, however anything drawn using OpenGL flickers as soon as any part of the widget normal needs to be redrawn. E.g. when adding a QLineEdit and the cursor blinks or when text is inputted into the widget the parts drawn with OpenGL (in the graphicsview) flickers. Which makes it (QOpenGLWidget as a viewport) impossible to use in our case.