no +/- buttons when not needed and some graphical finetuning

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
This commit is contained in:
David 2017-11-08 16:53:04 +01:00
parent de33017b17
commit 0ba8f97979
5 changed files with 97 additions and 102 deletions

View File

@ -102,25 +102,17 @@ void QgsAttributesFormProperties::initAvailableWidgetsTree()
{ {
const QgsField field = fields.at( i ); const QgsField field = fields.at( i );
DnDTreeItemData itemData = DnDTreeItemData( DnDTreeItemData::Field, field.name() ); 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 ); itemData.setShowLabel( true );
FieldConfig cfg( mLayer, i ); FieldConfig cfg( mLayer, i );
QTreeWidgetItem *item = mAvailableWidgetsTree->addItem( catitem, itemData ); QTreeWidgetItem *item = mAvailableWidgetsTree->addItem( catitem, itemData );
//QTreeWidgetItem *item = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), itemData );
item->setData( 0, FieldConfigRole, cfg ); item->setData( 0, FieldConfigRole, cfg );
item->setData( 0, FieldNameRole, field.name() ); item->setData( 0, FieldNameRole, field.name() );
} }
catitem->setExpanded( true ); 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 //load Relations
catItemData = DnDTreeItemData( DnDTreeItemData::Container, "Relations" ); catItemData = DnDTreeItemData( DnDTreeItemData::Container, "Relations" );
catitem = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), catItemData ); catitem = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), catItemData );
@ -455,6 +447,9 @@ QTreeWidgetItem *QgsAttributesFormProperties::loadAttributeEditorTreeItem( QgsAt
} }
} }
break; break;
default:
//should not happen
break;
} }
return newWidget; return newWidget;
} }
@ -484,6 +479,13 @@ void QgsAttributesFormProperties::onAttributeSelectionChanged()
loadAttributeTypeDialog(); loadAttributeTypeDialog();
break; break;
} }
case DnDTreeItemData::Container:
{
mAttributeRelationEdit->setVisible( false );
mAttributeTypeDialog->setVisible( false );
break;
}
} }
} }
@ -578,16 +580,22 @@ void QgsAttributesFormProperties::mEditorLayoutComboBox_currentIndexChanged( int
case 0: case 0:
mFormLayoutWidget->setVisible( false ); mFormLayoutWidget->setVisible( false );
mUiFileFrame->setVisible( false ); mUiFileFrame->setVisible( false );
mAddTabOrGroupButton->setVisible( false );
mRemoveTabOrGroupButton->setVisible( false );
break; break;
case 1: case 1:
mFormLayoutWidget->setVisible( true ); mFormLayoutWidget->setVisible( true );
mUiFileFrame->setVisible( false ); mUiFileFrame->setVisible( false );
mAddTabOrGroupButton->setVisible( true );
mRemoveTabOrGroupButton->setVisible( true );
break; break;
case 2: case 2:
mFormLayoutWidget->setVisible( false ); mFormLayoutWidget->setVisible( false );
mUiFileFrame->setVisible( true ); mUiFileFrame->setVisible( true );
mAddTabOrGroupButton->setVisible( false );
mRemoveTabOrGroupButton->setVisible( false );
break; break;
} }
} }

View File

@ -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 //avoiding that something will be changed, just because this is triggered by simple re-sorting
if ( !nameItem || if ( !nameItem ||
nameItem->text().isEmpty() || nameItem->text().isEmpty() ||
!mLayer->fields().exists( row ) || !mLayer->fields().exists( idx ) ||
mLayer->fields().at( idx ).name() == nameItem->text() mLayer->fields().at( idx ).name() == nameItem->text()
) )
return; return;

View File

@ -70,6 +70,35 @@ Use this function to add extra logic to your forms.</string>
</layout> </layout>
</widget> </widget>
</item> </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"> <item row="2" column="0">
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="orientation"> <property name="orientation">
@ -134,40 +163,36 @@ Use this function to add extra logic to your forms.</string>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="mAttributeTypeFrame" native="true"> <widget class="QScrollArea" name="scrollArea_2">
<layout class="QGridLayout" name="gridLayout_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>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<resources> <resources>

View File

@ -45,12 +45,12 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Referenced Field</string> <string>Referenced Layer</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Referenced Layer</string> <string>Referenced Field</string>
</property> </property>
</column> </column>
<column> <column>

View File

@ -333,7 +333,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>8</number> <number>5</number>
</property> </property>
<widget class="QWidget" name="mOptsPage_Information"> <widget class="QWidget" name="mOptsPage_Information">
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
@ -409,8 +409,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>302</width> <width>662</width>
<height>416</height> <height>534</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
@ -698,8 +698,8 @@ border-radius: 2px;</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>100</width> <width>662</width>
<height>30</height> <height>534</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_18"> <layout class="QVBoxLayout" name="verticalLayout_18">
@ -775,32 +775,13 @@ border-radius: 2px;</string>
<widget class="QWidget" name="mOptsPage_SourceFields"> <widget class="QWidget" name="mOptsPage_SourceFields">
<layout class="QVBoxLayout" name="verticalLayout_29"> <layout class="QVBoxLayout" name="verticalLayout_29">
<item> <item>
<widget class="QScrollArea" name="scrollArea_2"> <widget class="QFrame" name="mSourceFieldsFrame">
<property name="widgetResizable"> <property name="frameShape">
<bool>true</bool> <enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property> </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> </widget>
</item> </item>
</layout> </layout>
@ -808,32 +789,13 @@ border-radius: 2px;</string>
<widget class="QWidget" name="mOptsPage_AttributesForm"> <widget class="QWidget" name="mOptsPage_AttributesForm">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QScrollArea" name="scrollArea_8"> <widget class="QFrame" name="mAttributesFormFrame">
<property name="widgetResizable"> <property name="frameShape">
<bool>true</bool> <enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property> </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> </widget>
</item> </item>
</layout> </layout>
@ -1289,8 +1251,8 @@ border-radius: 2px;</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>100</width> <width>662</width>
<height>30</height> <height>534</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_21"> <layout class="QVBoxLayout" name="verticalLayout_21">
@ -1355,8 +1317,8 @@ border-radius: 2px;</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>113</width> <width>662</width>
<height>110</height> <height>534</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_23"> <layout class="QVBoxLayout" name="verticalLayout_23">
@ -1635,7 +1597,7 @@ border-radius: 2px;</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>371</width> <width>648</width>
<height>608</height> <height>608</height>
</rect> </rect>
</property> </property>