syncthingtray/plasmoid/package/contents/ui/DetailItem.qml
Martchus 9df2a17e5c Port Plasmoid to QCC2/PlasmaComponents3 where possible
The following uses of QCC1/PlasmaComponents2 remain:

```
…/DetailView.qml:import org.kde.plasma.components 2.0 as PlasmaComponents // for Menu and MenuItem
…/DevicesPage.qml:import org.kde.plasma.components 2.0 as PlasmaComponents  // for Menu and MenuItem
…/DirectoriesPage.qml:import org.kde.plasma.components 2.0 as PlasmaComponents  // for Menu and MenuItem
…/DownloadsPage.qml:import org.kde.plasma.components 2.0 as PlasmaComponents  // for Menu and MenuItem
…/FullRepresentation.qml:import org.kde.plasma.components 2.0 as PlasmaComponents // for vertical TabBar
…/RecentChangesPage.qml:import org.kde.plasma.components 2.0 as PlasmaComponents  // for Menu and MenuItem
…/TopLevelView.qml:import org.kde.plasma.components 2.0 as PlasmaComponents // for Highlight and DialogStatus.Closed (used with Menu and MenuItem)
```
2020-11-27 19:09:47 +01:00

50 lines
1.4 KiB
QML

import QtQuick 2.7
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
Item {
id: detailItem
property string detailName: name ? name : ""
property string detailValue: detail ? detail : ""
width: detailRow.implicitWidth
height: detailRow.implicitHeight
RowLayout {
id: detailRow
width: parent.width
PlasmaCore.IconItem {
source: detailIcon
Layout.leftMargin: units.iconSizes.small * 1.1
Layout.preferredWidth: units.iconSizes.small
Layout.preferredHeight: units.iconSizes.small
opacity: 0.8
}
PlasmaComponents3.Label {
Layout.preferredWidth: 100
text: detailName
font.weight: Font.DemiBold
}
PlasmaComponents3.Label {
Layout.leftMargin: theme.defaultFont.pointSize * 0.9
Layout.fillWidth: true
text: detailValue
elide: Text.ElideRight
horizontalAlignment: Qt.AlignRight
}
}
MouseArea {
acceptedButtons: Qt.RightButton
anchors.fill: parent
onClicked: {
var view = detailItem.ListView.view
var coordinates = mapToItem(view, mouseX, mouseY)
view.showContextMenu(detailItem, coordinates.x, coordinates.y)
}
}
}