Skip to content

Commit

Permalink
[QgsQuick] 'Today' icon button moved straight to date field.
Browse files Browse the repository at this point in the history
Visible only in !readOnly mode.
  • Loading branch information
vsklencar authored and wonder-sk committed Mar 21, 2019
1 parent 24bd866 commit 48e2835
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/quickgui/images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
34 changes: 27 additions & 7 deletions src/quickgui/plugin/editor/qgsquickdatetime.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 48e2835

Please sign in to comment.