Skip to content
Permalink
Browse files

[QgsQuick] 'Today' icon button moved straight to date field.

Visible only in !readOnly mode.
  • Loading branch information
vsklencar authored and wonder-sk committed Mar 20, 2019
1 parent 24bd866 commit 48e28354a0ad1516724998afd013110b77449212
Showing with 28 additions and 7 deletions.
  1. +1 −0 src/quickgui/images/images.qrc
  2. +27 −7 src/quickgui/plugin/editor/qgsquickdatetime.qml
@@ -11,5 +11,6 @@
<file>ic_save_white.svg</file>
<file>ic_camera.svg</file>
<file>ic_gallery.svg</file>
<file>ic_today.svg</file>
</qresource>
</RCC>
@@ -17,6 +17,7 @@ import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4 as Controls1
import QtGraphicalEffects 1.0
import QgsQuick 0.1 as QgsQuick

/**
@@ -26,6 +27,7 @@ import QgsQuick 0.1 as QgsQuick
*/
Item {
signal valueChanged(var value, bool isNull)
property real iconSize: fieldItem.height * 0.75

id: fieldItem
enabled: !readOnly
@@ -137,6 +139,31 @@ Item {
}
}
}

Image {
id: todayBtn
height: fieldItem.iconSize
sourceSize.height: fieldItem.iconSize
autoTransform: true
fillMode: Image.PreserveAspectFit
source: QgsQuick.Utils.getThemeIcon("ic_today")
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
visible: fieldItem.enabled
anchors.rightMargin: fieldItem.anchors.rightMargin

MouseArea {
anchors.fill: parent
onClicked: main.currentValue = new Date()
}
}

ColorOverlay {
anchors.fill: todayBtn
source: todayBtn
color: customStyle.fontColor
visible: todayBtn.visible
}
}

Popup {
@@ -170,13 +197,6 @@ Item {

RowLayout {

Button {
text: qsTr( "Today" )
Layout.fillWidth: true

onClicked: main.currentValue = new Date()
}

Button {
text: qsTr( "Ok" )
Layout.fillWidth: true

0 comments on commit 48e2835

Please sign in to comment.
You can’t perform that action at this time.