python - raspbian qt 虚拟键盘 黑顶屏
问题描述
我在 ubuntu 和 windows 10 中运行 Qt 虚拟键盘示例非常好,但在 raspbian 上它仅在全屏模式下运行,使用虚拟键盘键入时我看不到文本编辑。我希望虚拟键盘宽度适合窗口大小并显示在文本编辑下。如何 ?
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_())
Windows 10 上的结果:
但在 raspbian 上它看起来像:
我该如何解决?请帮忙
解决方案
我有同样的问题。(QT 5.11.3)这看起来完全像这个错误:
建议的解决方法是将 QQuickWindow 的颜色设置为透明。例如
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();
此问题似乎已在 QT 5.15 中修复。我目前正在构建这个版本,我会报告这个版本是否会修复这个错误。
推荐阅读
- vba - 如何使 Outlook 电子邮件过滤更高效 (VBA)
- server - XAMPP 控制面板:错误
- python - TypeError: __init__() 得到了一个意外的关键字参数“family_or_realsock”
- r - 基于跨多列的匹配行值对数据框进行子集化
- hive - 在 HIVE Metastore 中查询表和列注释
- firebase - Flutter ListView 吸附到顶部
- python - 我的代码失败并显示错误消息 json_line = json.loads(line) 和 cert_check(TOPCERTPATH, TOPCSVPATH)
- finder - afp 看不到 zfs 挂载的文件夹
- google-bigquery - Google Big Query 在表名中间使用通配符
- eclipse - 新计算机,Eclipse IDE 的解决问题