Browse Source

better TintIcon by using ActionButton + Displace

pull/2/head
Skycoder42 7 years ago
parent
commit
e396e69f55
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 5
      src/imports/mvvmquick/MsgBoxBase.qml
  2. 10
      src/imports/mvvmquick/OverviewListView.qml
  3. 37
      src/imports/mvvmquick/TintIcon.qml
  4. 2
      src/imports/mvvmquick/qmldir

5
src/imports/mvvmquick/MsgBoxBase.qml

@ -3,6 +3,7 @@ import QtQuick.Controls 2.3
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Core 1.0
import de.skycoder42.QtMvvm.Quick 1.1
AlertDialog {
id: _msgBoxBase
@ -26,8 +27,8 @@ AlertDialog {
id: _icon
visible: false
Layout.preferredWidth: 24
Layout.preferredHeight: 24
Layout.preferredWidth: implicitWidth
Layout.preferredHeight: implicitHeight
Layout.alignment: Qt.AlignVCenter
}

10
src/imports/mvvmquick/OverviewListView.qml

@ -1,7 +1,7 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Quick 1.0
import de.skycoder42.QtMvvm.Quick 1.1
ListView {
id: _sectionListView
@ -35,8 +35,8 @@ ListView {
Layout.column: 0
Layout.rowSpan: 2
Layout.fillHeight: true
Layout.preferredWidth: iconSize.width
Layout.preferredHeight: iconSize.height
Layout.preferredWidth: implicitWidth
Layout.preferredHeight: implicitHeight
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
}
@ -67,8 +67,8 @@ ListView {
Layout.column: 2
Layout.rowSpan: 2
Layout.fillHeight: true
Layout.preferredWidth: iconSize.width
Layout.preferredHeight: iconSize.height
Layout.preferredWidth: implicitWidth
Layout.preferredHeight: implicitHeight
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
}
}

37
src/imports/mvvmquick/TintIcon.qml

@ -6,30 +6,25 @@ import de.skycoder42.QtMvvm.Quick 1.1
Item {
id: _tintIcon
property size iconSize: Qt.size(24, 24)
property alias tintColor: _overlay.color
property alias source: _image.source
property alias icon: _imgBtn.icon
property alias source: _imgBtn.icon.source
Image {
id: _image
anchors.centerIn: parent
fillMode: Image.PreserveAspectFit
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
width: iconSize.width
height: iconSize.height
sourceSize: iconSize
visible: false
}
implicitWidth: _imgBtn.icon.width
implicitHeight: _imgBtn.icon.height
ColorHelper {
id: helper
Displace {
source: _imgBtn
z: 10
anchors.fill: parent
}
ColorOverlay {
id: _overlay
anchors.fill: _image
source: _image
color: helper.text
ActionButton {
id: _imgBtn
visible: false
z: -10
padding: 0
anchors.fill: parent
background: Item {}
}
}

2
src/imports/mvvmquick/qmldir

@ -7,7 +7,6 @@ depends QtGraphicalEffects 1.0
depends Qt.labs.platform 1.0
depends de.skycoder42.QtMvvm.Core 1.0
internal TintIcon TintIcon.qml
internal MsgBoxBase MsgBoxBase.qml
internal MsgBox MsgBox.qml
internal InputDialog InputDialog.qml
@ -27,6 +26,7 @@ ToolBarLabel 1.0 ToolBarLabel.qml
ActionButton 1.0 ActionButton.qml
RoundActionButton 1.0 RoundActionButton.qml
MenuButton 1.0 MenuButton.qml
TintIcon 1.1 TintIcon.qml
SearchBar 1.1 SearchBar.qml
RoundMenuButton 1.1 RoundMenuButton.qml

Loading…
Cancel
Save