mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Added ability to load a layer by double clicking on it in the list of PG layers
git-svn-id: http://svn.osgeo.org/qgis/trunk@611 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
8062d463fe
commit
362c9300e7
@ -29,11 +29,13 @@
|
||||
#include "xpm/polygon_layer.xpm"
|
||||
#include "qgsdbsourceselect.h"
|
||||
#include "qgsnewconnection.h"
|
||||
#include "qgisapp.h"
|
||||
extern "C"
|
||||
{
|
||||
#include <libpq-fe.h>
|
||||
}
|
||||
QgsDbSourceSelect::QgsDbSourceSelect(QWidget *parent, const char *name):QgsDbSourceSelectBase()
|
||||
QgsDbSourceSelect::QgsDbSourceSelect(QgisApp *app, QWidget *parent, const char *name)
|
||||
:QgsDbSourceSelectBase(parent, name), qgisApp(app)
|
||||
{
|
||||
btnAdd->setEnabled(false);
|
||||
populateConnectionList();
|
||||
@ -212,3 +214,7 @@ QString QgsDbSourceSelect::connInfo()
|
||||
{
|
||||
return m_connInfo;
|
||||
}
|
||||
void QgsDbSourceSelect::addLayer(QListBoxItem *item){
|
||||
qgisApp->addVectorLayer(m_connInfo, item->text(), "postgres");
|
||||
lstTables->setSelected(item, false);
|
||||
}
|
||||
|
@ -18,6 +18,9 @@
|
||||
#ifndef QGSDBSOURCESELECT_H
|
||||
#define QGSDBSOURCESELECT_H
|
||||
#include "qgsdbsourceselectbase.h"
|
||||
|
||||
class QListBoxItem;
|
||||
class QgisApp;
|
||||
/*! \class QgsDbSourceSelect
|
||||
* \brief Dialog to create connections and add tables from PostgresQL.
|
||||
*
|
||||
@ -30,7 +33,7 @@ class QgsDbSourceSelect : public QgsDbSourceSelectBase
|
||||
Q_OBJECT
|
||||
public:
|
||||
//! Constructor
|
||||
QgsDbSourceSelect(QWidget *parent = 0, const char *name = 0);
|
||||
QgsDbSourceSelect(QgisApp *app=0, QWidget *parent = 0, const char *name = 0);
|
||||
//! Destructor
|
||||
~QgsDbSourceSelect();
|
||||
//! Opens the create connection dialog to build a new connection
|
||||
@ -51,9 +54,13 @@ class QgsDbSourceSelect : public QgsDbSourceSelectBase
|
||||
QStringList selectedTables();
|
||||
//! Connection info (database, host, user, password)
|
||||
QString connInfo();
|
||||
//! Add the layer selected when user double-clicks the mouse
|
||||
void addLayer(QListBoxItem *item);
|
||||
private:
|
||||
QString m_connInfo;
|
||||
QStringList m_selectedTables;
|
||||
//! Pointer to the qgis application mainwindow
|
||||
QgisApp *qgisApp;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
|
||||
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
|
||||
<class>QgsDbSourceSelectBase</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
@ -9,7 +9,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>390</width>
|
||||
<height>344</height>
|
||||
<height>347</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -275,6 +275,12 @@
|
||||
<receiver>QgsDbSourceSelectBase</receiver>
|
||||
<slot>deleteConnection()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>lstTables</sender>
|
||||
<signal>doubleClicked(QListBoxItem*)</signal>
|
||||
<receiver>QgsDbSourceSelectBase</receiver>
|
||||
<slot>addLayer(QListBoxItem*)</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>cmbConnections</tabstop>
|
||||
@ -296,6 +302,7 @@
|
||||
<slot>addNewConnection()</slot>
|
||||
<slot>editConnection()</slot>
|
||||
<slot>deleteConnection()</slot>
|
||||
<slot>addLayer(QListBoxItem*)</slot>
|
||||
</slots>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
||||
|
@ -36,4 +36,9 @@ void QgsDbSourceSelectBase::editConnection()
|
||||
void QgsDbSourceSelectBase::deleteConnection()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void QgsDbSourceSelectBase::addLayer( QListBoxItem * )
|
||||
{
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user