Skip to content
Permalink
Browse files

drag'n'drop improvements part 3 (#34479)

* drag'n'drop improvements

part 3

this completely removes hidden config accessible under double click
now a widget groupbox (by opposition to the field config) is shown on top of the right panel
  • Loading branch information
3nids committed Feb 14, 2020
1 parent 504d43a commit 9441fcc94728ab2ed4d18b554290d4a08ff23b9d
@@ -0,0 +1,4 @@
# The following has been generated automatically from src/core/qgseditformconfig.h
QgsEditFormConfig.EditorLayout.baseClass = QgsEditFormConfig
QgsEditFormConfig.FeatureFormSuppress.baseClass = QgsEditFormConfig
QgsEditFormConfig.PythonInitCodeSource.baseClass = QgsEditFormConfig
@@ -17,6 +17,9 @@ class QgsEditFormConfig
%TypeHeaderCode
#include "qgseditformconfig.h"
%End
public:
static const QMetaObject staticMetaObject;

public:

enum EditorLayout
@@ -7,6 +7,11 @@ SET(QGIS_APP_SRCS
${CMAKE_SOURCE_DIR}/external/nmea/gmath.c
${CMAKE_SOURCE_DIR}/external/nmea/time.c

attributeformconfig/qgsattributeformcontaineredit.cpp
attributeformconfig/qgsattributerelationedit.cpp
attributeformconfig/qgsattributetypedialog.cpp
attributeformconfig/qgsattributewidgetedit.cpp

qgisapp.cpp
qgisappinterface.cpp
qgisappstylesheet.cpp
@@ -26,8 +31,6 @@ SET(QGIS_APP_SRCS
qgsappsslerrorhandler.cpp
qgsattributeactiondialog.cpp
qgsattributeactionpropertiesdialog.cpp
qgsattributetypedialog.cpp
qgsattributerelationedit.cpp
qgsattributesforminitcode.cpp
qgsattributetabledialog.cpp
qgsbookmarks.cpp
@@ -112,8 +115,6 @@ SET(QGIS_APP_SRCS
qgsmaptoolsvgannotation.cpp
qgsmaptooltextannotation.cpp

attributeformconfig/qgsattributeformcontaineredit.cpp

decorations/qgsdecorationitem.cpp
decorations/qgsdecorationtitle.cpp
decorations/qgsdecorationtitledialog.cpp
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,87 @@
/***************************************************************************
qgsattributewidgetedit.cpp
---------------------
begin : February 2020
copyright : (C) 2020 Denis Rouzaud
email : denis@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsattributewidgetedit.h"
#include "qgsattributesformproperties.h"


QgsAttributeWidgetEdit::QgsAttributeWidgetEdit( QTreeWidgetItem *item, QWidget *parent )
: QgsCollapsibleGroupBox( parent )
, mTreeItem( item )

{
setupUi( this );

const QgsAttributesFormProperties::DnDTreeItemData itemData = mTreeItem->data( 0, QgsAttributesFormProperties::DnDTreeRole ).value<QgsAttributesFormProperties::DnDTreeItemData>();
Q_ASSERT( itemData.type() == QgsAttributesFormProperties::DnDTreeItemData::Container );

// common configs
mShowLabelCheckBox->setChecked( itemData.showLabel() );

// hide specific configs
mRelationShowLinkCheckBox->hide();
mRelationShowUnlinkCheckBox->hide();

switch ( itemData.type() )
{
case QgsAttributesFormProperties::DnDTreeItemData::Relation:
{
mRelationShowLinkCheckBox->show();
mRelationShowUnlinkCheckBox->show();
mRelationShowLinkCheckBox->setChecked( itemData.relationEditorConfiguration().showLinkButton );
mRelationShowUnlinkCheckBox->setChecked( itemData.relationEditorConfiguration().showUnlinkButton );
}
break;

case QgsAttributesFormProperties::DnDTreeItemData::Field:
case QgsAttributesFormProperties::DnDTreeItemData::Container:
case QgsAttributesFormProperties::DnDTreeItemData::QmlWidget:
case QgsAttributesFormProperties::DnDTreeItemData::HtmlWidget:
case QgsAttributesFormProperties::DnDTreeItemData::WidgetType:
break;
}


}

void QgsAttributeWidgetEdit::updateItemData()
{
QgsAttributesFormProperties::DnDTreeItemData itemData = mTreeItem->data( 0, QgsAttributesFormProperties::DnDTreeRole ).value<QgsAttributesFormProperties::DnDTreeItemData>();

// common configs
itemData.setShowLabel( mShowLabelCheckBox->isChecked() );

// specific configs
switch ( itemData.type() )
{
case QgsAttributesFormProperties::DnDTreeItemData::Relation:
{
QgsAttributesFormProperties::RelationEditorConfiguration relEdCfg;
relEdCfg.showLinkButton = mRelationShowLinkCheckBox->isChecked();
relEdCfg.showUnlinkButton = mRelationShowUnlinkCheckBox->isChecked();
itemData.setRelationEditorConfiguration( relEdCfg );
}
break;

case QgsAttributesFormProperties::DnDTreeItemData::Field:
case QgsAttributesFormProperties::DnDTreeItemData::Container:
case QgsAttributesFormProperties::DnDTreeItemData::QmlWidget:
case QgsAttributesFormProperties::DnDTreeItemData::HtmlWidget:
case QgsAttributesFormProperties::DnDTreeItemData::WidgetType:
break;
}

mTreeItem->setData( 0, QgsAttributesFormProperties::DnDTreeRole, itemData );
}
@@ -0,0 +1,45 @@
/***************************************************************************
qgsattributewidgetedit.h
---------------------
begin : February 2020
copyright : (C) 2020 Denis Rouzaud
email : denis@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSATTRIBUTEWIDGETEDIT_H
#define QGSATTRIBUTEWIDGETEDIT_H

#include <QWidget>

#include "ui_qgsattributewidgeteditgroupbox.h"

#include "qgis_app.h"

class QTreeWidgetItem;

/**
* Widget to edit a container (tab or group box) of a form configuration
*/
class APP_EXPORT QgsAttributeWidgetEdit: public QgsCollapsibleGroupBox, private Ui_QgsAttributeWidgetEditGroupBox
{
Q_OBJECT

public:
explicit QgsAttributeWidgetEdit( QTreeWidgetItem *item, QWidget *parent = nullptr );


void updateItemData();


private:
QTreeWidgetItem *mTreeItem;
};

#endif // QGSATTRIBUTEWIDGETEDIT_H

0 comments on commit 9441fcc

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