【发布时间】:2016-07-06 05:57:19
【问题描述】:
我有一个居中的矩形,后面有一个阴影,里面有一些文字。
import QtQuick 2.5
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0
Window {
visible: true
width: 800; height: 640
Rectangle{
id: centerRect
width: parent.width * 0.7; height: parent.height * 0.7
anchors{
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
radius: 7
border.color: "#C0C0C0"
Text{
text: "Hello World!"
font.pixelSize: 0.07 * parent.height
anchors{
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
}
}
DropShadow
{
anchors.fill: centerRect
horizontalOffset: 1; verticalOffset: 1
radius: 5
samples: 11
color: "#CDCDCD"
source: centerRect
}
}
当我调整窗口大小时,文本变得稍微模糊或失焦。我认为这可能是我如何将字体像素大小缩放到矩形高度的问题,但问题与静态值相同。如果我移除阴影效果,则在调整窗口大小时文本的可见性很好。
如何在使用投影和调整窗口大小时保持良好的文本可见性?我在 OpenSUSE Leap 42.1(Plasma 5.5.5)上使用 Qt 5.5.1。
【问题讨论】:
-
调整窗口大小的窗口管理器可能存在问题。您在 KWin 中设置了哪些效果?改变效果也会影响您的问题吗? (Shift-Alt-F12 启用/禁用合成、KWin 设置等)
-
@BogdanWilli 我做了更改渲染后端和禁用等离子合成器的组合,但结果是一样的。