mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-30 00:04:11 -04:00
First attempt to create a load style ui
This commit is contained in:
parent
8694c19f23
commit
002eb0d537
@ -82,6 +82,7 @@ SET(QGIS_APP_SRCS
|
||||
qgsmaptooltextannotation.cpp
|
||||
qgsmaptoolvertexedit.cpp
|
||||
qgssavestyletodbdialog.cpp
|
||||
qgsloadstylefromdbdialog.cpp
|
||||
|
||||
nodetool/qgsmaptoolnodetool.cpp
|
||||
nodetool/qgsselectedfeature.cpp
|
||||
@ -229,6 +230,7 @@ SET (QGIS_APP_MOC_HDRS
|
||||
qgsmaptoolsplitfeatures.h
|
||||
qgsmaptoolvertexedit.h
|
||||
qgssavestyletodbdialog.h
|
||||
qgsloadstylefromdbdialog.h
|
||||
|
||||
nodetool/qgsmaptoolnodetool.h
|
||||
nodetool/qgsselectedfeature.h
|
||||
|
19
src/app/qgsloadstylefromdbdialog.cpp
Normal file
19
src/app/qgsloadstylefromdbdialog.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsloadstylefromdbdialog.h"
|
||||
#include "qgslogger.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
QgsLoadStyleFromDBDialog::QgsLoadStyleFromDBDialog( QWidget *parent )
|
||||
: QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
}
|
42
src/app/qgsloadstylefromdbdialog.h
Normal file
42
src/app/qgsloadstylefromdbdialog.h
Normal file
@ -0,0 +1,42 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSADDATTRDIALOG_H
|
||||
#define QGSADDATTRDIALOG_H
|
||||
|
||||
#include "ui_qgsloadstylefromdbdialog.h"
|
||||
#include "qgisgui.h"
|
||||
#include "qgsfield.h"
|
||||
|
||||
//class QgsVectorLayer;
|
||||
|
||||
class QgsLoadStyleFromDBDialog: public QDialog, private Ui::QgsLoadStyleFromDBDialogLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QgsLoadStyleFromDBDialog( QWidget *parent = 0 );
|
||||
// QgsAddAttrDialog( QgsVectorLayer *vlayer,
|
||||
// QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
|
||||
// QgsAddAttrDialog( const std::list<QString>& typelist,
|
||||
// QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
|
||||
|
||||
// QgsField field() const;
|
||||
|
||||
public slots:
|
||||
// void on_mTypeBox_currentIndexChanged( int idx );
|
||||
// void on_mLength_editingFinished();
|
||||
// void accept();
|
||||
|
||||
private:
|
||||
// QString mLayerType;
|
||||
|
||||
// void setPrecisionMinMax();
|
||||
};
|
||||
|
||||
#endif
|
@ -18,7 +18,7 @@ QgsSaveStyleToDbDialog::QgsSaveStyleToDbDialog( QWidget *parent ) :
|
||||
QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
setWindowTitle( "Save style in Postgres" );
|
||||
setWindowTitle( "Save style in database" );
|
||||
mDescriptionEdit->setTabChangesFocus( true );
|
||||
setTabOrder( mNameEdit, mDescriptionEdit );
|
||||
setTabOrder( mDescriptionEdit, mUseAsDefault );
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "qgslabelinggui.h"
|
||||
#include "qgslabel.h"
|
||||
#include "qgslegenditem.h"
|
||||
//#include "qgsloadstylefromdbdialog.h"
|
||||
#include "qgsgenericprojectionselector.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsmaplayerregistry.h"
|
||||
@ -747,7 +748,7 @@ void QgsVectorLayerProperties::loadStyleMenuTriggered( QAction *action )
|
||||
|
||||
void QgsVectorLayerProperties::showListOfStylesFromDatabase()
|
||||
{
|
||||
//TODO el1073 ui&logic
|
||||
// QgsLoadStyleFromDBDialog dialog;
|
||||
}
|
||||
|
||||
QList<QgsVectorOverlayPlugin*> QgsVectorLayerProperties::overlayPlugins() const
|
||||
|
@ -136,13 +136,15 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
|
||||
|
||||
/** called when is possible to choice if load the style from filesystem or from db */
|
||||
void loadStyleMenuTriggered( QAction * );
|
||||
/** when provider supports, it will list all the styles relative the layer */
|
||||
void showListOfStylesFromDatabase();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
void saveStyleAs( StyleType styleType );
|
||||
|
||||
/** when provider supports, it will list all the styles relative the layer */
|
||||
void showListOfStylesFromDatabase();
|
||||
|
||||
void updateSymbologyPage();
|
||||
|
||||
QgsVectorLayer *layer;
|
||||
|
@ -3246,7 +3246,7 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS
|
||||
char* c = PQgetvalue( result, 0, 0 );
|
||||
if( *c == '0' )
|
||||
{
|
||||
QString createTabeQuery = QObject::tr( "CREATE TABLE public.%1 ( f_table_catalog varchar(256), f_table_schema varchar(256), f_table_name varchar(256), f_geometry_column varchar(256), styleName varchar(30), styleQML xml, styleSLD xml, useAsDefault boolean, description text, owner varchar(30), ui xml, update_time timestamp DEFAULT CURRENT_TIMESTAMP );" ).arg( styleTableName );
|
||||
QString createTabeQuery = QObject::tr( "CREATE TABLE public.%1 (id SERIAL PRIMARY KEY, f_table_catalog varchar(256), f_table_schema varchar(256), f_table_name varchar(256), f_geometry_column varchar(256), styleName varchar(30), styleQML xml, styleSLD xml, useAsDefault boolean, description text, owner varchar(30), ui xml, update_time timestamp DEFAULT CURRENT_TIMESTAMP );" ).arg( styleTableName );
|
||||
|
||||
res = conn->PQexec( createTabeQuery );
|
||||
if ( res.PQresultStatus() != PGRES_COMMAND_OK )
|
||||
|
98
src/ui/qgsloadstylefromdbdialog.ui
Normal file
98
src/ui/qgsloadstylefromdbdialog.ui
Normal file
@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsLoadStyleFromDBDialogLayout</class>
|
||||
<widget class="QDialog" name="QgsLoadStyleFromDBDialogLayout">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>475</width>
|
||||
<height>390</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add column</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Styles related to the layer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="mRelatedTable"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Other styles on the database</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="mOthersTable"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mCancelButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mLoadButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user