[kwin] Use QIconItem in informative tabbox for the icon

This commit is contained in:
Martin Gräßlin 2013-12-06 15:28:36 +01:00
parent a2c9bdc37d
commit 9864821c38

View file

@ -27,7 +27,6 @@ Item {
property int screenHeight : 0 property int screenHeight : 0
property bool allDesktops: true property bool allDesktops: true
property string longestCaption: "" property string longestCaption: ""
property int imagePathPrefix: (new Date()).getTime()
property int optimalWidth: listView.maxRowWidth property int optimalWidth: listView.maxRowWidth
property int optimalHeight: listView.rowHeight * listView.count + background.topMargin + background.bottomMargin property int optimalHeight: listView.rowHeight * listView.count + background.topMargin + background.bottomMargin
property bool canStretchX: true property bool canStretchX: true
@ -50,11 +49,6 @@ Item {
function setModel(model) { function setModel(model) {
listView.model = model; listView.model = model;
listView.maxRowWidth = listView.calculateMaxRowWidth(); listView.maxRowWidth = listView.calculateMaxRowWidth();
listView.imageId++;
}
function modelChanged() {
listView.imageId++;
} }
/** /**
@ -91,15 +85,12 @@ Item {
id: delegateItem id: delegateItem
width: listView.width width: listView.width
height: listView.rowHeight height: listView.rowHeight
Image { QIconItem {
id: iconItem id: iconItem
source: "image://client/" + index + "/" + informativeTabBox.imagePathPrefix + "-" + listView.imageId + (index == listView.currentIndex ? "/selected" : "/disabled") icon: model.icon
width: 32 width: 32
height: 32 height: 32
sourceSize { state: index == listView.currentIndex ? QIconItem.ActiveState : QIconItem.DisabledState
width: 32
height: 32
}
anchors { anchors {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
@ -189,8 +180,6 @@ Item {
// the maximum text width + icon item width (32 + 4 margin) + margins for hover item + margins for background // the maximum text width + icon item width (32 + 4 margin) + margins for hover item + margins for background
property int maxRowWidth: calculateMaxRowWidth() property int maxRowWidth: calculateMaxRowWidth()
property int rowHeight: calcRowHeight() property int rowHeight: calcRowHeight()
// used for image provider URL to trick Qt into reloading icons when the model changes
property int imageId: 0
anchors { anchors {
fill: parent fill: parent
topMargin: background.topMargin topMargin: background.topMargin