1

I run Qt Virtual Keyboard example in ubuntu and windows 10 very nice, but on raspbian it runs just on full screen mode and i can not see text edit when typing with virtual keyboard. I want virtual keyboard width fit to window size and show under the text edit. How ?

import sys
import os
from PySide2.QtWidgets import *

os.environ["QT_IM_MODULE"] = "qtvirtualkeyboard"

app = QApplication([])
w = QWidget()
vl = QVBoxLayout(w)
btn = QPushButton()
btn.setText('Start')
vl.addWidget(btn)
tb = QLineEdit()
vl.addWidget(tb)

w.show()
sys.exit(app.exec_())

result on windows 10:

enter image description here

but on raspbian it look like:

enter image description here

how can i solve it? please help

Sajjad Aemmi
  • 2,120
  • 3
  • 13
  • 25

2 Answers2

0

I've the same Problem. (QT 5.11.3) This looks exactly like this Bug:

A suggested Workaround is to set the Color of the QQuickWindow to transparent. e.g.

QQuickWindow *window = qobject_cast<QQuickWindow *>(YourRootQuickObj );

QSurfaceFormat surfaceFormat = window->requestedFormat();
surfaceFormat.setAlphaBufferSize(8);
surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);

window->setFormat(surfaceFormat);
window->setColor(QColor(Qt::transparent)); //Workaround
window->setClearBeforeRendering(true);

window->showFullScreen();

This Issue seems to be fixed in QT 5.15. I'm currently building this version, i will report if this version will fix this Bug.

  • Im having the same problem with v5.15 too, but the following solution using a mask fixed it for me https://stackoverflow.com/a/63963718/594323 – ramiwi Jun 22 '23 at 20:37
0

This question has already been answered in How to find the window that contains the QtVirtualKeyboard .
Using the code given in the mentioned post you just need to adjust "y" in: r.moveTop(keyboard->property("y").toDouble()); you can also work with these attributes:

r.setTop(250) r.setRight(820) r.setLeft(460) Best of luck.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Hamid Rajabi
  • 59
  • 1
  • 8