Skip to content

Commit

Permalink
Some changes of widgets after review:
Browse files Browse the repository at this point in the history
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 88afe75
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/quickgui/plugin/editor/qgsquickdatetime.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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;_" }
Expand Down
49 changes: 23 additions & 26 deletions src/quickgui/plugin/editor/qgsquickexternalresource.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
10 changes: 2 additions & 8 deletions src/quickgui/plugin/editor/qgsquicktextedit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 || ''
Expand All @@ -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
}
Expand All @@ -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

Expand Down
5 changes: 2 additions & 3 deletions src/quickgui/plugin/qgsquickphotopanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 88afe75

Please sign in to comment.