Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/package/contents/ui/SvgGrid.qml
| Show All 14 Lines | |||||
| 15 | * You should have received a copy of the GNU General Public License * | 15 | * You should have received a copy of the GNU General Public License * | ||
| 16 | * along with this program; if not, write to the * | 16 | * along with this program; if not, write to the * | ||
| 17 | * Free Software Foundation, Inc., * | 17 | * Free Software Foundation, Inc., * | ||
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||
| 19 | * * | 19 | * * | ||
| 20 | ***************************************************************************/ | 20 | ***************************************************************************/ | ||
| 21 | 21 | | |||
| 22 | import QtQuick 2.2 | 22 | import QtQuick 2.2 | ||
| 23 | // import QtQuick.Controls 1.0 | 23 | import QtQuick.Controls 2.0 | ||
ngraham: same: `import QtQuick.Controls 2.5 as QQC2` | |||||
| 24 | import QtQuick.Layouts 1.0 | 24 | import QtQuick.Layouts 1.0 | ||
| 25 | 25 | | |||
| 26 | import org.kde.plasma.core 2.0 as PlasmaCore | 26 | import org.kde.kirigami 2.8 as Kirigami | ||
| 27 | import org.kde.plasma.components 2.0 as PlasmaComponents | | |||
| 28 | import org.kde.plasma.extras 2.0 as PlasmaExtras | | |||
| 29 | | ||||
| 30 | 27 | | |||
| 31 | GridView { | 28 | GridView { | ||
| 32 | id: iconGrid | 29 | id: iconGrid | ||
| 33 | 30 | | |||
| 34 | focus: true | 31 | focus: true | ||
| 35 | 32 | | |||
| 36 | cellWidth: iconSize + units.gridUnit | 33 | cellWidth: iconSize + units.gridUnit | ||
| 37 | cellHeight: cellWidth + units.gridUnit | 34 | cellHeight: cellWidth + units.gridUnit | ||
| Show All 30 Lines | 60 | Rectangle { | |||
| 68 | anchors { | 65 | anchors { | ||
| 69 | bottomMargin: -units.gridUnit | 66 | bottomMargin: -units.gridUnit | ||
| 70 | leftMargin: -units.gridUnit / 2 | 67 | leftMargin: -units.gridUnit / 2 | ||
| 71 | rightMargin: -units.gridUnit / 2 | 68 | rightMargin: -units.gridUnit / 2 | ||
| 72 | fill: parent | 69 | fill: parent | ||
| 73 | } | 70 | } | ||
| 74 | } | 71 | } | ||
| 75 | 72 | | |||
| 76 | PlasmaCore.IconItem { | 73 | Kirigami.Icon { | ||
| 77 | id: delegateIcon | 74 | id: delegateIcon | ||
| 78 | width: iconSize | 75 | width: iconSize | ||
| 79 | height: width | 76 | height: width | ||
| 80 | source: modelData.iconName | 77 | source: modelData.iconName | ||
| 81 | anchors { | 78 | anchors { | ||
| 82 | top: parent.top | 79 | top: parent.top | ||
| 83 | horizontalCenter: parent.horizontalCenter | 80 | horizontalCenter: parent.horizontalCenter | ||
| 84 | } | 81 | } | ||
| 85 | } | 82 | } | ||
| 86 | 83 | | |||
| 87 | PlasmaComponents.Label { | 84 | Label { | ||
| 88 | font.pointSize: iconSize > 96 ? theme.defaultFont.pointSize : theme.smallestFont.pointSize | 85 | font.pointSize: iconSize > 96 ? theme.defaultFont.pointSize : theme.smallestFont.pointSize | ||
| 89 | text: modelData.fileName + " " + modelData.iconName | 86 | text: modelData.fileName + " " + modelData.iconName | ||
| 90 | wrapMode: Text.Wrap | 87 | wrapMode: Text.Wrap | ||
| 91 | // elide: Text.ElideRight | 88 | // elide: Text.ElideRight | ||
| 92 | maximumLineCount: 3 | 89 | maximumLineCount: 3 | ||
| 93 | horizontalAlignment: Text.AlignHCenter | 90 | horizontalAlignment: Text.AlignHCenter | ||
| 94 | opacity: iconGrid.currentIndex == index ? 1.0 : 0.7 | 91 | opacity: iconGrid.currentIndex == index ? 1.0 : 0.7 | ||
| 95 | anchors { | 92 | anchors { | ||
ngraham: Could also get rid of the commented code in here | |||||
| 96 | left: parent.left | 93 | left: parent.left | ||
| 97 | right: parent.right | 94 | right: parent.right | ||
| 98 | top: delegateIcon.bottom | 95 | top: delegateIcon.bottom | ||
| 99 | //topMargin: Math.round(-units.gridUnit / 4) | 96 | //topMargin: Math.round(-units.gridUnit / 4) | ||
| 100 | margins: Math.round(-units.gridUnit / 4) | 97 | margins: Math.round(-units.gridUnit / 4) | ||
| 101 | //horizontalCenter: parent.horizontalCenter | 98 | //horizontalCenter: parent.horizontalCenter | ||
| 102 | //bottom: parent.bottom | 99 | //bottom: parent.bottom | ||
| 103 | } | 100 | } | ||
| Show All 25 Lines | |||||
same: import QtQuick.Controls 2.5 as QQC2