Skip to content
Permalink
Browse files

open on drop

  • Loading branch information
signedav committed Sep 5, 2018
1 parent bb6702f commit 7fd8732061d57deb08d2042f303430b39f00d92d
Showing with 86 additions and 4 deletions.
  1. +15 −4 src/app/qgsattributesformproperties.cpp
  2. +71 −0 src/app/qgsqmlwidgetconfig.ui
@@ -142,7 +142,7 @@ void QgsAttributesFormProperties::initAvailableWidgetsTree()
DnDTreeItemData itemData = DnDTreeItemData( DnDTreeItemData::QmlWidget, QStringLiteral( "QmlWidget" ), tr( "QML Widget" ) );
itemData.setShowLabel( true );

QTreeWidgetItem *item = mAvailableWidgetsTree->addItem( catitem, itemData );
mAvailableWidgetsTree->addItem( catitem, itemData );
catitem ->setExpanded( true );
}

@@ -851,6 +851,10 @@ QTreeWidgetItem *DnDTree::addItem( QTreeWidgetItem *parent, QgsAttributesFormPro
case QgsAttributesFormProperties::DnDTreeItemData::Container:
newItem->setIcon( 0, QgsApplication::getThemeIcon( "/mContainerIcon.svg" ) );
break;

case QgsAttributesFormProperties::DnDTreeItemData::QmlWidget:
newItem->setIcon( 0, QgsApplication::getThemeIcon( "/mQmlWidgetIcon.svg" ) );
break;
}
}
newItem->setData( 0, QgsAttributesFormProperties::DnDTreeRole, data );
@@ -914,16 +918,23 @@ bool DnDTree::dropMimeData( QTreeWidgetItem *parent, int index, const QMimeData
{
stream >> itemElement;

QTreeWidgetItem *newItem;

if ( parent )
{
addItem( parent, itemElement, index );
newItem = addItem( parent, itemElement, index );
bDropSuccessful = true;
}
else
{
addItem( invisibleRootItem(), itemElement, index );
newItem = addItem( invisibleRootItem(), itemElement, index );
bDropSuccessful = true;
}

if ( itemElement.type() == QgsAttributesFormProperties::DnDTreeItemData::QmlWidget )
{
onItemDoubleClicked( newItem, 0 );
}
}
}

@@ -1094,8 +1105,8 @@ void DnDTree::onItemDoubleClicked( QTreeWidgetItem *item, int column )
case QgsAttributesFormProperties::DnDTreeItemData::QmlWidget:
{
QDialog dlg;
dlg.resize( 600, 400 );
dlg.setWindowTitle( tr( "Configure QML Widget" ) );
dlg.setBaseSize( 600, 400 );
QFormLayout *layout = new QFormLayout() ;
dlg.setLayout( layout );
layout->addWidget( baseWidget );
@@ -0,0 +1,71 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>Dialog</class>
<widget class="QDialog" name="Dialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="geometry" >
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

0 comments on commit 7fd8732

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