mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-23 00:05:43 -04:00
open on drop
This commit is contained in:
parent
bb6702fc34
commit
7fd8732061
@ -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 );
|
||||
|
71
src/app/qgsqmlwidgetconfig.ui
Normal file
71
src/app/qgsqmlwidgetconfig.ui
Normal file
@ -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>
|
Loading…
x
Reference in New Issue
Block a user