Skip to content
Permalink
Browse files

Some changes of widgets after review:

PhotoPanel: added focus
TextEdit: Fixed references for edit widget and removed redundant empty lines and properties, removed textWrap property for single line edit
ExternalRersources: Revert back to use one image for icons and previewPhoto with better handling
DateTime: fixed typos
  • Loading branch information
vsklencar authored and wonder-sk committed Feb 13, 2019
1 parent 78639f0 commit 88afe7515a820ee19e5ecc445756b050d4088dc5
@@ -65,7 +65,7 @@ Item {
inputMethodHints: Qt.ImhDigitsOnly

// this is a bit difficult to auto generate input mask out of date/time format using regex
// mainly because number of caracters is variable (e.g. "d": the day as number without a leading zero)
// mainly because number of characters is a variable (e.g. "d": the day as number without a leading zero)
inputMask: if (config['display_format'] === "yyyy-MM-dd" ) { "9999-99-99;_" }
else if (config['display_format'] === "yyyy.MM.dd" ) { "9999.99.09;_" }
else if (config['display_format'] === "yyyy-MM-dd HH:mm:ss" ) { "9999-99-09 99:99:99;_" }
@@ -27,6 +27,8 @@ Item {
signal valueChanged(var value, bool isNull)

property var image: image
property var brokenImageSource: QgsQuick.Utils.getThemeIcon("ic_broken_image_black")
property var notavailableImageSource: QgsQuick.Utils.getThemeIcon("ic_photo_notavailable_white")

id: fieldItem
anchors {
@@ -36,57 +38,52 @@ Item {
}

height: Math.max(image.height, button.height)

QgsQuick.PhotoCapture {
id: photoCapturePanel
visible: false
height: window.height
width: window.width
edge: Qt.RightEdge
imageButtonSize: button.height
imageButtonSize: customStyle.height
}

Image {
property var currentValue: value
property bool hasValidSource: false

id: image
width: customStyle.height * 3
height: hasValidSource? customStyle.height * 3 : customStyle.height
autoTransform: true
fillMode: Image.PreserveAspectFit
visible: currentValue
visible: hasValidSource

onSourceChanged: {
hasValidSource = (image.source === fieldItem.brokenImageSource ||
image.source === fieldItem.notavailableImageSource) ? false : true
}

Component.onCompleted: image.source = getSource()

function getSource() {
if (image.status === Image.Error)
return ""
else if (image.currentValue && QgsQuick.Utils.fileExists(homePath + "/" + image.currentValue))
return homePath + "/" + image.currentValue
else
return ""
}
}

Image {
id: icon
source: image.status === Image.Error ? QgsQuick.Utils.getThemeIcon("ic_broken_image_black") : QgsQuick.Utils.getThemeIcon("ic_photo_notavailable_white")
width: button.width
height: button.height
sourceSize.width: width
sourceSize.height: height
fillMode: Image.PreserveAspectFit
visible: !image.currentValue
}
if (image.status === Image.Error)
return fieldItem.brokenImageSource
else if (image.currentValue && QgsQuick.Utils.fileExists(homePath + "/" + image.currentValue))
return homePath + "/" + image.currentValue
else
return fieldItem.notavailableImageSource
}
}

ColorOverlay {
anchors.fill: icon
source: icon
anchors.fill: image
source: image
color: customStyle.fontColor
visible: !image.hasValidSource
}

Button {
id: button
visible: enabled
visible: fieldItem.enabled
width: customStyle.height
height: width
padding: 0
@@ -46,7 +46,6 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
font.pixelSize: customStyle.fontPixelSize
wrapMode: Text.Wrap
color: customStyle.fontColor

text: value || ''
@@ -66,8 +65,8 @@ Item {

background: Rectangle {
anchors.fill: parent
border.color: comboBox.pressed ? customStyle.activeColor : customStyle.normalColor
border.width: comboBox.visualFocus ? 2 : 1
border.color: textField.activeFocus ? customStyle.activeColor : customStyle.normalColor
border.width: textField.activeFocus ? 2 : 1
color: customStyle.backgroundColor
radius: customStyle.cornerRadius
}
@@ -80,19 +79,14 @@ Item {
TextArea {
id: textArea
height: config['IsMultiline'] === true ? undefined : 0
Layout.fillWidth: true
Layout.fillHeight: true
topPadding: customStyle.height * 0.25
bottomPadding: customStyle.height * 0.25


visible: height !== 0
anchors.left: parent.left
anchors.right: parent.right
font.pixelSize: customStyle.fontPixelSize
wrapMode: Text.Wrap
color: customStyle.fontColor

text: value || ''
textFormat: config['UseHtml'] ? TextEdit.RichText : TextEdit.PlainText

@@ -90,9 +90,8 @@ Drawer {
}

focus {
focusMode: Camera.FocusMacro
focusPointMode: Camera.FocusPointCustom
customFocusPoint: Qt.point(0.2, 0.2) // Focus relative to top-left corner
focusMode: Camera.FocusContinuous
focusPointMode: Camera.FocusPointAuto
}
}

0 comments on commit 88afe75

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