Skip to content
Permalink
Browse files

Add getter/setter for type

  • Loading branch information
m-kuhn committed Sep 28, 2017
1 parent 02b3865 commit 89943e1259d5b430e975a9618975d6ad3ad52c32
Showing with 22 additions and 10 deletions.
  1. +13 −3 src/app/qgsattributesformproperties.cpp
  2. +9 −7 src/app/qgsattributesformproperties.h
@@ -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;
@@ -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 );
@@ -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();
@@ -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
@@ -24,7 +24,6 @@
#include <QSpinBox>
#include <QTreeWidgetItem>
#include <QDropEvent>
#include <QPushButton>
#include <QTableWidgetItem>
#include <QMessageBox>
#include <QFileDialog>
@@ -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();
@@ -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( );
};


@@ -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;
@@ -242,6 +243,7 @@ class DnDTree : public QTreeWidget

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


0 comments on commit 89943e1

Please sign in to comment.
You can’t perform that action at this time.