Skip to content

Commit 0ba8f97

Browse files
committedNov 8, 2017
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
1 parent de33017 commit 0ba8f97

File tree

5 files changed

+97
-102
lines changed

5 files changed

+97
-102
lines changed
 

‎src/app/qgsattributesformproperties.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,25 +102,17 @@ void QgsAttributesFormProperties::initAvailableWidgetsTree()
102102
{
103103
const QgsField field = fields.at( i );
104104
DnDTreeItemData itemData = DnDTreeItemData( DnDTreeItemData::Field, field.name() );
105-
//should we load here stuff like in im loadAttributeEditorTreeItem other stuff like itemData.setShowLabel( true );?
106105
itemData.setShowLabel( true );
107106

108107
FieldConfig cfg( mLayer, i );
109108

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

113111
item->setData( 0, FieldConfigRole, cfg );
114112
item->setData( 0, FieldNameRole, field.name() );
115113
}
116114
catitem->setExpanded( true );
117115

118-
/* stuff
119-
itemData.setIcon(i, mLayer->fields().iconForField( i ));
120-
itemData.setText(i, QString::number( i+1 ) );
121-
itemData.setText(i, fields.at( i ).name() );
122-
*/
123-
124116
//load Relations
125117
catItemData = DnDTreeItemData( DnDTreeItemData::Container, "Relations" );
126118
catitem = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), catItemData );
@@ -455,6 +447,9 @@ QTreeWidgetItem *QgsAttributesFormProperties::loadAttributeEditorTreeItem( QgsAt
455447
}
456448
}
457449
break;
450+
default:
451+
//should not happen
452+
break;
458453
}
459454
return newWidget;
460455
}
@@ -484,6 +479,13 @@ void QgsAttributesFormProperties::onAttributeSelectionChanged()
484479
loadAttributeTypeDialog();
485480
break;
486481
}
482+
case DnDTreeItemData::Container:
483+
{
484+
mAttributeRelationEdit->setVisible( false );
485+
mAttributeTypeDialog->setVisible( false );
486+
break;
487+
}
488+
487489
}
488490
}
489491

@@ -578,16 +580,22 @@ void QgsAttributesFormProperties::mEditorLayoutComboBox_currentIndexChanged( int
578580
case 0:
579581
mFormLayoutWidget->setVisible( false );
580582
mUiFileFrame->setVisible( false );
583+
mAddTabOrGroupButton->setVisible( false );
584+
mRemoveTabOrGroupButton->setVisible( false );
581585
break;
582586

583587
case 1:
584588
mFormLayoutWidget->setVisible( true );
585589
mUiFileFrame->setVisible( false );
590+
mAddTabOrGroupButton->setVisible( true );
591+
mRemoveTabOrGroupButton->setVisible( true );
586592
break;
587593

588594
case 2:
589595
mFormLayoutWidget->setVisible( false );
590596
mUiFileFrame->setVisible( true );
597+
mAddTabOrGroupButton->setVisible( false );
598+
mRemoveTabOrGroupButton->setVisible( false );
591599
break;
592600
}
593601
}

‎src/app/qgssourcefieldsproperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ void QgsSourceFieldsProperties::attributesListCellChanged( int row, int column )
374374
//avoiding that something will be changed, just because this is triggered by simple re-sorting
375375
if ( !nameItem ||
376376
nameItem->text().isEmpty() ||
377-
!mLayer->fields().exists( row ) ||
377+
!mLayer->fields().exists( idx ) ||
378378
mLayer->fields().at( idx ).name() == nameItem->text()
379379
)
380380
return;

