Skip to content

Commit

Permalink
no +/- buttons when not needed and some graphical finetuning
Browse files Browse the repository at this point in the history
scroll area for attribute type config, but no scroll area for whole tab
set attribute type config to invisible when a container box is selected
  • Loading branch information
signedav committed Nov 8, 2017
1 parent de33017 commit 0ba8f97
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 102 deletions.
24 changes: 16 additions & 8 deletions src/app/qgsattributesformproperties.cpp
Expand Up @@ -102,25 +102,17 @@ void QgsAttributesFormProperties::initAvailableWidgetsTree()
{
const QgsField field = fields.at( i );
DnDTreeItemData itemData = DnDTreeItemData( DnDTreeItemData::Field, field.name() );
//should we load here stuff like in im loadAttributeEditorTreeItem other stuff like itemData.setShowLabel( true );?
itemData.setShowLabel( true );

FieldConfig cfg( mLayer, i );

QTreeWidgetItem *item = mAvailableWidgetsTree->addItem( catitem, itemData );
//QTreeWidgetItem *item = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), itemData );

item->setData( 0, FieldConfigRole, cfg );
item->setData( 0, FieldNameRole, field.name() );
}
catitem->setExpanded( true );

/* stuff
itemData.setIcon(i, mLayer->fields().iconForField( i ));
itemData.setText(i, QString::number( i+1 ) );
itemData.setText(i, fields.at( i ).name() );
*/

//load Relations
catItemData = DnDTreeItemData( DnDTreeItemData::Container, "Relations" );
catitem = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), catItemData );
Expand Down Expand Up @@ -455,6 +447,9 @@ QTreeWidgetItem *QgsAttributesFormProperties::loadAttributeEditorTreeItem( QgsAt
}
}
break;
default:
//should not happen
break;
}
return newWidget;
}
Expand Down Expand Up @@ -484,6 +479,13 @@ void QgsAttributesFormProperties::onAttributeSelectionChanged()
loadAttributeTypeDialog();
break;
}
case DnDTreeItemData::Container:
{
mAttributeRelationEdit->setVisible( false );
mAttributeTypeDialog->setVisible( false );
break;
}

}
}

Expand Down Expand Up @@ -578,16 +580,22 @@ void QgsAttributesFormProperties::mEditorLayoutComboBox_currentIndexChanged( int
case 0:
mFormLayoutWidget->setVisible( false );
mUiFileFrame->setVisible( false );
mAddTabOrGroupButton->setVisible( false );
mRemoveTabOrGroupButton->setVisible( false );
break;

case 1:
mFormLayoutWidget->setVisible( true );
mUiFileFrame->setVisible( false );
mAddTabOrGroupButton->setVisible( true );
mRemoveTabOrGroupButton->setVisible( true );
break;

case 2:
mFormLayoutWidget->setVisible( false );
mUiFileFrame->setVisible( true );
mAddTabOrGroupButton->setVisible( false );
mRemoveTabOrGroupButton->setVisible( false );
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgssourcefieldsproperties.cpp
Expand Up @@ -374,7 +374,7 @@ void QgsSourceFieldsProperties::attributesListCellChanged( int row, int column )
//avoiding that something will be changed, just because this is triggered by simple re-sorting
if ( !nameItem ||
nameItem->text().isEmpty() ||
!mLayer->fields().exists( row ) ||
!mLayer->fields().exists( idx ) ||
mLayer->fields().at( idx ).name() == nameItem->text()
)
return;
Expand Down
87 changes: 56 additions & 31 deletions src/ui/qgsattributesformproperties.ui
Expand Up @@ -70,6 +70,35 @@ Use this function to add extra logic to your forms.</string>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QWidget" name="mUiFileFrame" native="true">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Edit UI</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mEditFormLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="pbnSelectEditForm">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
Expand Down Expand Up @@ -134,40 +163,36 @@ Use this function to add extra logic to your forms.</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="mAttributeTypeFrame" native="true">
<layout class="QGridLayout" name="gridLayout_2"/>
<widget class="QScrollArea" name="scrollArea_2">
<property name="minimumSize">
<size>
<width>600</width>
<height>0</height>
</size>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_5">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>596</width>
<height>428</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QWidget" name="mAttributeTypeFrame" native="true">
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QWidget" name="mUiFileFrame" native="true">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Edit UI</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mEditFormLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="pbnSelectEditForm">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
Expand Down
4 changes: 2 additions & 2 deletions src/ui/qgsrelationmanagerdialogbase.ui
Expand Up @@ -45,12 +45,12 @@
</column>
<column>
<property name="text">
<string>Referenced Field</string>
<string>Referenced Layer</string>
</property>
</column>
<column>
<property name="text">
<string>Referenced Layer</string>
<string>Referenced Field</string>
</property>
</column>
<column>
Expand Down
82 changes: 22 additions & 60 deletions src/ui/qgsvectorlayerpropertiesbase.ui
Expand Up @@ -333,7 +333,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>8</number>
<number>5</number>
</property>
<widget class="QWidget" name="mOptsPage_Information">
<layout class="QVBoxLayout" name="verticalLayout_5">
Expand Down Expand Up @@ -409,8 +409,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>302</width>
<height>416</height>
<width>662</width>
<height>534</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
Expand Down Expand Up @@ -698,8 +698,8 @@ border-radius: 2px;</string>
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>662</width>
<height>534</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_18">
Expand Down Expand Up @@ -775,65 +775,27 @@ border-radius: 2px;</string>
<widget class="QWidget" name="mOptsPage_SourceFields">
<layout class="QVBoxLayout" name="verticalLayout_29">
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="widgetResizable">
<bool>true</bool>
<widget class="QFrame" name="mSourceFieldsFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>70</width>
<height>22</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QFrame" name="mSourceFieldsFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="mOptsPage_AttributesForm">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea_8">
<property name="widgetResizable">
<bool>true</bool>
<widget class="QFrame" name="mAttributesFormFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_8">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>70</width>
<height>22</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<widget class="QFrame" name="mAttributesFormFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -1289,8 +1251,8 @@ border-radius: 2px;</string>
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>662</width>
<height>534</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_21">
Expand Down Expand Up @@ -1355,8 +1317,8 @@ border-radius: 2px;</string>
<rect>
<x>0</x>
<y>0</y>
<width>113</width>
<height>110</height>
<width>662</width>
<height>534</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
Expand Down Expand Up @@ -1635,7 +1597,7 @@ border-radius: 2px;</string>
<rect>
<x>0</x>
<y>0</y>
<width>371</width>
<width>648</width>
<height>608</height>
</rect>
</property>
Expand Down

0 comments on commit 0ba8f97

Please sign in to comment.