From a38c0e31ca773062a55ac5f6a049b7f7069f021f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 30 Oct 2011 19:19:13 +0100 Subject: [PATCH] Adding new properties for optimalWidth/Height --- tabbox/qml/big_icons.qml | 6 ++++-- tabbox/qml/compact.qml | 6 ++++-- tabbox/qml/informative.qml | 6 ++++-- tabbox/qml/small_icons.qml | 6 ++++-- tabbox/qml/text.qml | 6 ++++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/tabbox/qml/big_icons.qml b/tabbox/qml/big_icons.qml index 4d8162d5d1..fa39827be2 100644 --- a/tabbox/qml/big_icons.qml +++ b/tabbox/qml/big_icons.qml @@ -26,8 +26,10 @@ Item { property int screenWidth : 0 property int screenHeight : 0 property int imagePathPrefix: (new Date()).getTime() - width: Math.min(Math.max(screenWidth * 0.3, (icons.iconSize + icons.margins.left + icons.margins.right) * icons.count + background.margins.left + background.margins.bottom), screenWidth * 0.9) - height: Math.min(Math.max(screenHeight * 0.05, icons.iconSize + icons.margins.top + icons.margins.bottom + background.margins.top + background.margins.bottom), screenHeight * 0.5) + property int optimalWidth: (icons.iconSize + icons.margins.left + icons.margins.right) * icons.count + background.margins.left + background.margins.bottom + property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + background.margins.top + background.margins.bottom + width: Math.min(Math.max(screenWidth * 0.3, optimalWidth), screenWidth * 0.9) + height: Math.min(Math.max(screenHeight * 0.05, optimalHeight), screenHeight * 0.5) function setModel(model) { diff --git a/tabbox/qml/compact.qml b/tabbox/qml/compact.qml index ee2dee67ea..0e9f4dd8c0 100644 --- a/tabbox/qml/compact.qml +++ b/tabbox/qml/compact.qml @@ -27,8 +27,10 @@ Item { property int screenHeight : 0 property string longestCaption: "" property int imagePathPrefix: (new Date()).getTime() - width: Math.min(Math.max(screenWidth * 0.2, compactListView.maxRowWidth), screenWidth * 0.8) - height: Math.min(Math.max(screenHeight * 0.2, compactListView.rowHeight * compactListView.count + background.margins.top + background.margins.bottom), screenHeight * 0.8) + property int optimalWidth: compactListView.maxRowWidth + property int optimalHeight: compactListView.rowHeight * compactListView.count + background.margins.top + background.margins.bottom + width: Math.min(Math.max(screenWidth * 0.2, optimalWidth), screenWidth * 0.8) + height: Math.min(Math.max(screenHeight * 0.2, optimalHeight), screenHeight * 0.8) property int textMargin: 2 diff --git a/tabbox/qml/informative.qml b/tabbox/qml/informative.qml index 1078cca2b0..5b165af3fc 100644 --- a/tabbox/qml/informative.qml +++ b/tabbox/qml/informative.qml @@ -28,8 +28,10 @@ Item { property bool allDesktops: true property string longestCaption: "" property int imagePathPrefix: (new Date()).getTime() - width: Math.min(Math.max(screenWidth * 0.2, listView.maxRowWidth), screenWidth * 0.8) - height: Math.min(Math.max(screenHeight * 0.2, listView.rowHeight * listView.count + background.margins.top + background.margins.bottom), screenHeight * 0.8) + property int optimalWidth: listView.maxRowWidth + property int optimalHeight: listView.rowHeight * listView.count + background.margins.top + background.margins.bottom + width: Math.min(Math.max(screenWidth * 0.2, optimalWidth), screenWidth * 0.8) + height: Math.min(Math.max(screenHeight * 0.2, optimalHeight), screenHeight * 0.8) property int textMargin: 2 diff --git a/tabbox/qml/small_icons.qml b/tabbox/qml/small_icons.qml index 8d8c6c40cf..8bab5ba0af 100644 --- a/tabbox/qml/small_icons.qml +++ b/tabbox/qml/small_icons.qml @@ -26,8 +26,10 @@ Item { property int screenWidth : 0 property int screenHeight : 0 property int imagePathPrefix: (new Date()).getTime() - width: Math.min(Math.max(screenWidth * 0.1, (icons.iconSize + icons.margins.left + icons.margins.right) * icons.count + background.margins.left + background.margins.bottom), screenWidth * 0.9) - height: Math.min(Math.max(screenHeight * 0.05, icons.iconSize + icons.margins.top + icons.margins.bottom + background.margins.top + background.margins.bottom), screenHeight * 0.5) + property int optimalWidth: (icons.iconSize + icons.margins.left + icons.margins.right) * icons.count + background.margins.left + background.margins.bottom + property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + background.margins.top + background.margins.bottom + width: Math.min(Math.max(screenWidth * 0.1, optimalWidth), screenWidth * 0.9) + height: Math.min(Math.max(screenHeight * 0.05, optimalHeight), screenHeight * 0.5) function setModel(model) { diff --git a/tabbox/qml/text.qml b/tabbox/qml/text.qml index 900173c390..9cdc7ef6b9 100644 --- a/tabbox/qml/text.qml +++ b/tabbox/qml/text.qml @@ -26,8 +26,10 @@ Item { property int screenWidth : 0 property int screenHeight : 0 property string longestCaption: "" - width: Math.min(Math.max(screenWidth * 0.2, textListView.maxRowWidth), screenWidth * 0.8) - height: Math.min(Math.max(screenHeight * 0.2, textListView.rowHeight * textListView.count + background.margins.top + background.margins.bottom), screenHeight * 0.8) + property int optimalWidth: textListView.maxRowWidth + property int optimalHeight: textListView.rowHeight * textListView.count + background.margins.top + background.margins.bottom + width: Math.min(Math.max(screenWidth * 0.2, optimalWidth), screenWidth * 0.8) + height: Math.min(Math.max(screenHeight * 0.2, optimalHeight), screenHeight * 0.8) property int textMargin: 2