‎src/ui/qgsattributesformproperties.ui

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,35 @@ Use this function to add extra logic to your forms.</string>
7070
</layout>
7171
</widget>
7272
</item>
73+
<item row="1" column="0">
74+
<widget class="QWidget" name="mUiFileFrame" native="true">
75+
<property name="maximumSize">
76+
<size>
77+
<width>16777215</width>
78+
<height>50</height>
79+
</size>
80+
</property>
81+
<layout class="QHBoxLayout" name="horizontalLayout_2">
82+
<item>
83+
<widget class="QLabel" name="label_2">
84+
<property name="text">
85+
<string>Edit UI</string>
86+
</property>
87+
</widget>
88+
</item>
89+
<item>
90+
<widget class="QLineEdit" name="mEditFormLineEdit"/>
91+
</item>
92+
<item>
93+
<widget class="QToolButton" name="pbnSelectEditForm">
94+
<property name="text">
95+
<string>...</string>
96+
</property>
97+
</widget>
98+
</item>
99+
</layout>
100+
</widget>
101+
</item>
73102
<item row="2" column="0">
74103
<widget class="QSplitter" name="splitter">
75104
<property name="orientation">
@@ -134,40 +163,36 @@ Use this function to add extra logic to your forms.</string>
134163
</item>
135164
</layout>
136165
</widget>
137-
<widget class="QWidget" name="mAttributeTypeFrame" native="true">
138-
<layout class="QGridLayout" name="gridLayout_2"/>
166+
<widget class="QScrollArea" name="scrollArea_2">
167+
<property name="minimumSize">
168+
<size>
169+
<width>600</width>
170+
<height>0</height>
171+
</size>
172+
</property>
173+
<property name="widgetResizable">
174+
<bool>true</bool>
175+
</property>
176+
<widget class="QWidget" name="scrollAreaWidgetContents_5">
177+
<property name="geometry">
178+
<rect>
179+
<x>0</x>
180+
<y>0</y>
181+
<width>596</width>
182+
<height>428</height>
183+
</rect>
184+
</property>
185+
<layout class="QGridLayout" name="gridLayout_4">
186+
<item row="0" column="0">
187+
<widget class="QWidget" name="mAttributeTypeFrame" native="true">
188+
<layout class="QGridLayout" name="gridLayout_2"/>
189+
</widget>
190+
</item>
191+
</layout>
192+
</widget>
139193
</widget>
140194
</widget>
141195
</item>
142-
<item row="1" column="0">
143-
<widget class="QWidget" name="mUiFileFrame" native="true">
144-
<property name="maximumSize">
145-
<size>
146-
<width>16777215</width>
147-
<height>50</height>
148-
</size>
149-
</property>
150-
<layout class="QHBoxLayout" name="horizontalLayout_2">
151-
<item>
152-
<widget class="QLabel" name="label_2">
153-
<property name="text">
154-
<string>Edit UI</string>
155-
</property>
156-
</widget>
157-
</item>
158-
<item>
159-
<widget class="QLineEdit" name="mEditFormLineEdit"/>
160-
</item>
161-
<item>
162-
<widget class="QToolButton" name="pbnSelectEditForm">
163-
<property name="text">
164-
<string>...</string>
165-
</property>
166-
</widget>
167-
</item>
168-
</layout>
169-
</widget>
170-
</item>
171196
</layout>
172197
</widget>
173198
<resources>

‎src/ui/qgsrelationmanagerdialogbase.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545
</column>
4646
<column>
4747
<property name="text">
48-
<string>Referenced Field</string>
48+
<string>Referenced Layer</string>
4949
</property>
5050
</column>
5151
<column>
5252
<property name="text">
53-
<string>Referenced Layer</string>
53+
<string>Referenced Field</string>
5454
</property>
5555
</column>
5656
<column>

‎src/ui/qgsvectorlayerpropertiesbase.ui

