Skip to content

Commit

Permalink
Add getter/setter for type
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Sep 28, 2017
1 parent 02b3865 commit 89943e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
16 changes: 13 additions & 3 deletions src/app/qgsattributesformproperties.cpp
Expand Up @@ -19,7 +19,7 @@ QgsAttributesFormProperties::QgsAttributesFormProperties( QgsVectorLayer *layer,
mDragListWidgetLayout->addWidget( mDragTree );
mDragListWidget->setLayout( mDragListWidgetLayout );
mDragTree->setHeaderLabels( QStringList() << tr( "Label" ) );
mDragTree->type = DnDTree::Type::Drag;
mDragTree->setType( DnDTree::Type::Drag );

// drop tree
QGridLayout *mDropListWidgetLayout = new QGridLayout;
Expand All @@ -28,7 +28,7 @@ QgsAttributesFormProperties::QgsAttributesFormProperties( QgsVectorLayer *layer,
mDropListWidgetLayout->setMargin( 0 );
mDropListWidget->setLayout( mDropListWidgetLayout );
mDropTree->setHeaderLabels( QStringList() << tr( "Label" ) );
mDropTree->type = DnDTree::Type::Drop;
mDropTree->setType( DnDTree::Type::Drop );

// AttributeTypeDialog
mAttributeTypeDialog = new QgsAttributeTypeDialog( mLayer, 0, mAttributeTypeFrame );
Expand Down Expand Up @@ -244,7 +244,7 @@ QTreeWidgetItem *QgsAttributesFormProperties::loadAttributeEditorTreeItem( QgsAt

void QgsAttributesFormProperties::loadAttributeEditorTree( DnDTree *mTree )
{
if ( mTree->type == DnDTree::Type::Drop )
if ( mTree->type() == DnDTree::Type::Drop )
{
// tabs and groups info
mTree->clear();
Expand Down Expand Up @@ -821,6 +821,16 @@ void DnDTree::onItemDoubleClicked( QTreeWidgetItem *item, int column )
}
}

DnDTree::Type DnDTree::type() const
{
return mType;
}

void DnDTree::setType( const Type &value )
{
mType = value;
}


/*
* Serialization helpers for DesigerTreeItemData so we can stuff this easily into QMimeData
Expand Down
16 changes: 9 additions & 7 deletions src/app/qgsattributesformproperties.h
Expand Up @@ -24,7 +24,6 @@
#include <QSpinBox>
#include <QTreeWidgetItem>
#include <QDropEvent>
#include <QPushButton>
#include <QTableWidgetItem>
#include <QMessageBox>
#include <QFileDialog>
Expand Down Expand Up @@ -165,7 +164,7 @@ class APP_EXPORT QgsAttributesFormProperties : public QWidget, private Ui_QgsAtt
void loadRelations();

void loadAttributeEditorTree( DnDTree *mTree );
QTreeWidgetItem *loadAttributeEditorTreeItem( QgsAttributeEditorElement *const widgetDef, QTreeWidgetItem *parent, DnDTree* mTree);
QTreeWidgetItem *loadAttributeEditorTreeItem( QgsAttributeEditorElement *const widgetDef, QTreeWidgetItem *parent, DnDTree *mTree );

protected:
void updateButtons();
Expand All @@ -187,10 +186,10 @@ class APP_EXPORT QgsAttributesFormProperties : public QWidget, private Ui_QgsAtt
signals:

private slots:
void addTabOrGroupButton();
void removeTabOrGroupButton();
void loadAttributeTypeDialog( );
void storeAttributeTypeDialog( );
void addTabOrGroupButton();
void removeTabOrGroupButton();
void loadAttributeTypeDialog( );
void storeAttributeTypeDialog( );
};


Expand Down Expand Up @@ -222,9 +221,11 @@ class DnDTree : public QTreeWidget
Drop
};

Type type;

QList<QTreeWidgetItem *> mIndexedWidgets;
Type type() const;
void setType( const Type &value );

protected:
virtual void dragMoveEvent( QDragMoveEvent *event ) override;
virtual void dropEvent( QDropEvent *event ) override;
Expand All @@ -242,6 +243,7 @@ class DnDTree : public QTreeWidget

private:
QgsVectorLayer *mLayer = nullptr;
Type mType;
};


Expand Down

0 comments on commit 89943e1

Please sign in to comment.