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 );
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 );
@ -455,6 +447,9 @@ QTreeWidgetItem *QgsAttributesFormProperties::loadAttributeEditorTreeItem( QgsAt
}
}
break;
default:
//should not happen
break;
}
return newWidget;
}
@ -484,6 +479,13 @@ void QgsAttributesFormProperties::onAttributeSelectionChanged()
loadAttributeTypeDialog();
break;
}
case DnDTreeItemData::Container:
{
mAttributeRelationEdit->setVisible( false );
mAttributeTypeDialog->setVisible( false );
break;
}
}
}
@ -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;
}
}

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
if ( !nameItem ||
nameItem->text().isEmpty() ||
!mLayer->fields().exists( row ) ||
!mLayer->fields().exists( idx ) ||
mLayer->fields().at( idx ).name() == nameItem->text()
)
return;

View File

@ -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">
@ -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>

View File

@ -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>

View File

@ -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">
@ -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">
@ -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">
@ -775,32 +775,13 @@ 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>
@ -808,32 +789,13 @@ border-radius: 2px;</string>
<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>
@ -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">
@ -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">
@ -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>