QGIS API Documentation  3.21.0-Master (909859188c)
qgsmodeldesignerinputstreewidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmodeldesignerinputstreewidget.cpp
3  ------------------------
4  Date : March 2020
5  Copyright : (C) 2020 Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
17 
18 #include <QMimeData>
19 
21 
22 QgsModelDesignerInputsTreeWidget::QgsModelDesignerInputsTreeWidget( QWidget *parent )
23  : QTreeWidget( parent )
24 {
25 
26 }
27 
28 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
29 QMimeData *QgsModelDesignerInputsTreeWidget::mimeData( const QList<QTreeWidgetItem *> items ) const
30 #else
31 QMimeData *QgsModelDesignerInputsTreeWidget::mimeData( const QList<QTreeWidgetItem *> &items ) const
32 #endif
33 {
34  if ( items.empty() )
35  return nullptr;
36 
37  std::unique_ptr< QMimeData > res = std::make_unique< QMimeData >();
38  const QString text = items.value( 0 )->data( 0, Qt::UserRole ).toString();
39  res->setText( text );
40  return res.release();
41 }
42 
44