Skip to content

Commit

Permalink
Merge pull request #3878 from opengisch/backport-3875-to-release-2_6
Browse files Browse the repository at this point in the history
[Backport release-2_6] A few fixes
  • Loading branch information
nirvn committed Feb 4, 2023
2 parents 77e4062 + 214eee7 commit aaa9ed3
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 22 deletions.
6 changes: 1 addition & 5 deletions images/images.qrc
Expand Up @@ -477,11 +477,7 @@
<file>themes/qfield/nodpi/ic_reshape_tool_white_24dp.svg</file>
<file>themes/qfield/nodpi/ic_ring_tool_white_24dp.svg</file>
<file>themes/qfield/nodpi/ic_vertex_tool_white_24dp.svg</file>
<file>themes/qfield/hdpi/ic_view_green_48dp.png</file>
<file>themes/qfield/mdpi/ic_view_green_48dp.png</file>
<file>themes/qfield/xhdpi/ic_view_green_48dp.png</file>
<file>themes/qfield/xxhdpi/ic_view_green_48dp.png</file>
<file>themes/qfield/xxxhdpi/ic_view_green_48dp.png</file>
<file>themes/qfield/nodpi/ic_view_black_24dp.svg</file>
<file>themes/qfield/hdpi/content-cut.png</file>
<file>themes/qfield/mdpi/content-cut.png</file>
<file>themes/qfield/xhdpi/content-cut.png</file>
Expand Down
Binary file removed images/themes/qfield/hdpi/ic_view_green_48dp.png
Binary file not shown.
Binary file removed images/themes/qfield/mdpi/ic_view_green_48dp.png
Binary file not shown.
4 changes: 4 additions & 0 deletions images/themes/qfield/nodpi/ic_view_black_24dp.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions images/themes/qfield/nodpi/ic_view_green_48dp.svg

This file was deleted.

Binary file removed images/themes/qfield/xhdpi/ic_view_green_48dp.png
Binary file not shown.
Binary file removed images/themes/qfield/xxhdpi/ic_view_green_48dp.png
Binary file not shown.
Binary file removed images/themes/qfield/xxxhdpi/ic_view_green_48dp.png
Binary file not shown.
7 changes: 5 additions & 2 deletions src/core/attributeformmodelbase.cpp
Expand Up @@ -262,8 +262,11 @@ void AttributeFormModelBase::updateAttributeValue( QStandardItem *item )
QVariant attributeValue = mFeatureModel->data( mFeatureModel->index( fieldIndex ), FeatureModel::AttributeValue );
item->setData( attributeValue.isNull() ? QVariant() : attributeValue, AttributeFormModel::AttributeValue );
item->setData( mFeatureModel->data( mFeatureModel->index( fieldIndex ), FeatureModel::AttributeAllowEdit ), AttributeFormModel::AttributeAllowEdit );
//set item visibility to false in case it's a linked attribute
item->setData( !mFeatureModel->data( mFeatureModel->index( fieldIndex ), FeatureModel::LinkedAttribute ).toBool(), AttributeFormModel::CurrentlyVisible );
// set item editable state to false in case it's a linked attribute
if ( mFeatureModel->data( mFeatureModel->index( fieldIndex ), FeatureModel::LinkedAttribute ).toBool() )
{
item->setData( false, AttributeFormModel::AttributeEditable );
}
}
else if ( item->data( AttributeFormModel::ElementType ) == QStringLiteral( "qml" ) || item->data( AttributeFormModel::ElementType ) == QStringLiteral( "html" ) )
{
Expand Down
22 changes: 22 additions & 0 deletions src/core/layertreemodel.cpp
Expand Up @@ -1208,6 +1208,28 @@ QgsRectangle FlatLayerTreeModelBase::nodeExtent( const QModelIndex &index, QgsQu
}
}

if ( extent.width() == 0.0 || extent.height() == 0.0 )
{
// If all of the features are at the one point, buffer the
// rectangle a bit. If they are all at zero, do something a bit
// more crude.
if ( extent.xMinimum() == 0.0 && extent.xMaximum() == 0.0 && extent.yMinimum() == 0.0 && extent.yMaximum() == 0.0 )
{
extent.set( -1.0, -1.0, 1.0, 1.0 );
}
else
{
const double padFactor = 1e-8;
const double widthPad = extent.xMinimum() * padFactor;
const double heightPad = extent.yMinimum() * padFactor;
const double xmin = extent.xMinimum() - widthPad;
const double xmax = extent.xMaximum() + widthPad;
const double ymin = extent.yMinimum() - heightPad;
const double ymax = extent.yMaximum() + heightPad;
extent.set( xmin, ymin, xmax, ymax );
}
}

if ( buffer )
{
extent = extent.buffered( extent.width() * buffer );
Expand Down
2 changes: 2 additions & 0 deletions src/qml/FeatureForm.qml
Expand Up @@ -511,6 +511,8 @@ Page {
// - not set to editable in the widget configuration
// - not in edit mode (ReadOnly)
// - a relation in multi edit mode
property bool isAdding: form.state === 'Add'
property bool isEditing: form.state === 'Edit'
property bool isEnabled: !!AttributeEditable
&& form.state !== 'ReadOnly'
&& !( Type === 'relation' && form.model.featureModel.modelMode == FeatureModel.MultiFeatureModel )
Expand Down
2 changes: 1 addition & 1 deletion src/qml/editorwidgets/RelationReference.qml
Expand Up @@ -57,7 +57,7 @@ EditorWidgetBase {
height: 48

bgcolor: "transparent"
iconSource: Theme.getThemeIcon("ic_view_green_48dp")
iconSource: Theme.getThemeVectorIcon("ic_view_black_24dp")

onClicked: {
if ( relationReference.currentKeyValue !== undefined && relationReference.currentKeyValue !== '' ) {
Expand Down
3 changes: 2 additions & 1 deletion src/qml/editorwidgets/UuidGenerator.qml
Expand Up @@ -28,12 +28,13 @@ EditorWidgetBase {
color: 'gray'
text: {
var displayValue = value !== undefined ? value : ''
if (isLoaded && isEnabled && (value === undefined || value == '')) {
if (isLoaded && isAdding && (value == undefined || value === '')) {
displayValue = StringUtils.createUuid();
valueChangeRequested(displayValue ,false);
}
return displayValue;
}
elide: Text.ElideMiddle
}

Rectangle {
Expand Down

1 comment on commit aaa9ed3

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.