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 ); mDragListWidgetLayout->addWidget( mDragTree );
mDragListWidget->setLayout( mDragListWidgetLayout ); mDragListWidget->setLayout( mDragListWidgetLayout );
mDragTree->setHeaderLabels( QStringList() << tr( "Label" ) ); mDragTree->setHeaderLabels( QStringList() << tr( "Label" ) );
mDragTree->type = DnDTree::Type::Drag; mDragTree->setType( DnDTree::Type::Drag );


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


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


void QgsAttributesFormProperties::loadAttributeEditorTree( DnDTree *mTree ) void QgsAttributesFormProperties::loadAttributeEditorTree( DnDTree *mTree )
{ {
if ( mTree->type == DnDTree::Type::Drop ) if ( mTree->type() == DnDTree::Type::Drop )
{ {
// tabs and groups info // tabs and groups info
mTree->clear(); 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 * 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 <QSpinBox>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QDropEvent> #include <QDropEvent>
#include <QPushButton>
#include <QTableWidgetItem> #include <QTableWidgetItem>
#include <QMessageBox> #include <QMessageBox>
#include <QFileDialog> #include <QFileDialog>
Expand Down Expand Up @@ -165,7 +164,7 @@ class APP_EXPORT QgsAttributesFormProperties : public QWidget, private Ui_QgsAtt
void loadRelations(); void loadRelations();


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


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


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




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


Type type;


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

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


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




Expand Down

0 comments on commit 89943e1

Please sign in to comment.