Skip to content

Commit c227a9e

Browse files
committedNov 6, 2017
layout and remove fieldproperties
icons and made naming inputs from the pull request remove old fieldpropertie-stuff
1 parent 7e2ee74 commit c227a9e

File tree

8 files changed

+254
-1995
lines changed

8 files changed

+254
-1995
lines changed
 
Lines changed: 233 additions & 0 deletions
Loading

‎src/app/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ SET(QGIS_APP_SRCS
4343
qgsdiagramproperties.cpp
4444
qgsdisplayangle.cpp
4545
qgsfieldcalculator.cpp
46-
qgsfieldsproperties.cpp
4746
qgssourcefieldsproperties.cpp
4847
qgsattributesformproperties.cpp
4948
qgsidentifyresultsdialog.cpp
@@ -247,7 +246,6 @@ SET (QGIS_APP_MOC_HDRS
247246
qgsdxfexportdialog.h
248247
qgsfeatureaction.h
249248
qgsfieldcalculator.h
250-
qgsfieldsproperties.h
251249
qgssourcefieldsproperties.h
252250
qgsattributesformproperties.h
253251
qgsformannotationdialog.h

‎src/app/qgsfieldsproperties.cpp

Lines changed: 0 additions & 1522 deletions
This file was deleted.

‎src/app/qgsfieldsproperties.h

Lines changed: 0 additions & 307 deletions
This file was deleted.

‎src/app/qgssourcefieldsproperties.cpp

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,12 @@ void QgsSourceFieldsProperties::attributeAdded( int idx )
148148
if ( sorted )
149149
mFieldsList->setSortingEnabled( true );
150150

151-
for ( int i = 0; i < 7; i++ ) // mFieldsList->columnCount()
151+
for ( int i = 0; i < mFieldsList->columnCount(); i++ )
152152
{
153153
switch ( mLayer->fields().fieldOrigin( idx ) )
154154
{
155155
case QgsFields::OriginExpression:
156+
if ( i == 7 ) continue;
156157
mFieldsList->item( idx, i )->setBackgroundColor( QColor( 200, 200, 255 ) );
157158
break;
158159

@@ -218,6 +219,7 @@ void QgsSourceFieldsProperties::setRow( int row, int idx, const QgsField &field
218219
expressionWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
219220
expressionWidget->layout()->addWidget( editExpressionButton );
220221
expressionWidget->layout()->addWidget( new QLabel( mLayer->expressionField( idx ) ) );
222+
expressionWidget->setStyleSheet( "background-color: rgb( 200, 200, 255 )" );
221223
mFieldsList->setCellWidget( row, AttrCommentCol, expressionWidget );
222224
}
223225
else
@@ -234,9 +236,11 @@ void QgsSourceFieldsProperties::setRow( int row, int idx, const QgsField &field
234236
<< AttrLengthCol
235237
<< AttrPrecCol
236238
<< AttrCommentCol;
239+
237240
Q_FOREACH ( int i, notEditableCols )
238241
{
239-
mFieldsList->item( row, i )->setFlags( mFieldsList->item( row, i )->flags() & ~Qt::ItemIsEditable );
242+
if ( notEditableCols[i] != AttrCommentCol || mLayer->fields().fieldOrigin( idx ) != QgsFields::OriginExpression )
243+
mFieldsList->item( row, i )->setFlags( mFieldsList->item( row, i )->flags() & ~Qt::ItemIsEditable );
240244
if ( notEditableCols[i] == AttrAliasCol )
241245
mFieldsList->item( row, i )->setToolTip( tr( "Edit alias in the Form config tab" ) );
242246
}
@@ -359,33 +363,6 @@ void QgsSourceFieldsProperties::calculateFieldClicked()
359363

360364
void QgsSourceFieldsProperties::attributesListCellChanged( int row, int column )
361365
{
362-
/* this is made read only
363-
if ( column == AttrAliasCol && mLayer )
364-
{
365-
int idx = mFieldsList->item( row, AttrIdCol )->text().toInt();
366-
367-
const QgsFields &fields = mLayer->fields();
368-
369-
if ( idx >= fields.count() )
370-
{
371-
return; // index must be wrong
372-
}
373-
374-
QTableWidgetItem *aliasItem = mFieldsList->item( row, column );
375-
if ( aliasItem )
376-
{
377-
if ( !aliasItem->text().trimmed().isEmpty() )
378-
{
379-
mLayer->setFieldAlias( idx, aliasItem->text() );
380-
}
381-
else
382-
{
383-
mLayer->removeFieldAlias( idx );
384-
}
385-
}
386-
}
387-
else
388-
*/
389366
if ( column == AttrNameCol && mLayer && mLayer->isEditable() )
390367
{
391368
QTableWidgetItem *nameItem = mFieldsList->item( row, column );

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "qgsdiagramrenderer.h"
3131
#include "qgsexpressionbuilderdialog.h"
3232
#include "qgsfieldcalculator.h"
33-
#include "qgsfieldsproperties.h"
3433
#include "qgssourcefieldsproperties.h"
3534
#include "qgsattributesformproperties.h"
3635
#include "qgslabelingwidget.h"
@@ -88,15 +87,6 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
8887
: QgsOptionsDialogBase( QStringLiteral( "VectorLayerProperties" ), parent, fl )
8988
, mLayer( lyr )
9089
, mOriginalSubsetSQL( lyr->subsetString() )
91-
, mSaveAsMenu( nullptr )
92-
, mLoadStyleMenu( nullptr )
93-
, mRendererDialog( nullptr )
94-
, labelingDialog( nullptr )
95-
, mActionDialog( nullptr )
96-
, diagramPropertiesDialog( nullptr )
97-
, mFieldsPropertiesDialog( nullptr )
98-
, mSourceFieldsPropertiesDialog( nullptr )
99-
, mAttributesFormPropertiesDialog( nullptr )
10090
{
10191
setupUi( this );
10292
connect( mLayerOrigNameLineEdit, &QLineEdit::textEdited, this, &QgsVectorLayerProperties::mLayerOrigNameLineEdit_textEdited );
@@ -209,26 +199,15 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
209199
connect( mSaveAsMenu, &QMenu::triggered,
210200
this, &QgsVectorLayerProperties::saveStyleAsMenuTriggered );
211201

212-
mFieldsPropertiesDialog = new QgsFieldsProperties( mLayer, mFieldsFrame );
213-
mFieldsPropertiesDialog->layout()->setMargin( 0 );
214-
mFieldsFrame->setLayout( new QVBoxLayout( mFieldsFrame ) );
215-
mFieldsFrame->layout()->setMargin( 0 );
216-
mFieldsFrame->layout()->addWidget( mFieldsPropertiesDialog );
217-
218-
connect( mFieldsPropertiesDialog, &QgsFieldsProperties::toggleEditing, this, static_cast<void ( QgsVectorLayerProperties::* )()>( &QgsVectorLayerProperties::toggleEditing ) );
219-
connect( this, static_cast<void ( QgsVectorLayerProperties::* )( QgsMapLayer * )>( &QgsVectorLayerProperties::toggleEditing ),
220-
QgisApp::instance(), [ = ]( QgsMapLayer * layer ) { QgisApp::instance()->toggleEditing( layer ); } );
221-
222202
mSourceFieldsPropertiesDialog = new QgsSourceFieldsProperties( mLayer, mSourceFieldsFrame );
223203
mSourceFieldsPropertiesDialog->layout()->setMargin( 0 );
224204
mSourceFieldsFrame->setLayout( new QVBoxLayout( mSourceFieldsFrame ) );
225205
mSourceFieldsFrame->layout()->setMargin( 0 );
226206
mSourceFieldsFrame->layout()->addWidget( mSourceFieldsPropertiesDialog );
227207

228208
connect( mSourceFieldsPropertiesDialog, &QgsSourceFieldsProperties::toggleEditing, this, static_cast<void ( QgsVectorLayerProperties::* )()>( &QgsVectorLayerProperties::toggleEditing ) );
229-
//davinfo2 irgendwie in quere mit dem fieldsproperties, wo da selbe gemacht wird
230-
//connect( this, static_cast<void ( QgsVectorLayerProperties::* )( QgsMapLayer * )>( &QgsVectorLayerProperties::toggleEditing ),
231-
//QgisApp::instance(), [ = ]( QgsMapLayer * layer ) { QgisApp::instance()->toggleEditing( layer ); } );
209+
connect( this, static_cast<void ( QgsVectorLayerProperties::* )( QgsMapLayer * )>( &QgsVectorLayerProperties::toggleEditing ),
210+
QgisApp::instance(), [ = ]( QgsMapLayer * layer ) { QgisApp::instance()->toggleEditing( layer ); } );
232211

233212
mAttributesFormPropertiesDialog = new QgsAttributesFormProperties( mLayer, mAttributesFormFrame );
234213
mAttributesFormPropertiesDialog->layout()->setMargin( 0 );
@@ -544,20 +523,14 @@ void QgsVectorLayerProperties::syncToLayer()
544523
if ( labelingDialog )
545524
labelingDialog->adaptToLayer();
546525

547-
mFieldsPropertiesDialog->init();
548526
mSourceFieldsPropertiesDialog->init();
549527
mAttributesFormPropertiesDialog->init();
550528

551529
// set initial state for variable editor
552530
updateVariableEditor();
553531

554-
// updates the init python code and ui
555-
updateFieldsPropertiesDialog();
556-
557532
} // syncToLayer()
558533

559-
560-
561534
void QgsVectorLayerProperties::apply()
562535
{
563536
if ( labelingDialog )
@@ -626,9 +599,6 @@ void QgsVectorLayerProperties::apply()
626599

627600
mLayer->setName( mLayerOrigNameLineEdit->text() );
628601

629-
// Apply fields settings
630-
mFieldsPropertiesDialog->apply();
631-
// has to be done then mSourceFieldsPropertiesDialog->apply();
632602
mAttributesFormPropertiesDialog->apply();
633603
mSourceFieldsPropertiesDialog->apply();
634604

@@ -1225,7 +1195,6 @@ void QgsVectorLayerProperties::mButtonAddJoin_clicked()
12251195
mLayer->addJoin( info );
12261196
addJoinToTreeWidget( info );
12271197
setPbnQueryBuilderEnabled();
1228-
mFieldsPropertiesDialog->init();
12291198
mSourceFieldsPropertiesDialog->init();
12301199
mAttributesFormPropertiesDialog->init();
12311200
}
@@ -1296,7 +1265,6 @@ void QgsVectorLayerProperties::mJoinTreeWidget_itemDoubleClicked( QTreeWidgetIte
12961265
addJoinToTreeWidget( info, idx );
12971266

12981267
setPbnQueryBuilderEnabled();
1299-
mFieldsPropertiesDialog->init();
13001268
mSourceFieldsPropertiesDialog->init();
13011269
mAttributesFormPropertiesDialog->init();
13021270
}
@@ -1425,7 +1393,6 @@ void QgsVectorLayerProperties::mButtonRemoveJoin_clicked()
14251393
mLayer->removeJoin( currentJoinItem->data( 0, Qt::UserRole ).toString() );
14261394
mJoinTreeWidget->takeTopLevelItem( mJoinTreeWidget->indexOfTopLevelItem( currentJoinItem ) );
14271395
setPbnQueryBuilderEnabled();
1428-
mFieldsPropertiesDialog->init();
14291396
mSourceFieldsPropertiesDialog->init();
14301397
mAttributesFormPropertiesDialog->init();
14311398
}
@@ -1520,12 +1487,6 @@ void QgsVectorLayerProperties::updateVariableEditor()
15201487
mVariableEditor->setEditableScopeIndex( 2 );
15211488
}
15221489

1523-
void QgsVectorLayerProperties::updateFieldsPropertiesDialog()
1524-
{
1525-
QgsEditFormConfig cfg = mLayer->editFormConfig();
1526-
mFieldsPropertiesDialog->setEditFormInit( cfg.uiForm(), cfg.initFunction(), cfg.initCode(), cfg.initFilePath(), cfg.initCodeSource() );
1527-
}
1528-
15291490
void QgsVectorLayerProperties::showHelp()
15301491
{
15311492
if ( mOptionsListWidget->currentIndex().data().toString() == "Form" )
@@ -1756,6 +1717,6 @@ void QgsVectorLayerProperties::deleteAuxiliaryField( int index )
17561717
}
17571718

17581719
updateAuxiliaryStoragePage( true );
1759-
mFieldsPropertiesDialog->init();
1720+
mSourceFieldsPropertiesDialog->init();
17601721
}
17611722
}

‎src/app/qgsvectorlayerproperties.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class QgsApplyDialog;
3838
class QgsVectorLayer;
3939
class QgsLabelingWidget;
4040
class QgsDiagramProperties;
41-
class QgsFieldsProperties;
4241
class QgsSourceFieldsProperties;
4342
class QgsAttributesFormProperties;
4443
class QgsRendererPropertiesDialog;
@@ -153,11 +152,6 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
153152
*/
154153
void updateVariableEditor();
155154

156-
/**
157-
* \brief updates the FieldsPropertiesDialog when syncing the layer properties
158-
*/
159-
void updateFieldsPropertiesDialog();
160-
161155
void onAuxiliaryLayerNew();
162156

163157
void onAuxiliaryLayerClear();
@@ -201,8 +195,6 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
201195
QgsAttributeActionDialog *mActionDialog = nullptr;
202196
//! Diagram dialog. If apply is pressed, options are applied to vector's diagrams
203197
QgsDiagramProperties *diagramPropertiesDialog = nullptr;
204-
//! Fields dialog. If apply is pressed, options are applied to vector's diagrams
205-
QgsFieldsProperties *mFieldsPropertiesDialog = nullptr;
206198
//! SourceFields dialog. If apply is pressed, options are applied to vector's diagrams
207199
QgsSourceFieldsProperties *mSourceFieldsPropertiesDialog = nullptr;
208200
//! AttributesForm dialog. If apply is pressed, options are applied to vector's diagrams

‎src/ui/qgsvectorlayerpropertiesbase.ui

Lines changed: 12 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,6 @@
153153
<normaloff>:/images/themes/default/propertyicons/labels.svg</normaloff>:/images/themes/default/propertyicons/labels.svg</iconset>
154154
</property>
155155
</item>
156-
<item>
157-
<property name="text">
158-
<string>Fields</string>
159-
</property>
160-
<property name="toolTip">
161-
<string>Fields</string>
162-
</property>
163-
<property name="icon">
164-
<iconset resource="../../images/images.qrc">
165-
<normaloff>:/images/themes/default/propertyicons/attributes.png</normaloff>:/images/themes/default/propertyicons/attributes.png</iconset>
166-
</property>
167-
</item>
168156
<item>
169157
<property name="text">
170158
<string>Source Fields</string>
@@ -174,19 +162,19 @@
174162
</property>
175163
<property name="icon">
176164
<iconset>
177-
<normaloff>../../images/themes/default/propertyicons/attributes.png</normaloff>../../images/themes/default/propertyicons/attributes.png</iconset>
165+
<normaloff>../../images/themes/default/mSourceFields.svg</normaloff>../../images/themes/default/mSourceFields.svg</iconset>
178166
</property>
179167
</item>
180168
<item>
181169
<property name="text">
182-
<string>Form</string>
170+
<string>Attributes Form</string>
183171
</property>
184172
<property name="toolTip">
185173
<string>Form</string>
186174
</property>
187175
<property name="icon">
188176
<iconset resource="../../images/images.qrc">
189-
<normaloff>:/images/themes/default/propertyicons/transparency.png</normaloff>:/images/themes/default/propertyicons/transparency.png</iconset>
177+
<normaloff>:/images/themes/default/mActionFormView.svg</normaloff>:/images/themes/default/mActionFormView.svg</iconset>
190178
</property>
191179
</item>
192180
<item>
@@ -345,7 +333,7 @@
345333
</sizepolicy>
346334
</property>
347335
<property name="currentIndex">
348-
<number>17</number>
336+
<number>8</number>
349337
</property>
350338
<widget class="QWidget" name="mOptsPage_Information">
351339
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -784,66 +772,6 @@ border-radius: 2px;</string>
784772
</item>
785773
</layout>
786774
</widget>
787-
<widget class="QWidget" name="mOptsPage_Fields">
788-
<layout class="QVBoxLayout" name="verticalLayout_15">
789-
<property name="leftMargin">
790-
<number>0</number>
791-
</property>
792-
<property name="topMargin">
793-
<number>0</number>
794-
</property>
795-
<property name="rightMargin">
796-
<number>0</number>
797-
</property>
798-
<property name="bottomMargin">
799-
<number>0</number>
800-
</property>
801-
<item>
802-
<widget class="QgsScrollArea" name="scrollArea_5">
803-
<property name="frameShape">
804-
<enum>QFrame::NoFrame</enum>
805-
</property>
806-
<property name="widgetResizable">
807-
<bool>true</bool>
808-
</property>
809-
<widget class="QWidget" name="scrollAreaWidgetContents_5">
810-
<property name="geometry">
811-
<rect>
812-
<x>0</x>
813-
<y>0</y>
814-
<width>100</width>
815-
<height>30</height>
816-
</rect>
817-
</property>
818-
<layout class="QVBoxLayout" name="verticalLayout_20">
819-
<property name="leftMargin">
820-
<number>0</number>
821-
</property>
822-
<property name="topMargin">
823-
<number>0</number>
824-
</property>
825-
<property name="rightMargin">
826-
<number>0</number>
827-
</property>
828-
<property name="bottomMargin">
829-
<number>0</number>
830-
</property>
831-
<item>
832-
<widget class="QFrame" name="mFieldsFrame">
833-
<property name="frameShape">
834-
<enum>QFrame::NoFrame</enum>
835-
</property>
836-
<property name="frameShadow">
837-
<enum>QFrame::Plain</enum>
838-
</property>
839-
</widget>
840-
</item>
841-
</layout>
842-
</widget>
843-
</widget>
844-
</item>
845-
</layout>
846-
</widget>
847775
<widget class="QWidget" name="mOptsPage_SourceFields">
848776
<layout class="QVBoxLayout" name="verticalLayout_29">
849777
<item>
@@ -856,8 +784,8 @@ border-radius: 2px;</string>
856784
<rect>
857785
<x>0</x>
858786
<y>0</y>
859-
<width>70</width>
860-
<height>22</height>
787+
<width>646</width>
788+
<height>518</height>
861789
</rect>
862790
</property>
863791
<layout class="QGridLayout" name="gridLayout_3">
@@ -889,8 +817,8 @@ border-radius: 2px;</string>
889817
<rect>
890818
<x>0</x>
891819
<y>0</y>
892-
<width>70</width>
893-
<height>22</height>
820+
<width>646</width>
821+
<height>518</height>
894822
</rect>
895823
</property>
896824
<layout class="QGridLayout" name="gridLayout_11">
@@ -938,7 +866,7 @@ border-radius: 2px;</string>
938866
<x>0</x>
939867
<y>0</y>
940868
<width>725</width>
941-
<height>394</height>
869+
<height>520</height>
942870
</rect>
943871
</property>
944872
<layout class="QVBoxLayout" name="verticalLayout_32">
@@ -1361,8 +1289,8 @@ border-radius: 2px;</string>
13611289
<rect>
13621290
<x>0</x>
13631291
<y>0</y>
1364-
<width>100</width>
1365-
<height>30</height>
1292+
<width>662</width>
1293+
<height>534</height>
13661294
</rect>
13671295
</property>
13681296
<layout class="QVBoxLayout" name="verticalLayout_21">
@@ -1707,7 +1635,7 @@ border-radius: 2px;</string>
17071635
<rect>
17081636
<x>0</x>
17091637
<y>0</y>
1710-
<width>371</width>
1638+
<width>648</width>
17111639
<height>608</height>
17121640
</rect>
17131641
</property>
@@ -2464,7 +2392,6 @@ border-radius: 2px;</string>
24642392
<tabstop>txtSubsetSQL</tabstop>
24652393
<tabstop>pbnQueryBuilder</tabstop>
24662394
<tabstop>scrollArea_3</tabstop>
2467-
<tabstop>scrollArea_5</tabstop>
24682395
<tabstop>scrollArea_19</tabstop>
24692396
<tabstop>mScaleVisibilityGroupBox</tabstop>
24702397
<tabstop>mScaleRangeWidget</tabstop>

0 commit comments

Comments
 (0)
Please sign in to comment.