Lines changed: 22 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@
333333
</sizepolicy>
334334
</property>
335335
<property name="currentIndex">
336-
<number>8</number>
336+
<number>5</number>
337337
</property>
338338
<widget class="QWidget" name="mOptsPage_Information">
339339
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -409,8 +409,8 @@
409409
<rect>
410410
<x>0</x>
411411
<y>0</y>
412-
<width>302</width>
413-
<height>416</height>
412+
<width>662</width>
413+
<height>534</height>
414414
</rect>
415415
</property>
416416
<layout class="QVBoxLayout" name="verticalLayout_9">
@@ -698,8 +698,8 @@ border-radius: 2px;</string>
698698
<rect>
699699
<x>0</x>
700700
<y>0</y>
701-
<width>100</width>
702-
<height>30</height>
701+
<width>662</width>
702+
<height>534</height>
703703
</rect>
704704
</property>
705705
<layout class="QVBoxLayout" name="verticalLayout_18">
@@ -775,65 +775,27 @@ border-radius: 2px;</string>
775775
<widget class="QWidget" name="mOptsPage_SourceFields">
776776
<layout class="QVBoxLayout" name="verticalLayout_29">
777777
<item>
778-
<widget class="QScrollArea" name="scrollArea_2">
779-
<property name="widgetResizable">
780-
<bool>true</bool>
778+
<widget class="QFrame" name="mSourceFieldsFrame">
779+
<property name="frameShape">
780+
<enum>QFrame::StyledPanel</enum>
781+
</property>
782+
<property name="frameShadow">
783+
<enum>QFrame::Raised</enum>
781784
</property>
782-
<widget class="QWidget" name="scrollAreaWidgetContents_2">
783-
<property name="geometry">
784-
<rect>
785-
<x>0</x>
786-
<y>0</y>
787-
<width>70</width>
788-
<height>22</height>
789-
</rect>
790-
</property>
791-
<layout class="QGridLayout" name="gridLayout_3">
792-
<item row="0" column="0">
793-
<widget class="QFrame" name="mSourceFieldsFrame">
794-
<property name="frameShape">
795-
<enum>QFrame::StyledPanel</enum>
796-
</property>
797-
<property name="frameShadow">
798-
<enum>QFrame::Raised</enum>
799-
</property>
800-
</widget>
801-
</item>
802-
</layout>
803-
</widget>
804785
</widget>
805786
</item>
806787
</layout>
807788
</widget>
808789
<widget class="QWidget" name="mOptsPage_AttributesForm">
809790
<layout class="QVBoxLayout" name="verticalLayout">
810791
<item>
811-
<widget class="QScrollArea" name="scrollArea_8">
812-
<property name="widgetResizable">
813-
<bool>true</bool>
792+
<widget class="QFrame" name="mAttributesFormFrame">
793+
<property name="frameShape">
794+
<enum>QFrame::StyledPanel</enum>
795+
</property>
796+
<property name="frameShadow">
797+
<enum>QFrame::Raised</enum>
814798
</property>
815-
<widget class="QWidget" name="scrollAreaWidgetContents_8">
816-
<property name="geometry">
817-
<rect>
818-
<x>0</x>
819-
<y>0</y>
820-
<width>70</width>
821-
<height>22</height>
822-
</rect>
823-
</property>
824-
<layout class="QGridLayout" name="gridLayout_11">
825-
<item row="0" column="0">
826-
<widget class="QFrame" name="mAttributesFormFrame">
827-
<property name="frameShape">
828-
<enum>QFrame::StyledPanel</enum>
829-
</property>
830-
<property name="frameShadow">
831-
<enum>QFrame::Raised</enum>
832-
</property>
833-
</widget>
834-
</item>
835-
</layout>
836-
</widget>
837799
</widget>
838800
</item>
839801
</layout>
@@ -1289,8 +1251,8 @@ border-radius: 2px;</string>
12891251
<rect>
12901252
<x>0</x>
12911253
<y>0</y>
1292-
<width>100</width>
1293-
<height>30</height>
1254+
<width>662</width>
1255+
<height>534</height>
12941256
</rect>
12951257
</property>
12961258
<layout class="QVBoxLayout" name="verticalLayout_21">
@@ -1355,8 +1317,8 @@ border-radius: 2px;</string>
13551317
<rect>
13561318
<x>0</x>
13571319
<y>0</y>
1358-
<width>113</width>
1359-
<height>110</height>
1320+
<width>662</width>
1321+
<height>534</height>
13601322
</rect>
13611323
</property>
13621324
<layout class="QVBoxLayout" name="verticalLayout_23">
@@ -1635,7 +1597,7 @@ border-radius: 2px;</string>
16351597
<rect>
16361598
<x>0</x>
16371599
<y>0</y>
1638-
<width>371</width>
1600+
<width>648</width>
16391601
<height>608</height>
16401602
</rect>
16411603
</property>

0 commit comments

Comments
 (0)
Please sign in to comment.