[kwin] Use QIconItem in the desktop tabbox
Unfortunately not tested, I didn't get it activated.
This commit is contained in:
parent
f3dbaaabd7
commit
7e2157bfe4
1 changed files with 2 additions and 15 deletions
|
@ -48,13 +48,11 @@ Item {
|
||||||
function setModel(model) {
|
function setModel(model) {
|
||||||
listView.model = model;
|
listView.model = model;
|
||||||
desktopClientModel.model = model;
|
desktopClientModel.model = model;
|
||||||
desktopClientModel.imageId++;
|
|
||||||
listView.maxRowWidth = listView.calculateMaxRowWidth();
|
listView.maxRowWidth = listView.calculateMaxRowWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
function modelChanged() {
|
function modelChanged() {
|
||||||
listView.currentIndex = -1;
|
listView.currentIndex = -1;
|
||||||
desktopClientModel.imageId++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// just to get the margin sizes
|
// just to get the margin sizes
|
||||||
|
@ -153,8 +151,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 {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
@ -178,29 +174,20 @@ Item {
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: clientIconDelegate
|
id: clientIconDelegate
|
||||||
Image {
|
QIconItem {
|
||||||
sourceSize {
|
icon: model.icon
|
||||||
width: 16
|
width: 16
|
||||||
height: 16
|
height: 16
|
||||||
}
|
}
|
||||||
width: 16
|
|
||||||
height: 16
|
|
||||||
Component.onCompleted: {
|
|
||||||
source = "image://client/" + index + "/" + listView.currentIndex + "/" + desktopClientModel.imagePathPrefix + "-" + desktopClientModel.imageId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
id: clientArea
|
id: clientArea
|
||||||
VisualDataModel {
|
VisualDataModel {
|
||||||
property alias desktopIndex: listView.currentIndex
|
property alias desktopIndex: listView.currentIndex
|
||||||
property int imagePathPrefix: (new Date()).getTime()
|
|
||||||
property int imageId: 0
|
|
||||||
id: desktopClientModel
|
id: desktopClientModel
|
||||||
model: clientModel
|
model: clientModel
|
||||||
delegate: clientIconDelegate
|
delegate: clientIconDelegate
|
||||||
onDesktopIndexChanged: {
|
onDesktopIndexChanged: {
|
||||||
desktopClientModel.imageId++;
|
|
||||||
desktopClientModel.rootIndex = desktopClientModel.parentModelIndex();
|
desktopClientModel.rootIndex = desktopClientModel.parentModelIndex();
|
||||||
desktopClientModel.rootIndex = desktopClientModel.modelIndex(desktopClientModel.desktopIndex);
|
desktopClientModel.rootIndex = desktopClientModel.modelIndex(desktopClientModel.desktopIndex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue