标签: plasmoid

如何以编程方式显示/隐藏 KDE plasmoid 的工具提示?

有没有办法使等离子工具提示以编程方式显示/隐藏?

我尝试在ToolTipArea紧凑表示上设置 a ,并尝试用 a 触发它Timer- 它不起作用(常规工具提示不断显示,但仅在悬停于等离子图标(又名compactRepresentation)时:

import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras

Item {
    Layout.preferredWidth: 200
    Layout.preferredHeight: 300

    Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation

    Plasmoid.compactRepresentation: Item
    {
        anchors.fill: parent

        MouseArea
        {
            onClicked:
            {
                 plasmoid.expanded = !plasmoid.expanded
            }
        }

        PlasmaCore.ToolTipArea
        {
            id: toolTip
            width: parent.width
            height: parent.height
            anchors.fill: parent
            mainItem: tooltipContentItem
            active: false
            interactive: true
        }

        Timer
        {
            interval: 3000 …
Run Code Online (Sandbox Code Playgroud)

tooltip plasmoid qml kde-plasma

5
推荐指数
0
解决办法
236
查看次数

我可以获取Text元素的实际宽度和高度吗?

我想获取Text元素的实际宽度和高度。如果我使用paintedWidthpaintedHeight属性,则无法理解。例如:

Rectangle {
    color:  "green"
    width:  a_text.paintedWidth
    height: a_text.paintedHeight

    Text {
        id:     a_text
        text:   "r"
        color:  "white"
        anchors.centerIn: parent
    }
}
Run Code Online (Sandbox Code Playgroud)

如果运行该代码,则"r"在的顶部"r"和下方的左侧会看到一些绿色空间"r"。所以我没有得到真正的宽度和高度Text。我的意思是,白色像素的宽度和高度。

有办法吗?

PS另外,我还需要文本的实际左上角的相对位置,我的意思是,左上白像素相对于的“官方”左上像素的x和y Text

qt plasmoid qml qtquick2

4
推荐指数
1
解决办法
3575
查看次数

刷新我的新等离子团 - 重新解析源

我正在学习如何开发 Kde Plasma 5 plasmoids,并使用一个小部件对其进行测试,只有两个 qmls 一致。我阅读了一些信息源,例如https://techbase.kde.orghttps://api.kde.org/frameworks/并为我的测试 plasmoid 创建了一个包结构和源,如下所示:

$ ls -lR test
test:
total 8
drwxr-xr-x 3 alberto alberto 4096 nov 26 14:28 contents
-rw-r--r-- 1 alberto alberto  459 nov 26 14:28 metadata.desktop

test/contents:
total 4
drwxr-xr-x 2 alberto alberto 4096 nov 26 14:33 ui

test/contents/ui:
total 8
-rw-r--r-- 1 alberto alberto 275 nov 26 14:28 main.qml
-rw-r--r-- 1 alberto alberto 465 nov 26 14:33 RootContainer.qml
Run Code Online (Sandbox Code Playgroud)

RootContainer 只是小部件的 fullRepresentation,仅包含一个带有文本“prueba1”的标签。因此,正如我在文档中所读到的,我使用命令Plasapkg2来安装小部件,如下所示:

$ plasmapkg2 --install test …
Run Code Online (Sandbox Code Playgroud)

kde plasmoid

4
推荐指数
1
解决办法
1822
查看次数

如何设置Qml Text Item的行距?

我无法弄清楚这一点。我的意思是 Qml 文本项中文本行之间的垂直间距。我不能使用富文本,而且 GridLayout 似乎破坏了我的环绕、水平对齐和检查截断的能力。这是在一个矩形内。

Text{   
        width:10
        wrapMode: Text.Text.Wrap
        text:"This will be broken into multiple lines. How could I set the vertical spacing between them?"
     }
Run Code Online (Sandbox Code Playgroud)

我的意思是:

在此处输入图片说明

对比

在此处输入图片说明

qt kde widget plasmoid qml

1
推荐指数
1
解决办法
4313
查看次数

标签 统计

plasmoid ×4

qml ×3

kde ×2

qt ×2

kde-plasma ×1

qtquick2 ×1

tooltip ×1

widget ×1