Skip to content
Permalink
Browse files
Merge pull request #44253 from mrylov/hana_dev
Fix: HANA provider doesn't compile if WITH_GUI is off
  • Loading branch information
m-kuhn committed Jul 20, 2021
2 parents 8798653 + de2ef3c commit 6d5f13348f67f8479e2c2900505119fc31c3056a
@@ -6,6 +6,7 @@ set (HANA_SRCS
qgshanaconnection.cpp
qgshanaconnectionpool.cpp
qgshanaconnectionstringbuilder.cpp
qgshanadataitems.cpp
qgshanadriver.cpp
qgshanaexpressioncompiler.cpp
qgshanafeatureiterator.cpp
@@ -21,7 +22,6 @@ set (HANA_SRCS

if (WITH_GUI)
set(HANA_SRCS ${HANA_SRCS}
qgshanadataitems.cpp
qgshanadataitemguiprovider.cpp
qgshananewconnection.cpp
qgshanaprovidergui.cpp
@@ -20,6 +20,7 @@
#include "qgshananewconnection.h"
#include "qgshanaprovider.h"
#include "qgshanaproviderconnection.h"
#include "qgshanasourceselect.h"
#include "qgshanautils.h"
#include "qgsnewnamedialog.h"

@@ -164,6 +165,16 @@ bool QgsHanaDataItemGuiProvider::handleDrop(
return false;
}

QWidget *QgsHanaDataItemGuiProvider::createParamWidget( QgsDataItem *root, QgsDataItemGuiContext )
{
QgsHanaRootItem *rootItem = qobject_cast<QgsHanaRootItem *>( root );
if ( rootItem == nullptr )
return nullptr;
QgsHanaSourceSelect *select = new QgsHanaSourceSelect( nullptr, QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode::Manager );
connect( select, &QgsHanaSourceSelect::connectionsChanged, rootItem, &QgsHanaRootItem::onConnectionsChanged );
return select;
}

void QgsHanaDataItemGuiProvider::newConnection( QgsDataItem *item )
{
QgsHanaNewConnection nc( nullptr );
@@ -37,6 +37,8 @@ class QgsHanaDataItemGuiProvider : public QObject, public QgsDataItemGuiProvider
bool acceptDrop( QgsDataItem *item, QgsDataItemGuiContext context ) override;
bool handleDrop( QgsDataItem *item, QgsDataItemGuiContext context, const QMimeData *data, Qt::DropAction action ) override;

QWidget *createParamWidget( QgsDataItem *root, QgsDataItemGuiContext ) override;

private:
static void newConnection( QgsDataItem *item );
static void editConnection( QgsDataItem *item );
@@ -19,15 +19,12 @@
#include "qgshanaconnection.h"
#include "qgshanaconnectionpool.h"
#include "qgshanaexception.h"
#include "qgshananewconnection.h"
#include "qgshanadataitems.h"
#include "qgshanasettings.h"
#include "qgshanasourceselect.h"
#include "qgshanautils.h"
#include "qgslogger.h"
#include "qgsmessageoutput.h"
#include "qgsmimedatautils.h"
#include "qgsnewnamedialog.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayerexporter.h"
#include "qgsfieldsitem.h"
@@ -416,15 +413,6 @@ QVector<QgsDataItem *> QgsHanaRootItem::createChildren()
return connections;
}

QWidget *QgsHanaRootItem::paramWidget()
{
QgsHanaSourceSelect *select = new QgsHanaSourceSelect( nullptr, Qt::WindowFlags(),
QgsProviderRegistry::WidgetMode::Manager );
connect( select, &QgsHanaSourceSelect::connectionsChanged, this,
&QgsHanaRootItem::onConnectionsChanged );
return select;
}

void QgsHanaRootItem::onConnectionsChanged()
{
refresh();
@@ -40,8 +40,6 @@ class QgsHanaRootItem : public QgsConnectionsRootItem

QVariant sortKey() const override { return 3; }

QWidget *paramWidget() override;

public slots:
void onConnectionsChanged();
};
@@ -32,11 +32,7 @@
#include "qgshanaresultset.h"
#include "qgshanacrsutils.h"
#include "qgshanautils.h"
#ifdef HAVE_GUI
#include "qgshanadataitems.h"
#include "qgshanasourceselect.h"
#include "qgssourceselectprovider.h"
#endif
#include "qgslogger.h"
#include "qgsmessagelog.h"
#include "qgsrectangle.h"
@@ -21,9 +21,6 @@
#include "qgsprovidermetadata.h"
#include "qgshanaconnection.h"
#include "qgshanaprimarykeys.h"
#ifdef HAVE_GUI
#include "qgsproviderguimetadata.h"
#endif
#include "qgsvectordataprovider.h"

#include <QVersionNumber>

0 comments on commit 6d5f133

Please sign in to comment.