|
|
@@ -1,12 +1,36 @@ |
|
|
/*************************************************************************** |
|
|
qgsrelationadddlg.cpp - QgsRelationAddDlg |
|
|
--------------------------------- |
|
|
|
|
|
begin : 4.10.2013 |
|
|
copyright : (C) 2013 by Matthias Kuhn |
|
|
email : matthias@opengis.ch |
|
|
*************************************************************************** |
|
|
* * |
|
|
* 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 "qgsrelationadddlg.h" |
|
|
#include "qgsvectorlayer.h" |
|
|
|
|
|
#include <QPushButton> |
|
|
|
|
|
QgsRelationAddDlg::QgsRelationAddDlg( QWidget *parent ) |
|
|
: QDialog( parent ) |
|
|
{ |
|
|
setupUi( this ); |
|
|
|
|
|
mTxtRelationId->setPlaceholderText( tr( "[Generated automatically]" ) ); |
|
|
checkDefinitionValid(); |
|
|
|
|
|
connect( mCbxReferencingLayer, SIGNAL( currentIndexChanged( int ) ), this, SLOT( checkDefinitionValid() ) ); |
|
|
connect( mCbxReferencingField, SIGNAL( currentIndexChanged( int ) ), this, SLOT( checkDefinitionValid() ) ); |
|
|
connect( mCbxReferencedLayer, SIGNAL( currentIndexChanged( int ) ), this, SLOT( checkDefinitionValid() ) ); |
|
|
connect( mCbxReferencedField, SIGNAL( currentIndexChanged( int ) ), this, SLOT( checkDefinitionValid() ) ); |
|
|
} |
|
|
|
|
|
void QgsRelationAddDlg::addLayers( const QList< QgsVectorLayer* >& layers ) |
|
@@ -65,6 +89,14 @@ void QgsRelationAddDlg::on_mCbxReferencedLayer_currentIndexChanged( int index ) |
|
|
loadLayerAttributes( mCbxReferencedField, mLayers[mCbxReferencedLayer->itemData( index ).toString()] ); |
|
|
} |
|
|
|
|
|
void QgsRelationAddDlg::checkDefinitionValid() |
|
|
{ |
|
|
mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( mCbxReferencedLayer->currentIndex() != -1 |
|
|
&& mCbxReferencedField->currentIndex() != -1 |
|
|
&& mCbxReferencingLayer->currentIndex() != -1 |
|
|
&& mCbxReferencingField->currentIndex() != -1 ); |
|
|
} |
|
|
|
|
|
void QgsRelationAddDlg::loadLayerAttributes( QComboBox* cbx, QgsVectorLayer* layer ) |
|
|
{ |
|
|
cbx->clear(); |
|
|