Skip to content

Commit

Permalink
[Relation Reference Widget] allow removing open form button (option n…
Browse files Browse the repository at this point in the history
…ot available in QGIS)
  • Loading branch information
3nids committed Sep 15, 2014
1 parent 98e0023 commit e1cb437
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/gui/qgsrelationreferencewidget.sip
Expand Up @@ -29,15 +29,18 @@ class QgsRelationReferenceWidget : QWidget

void setEditorContext( QgsAttributeEditorContext context, QgsMapCanvas* canvas, QgsMessageBar* messageBar );

bool embedForm() {return mEmbedForm;}
bool embedForm();
void setEmbedForm( bool display );

bool readOnlySelector() {return mReadOnlySelector;}
bool readOnlySelector();
void setReadOnlySelector( bool readOnly );

bool allowMapIdentification() {return mAllowMapIdentification;}
bool allowMapIdentification();
void setAllowMapIdentification( bool allowMapIdentification );

bool openFormButtonVisible();
void setOpenFormButtonVisible( bool openFormButtonVisible );

protected:
virtual void showEvent( QShowEvent* e );

Expand Down
7 changes: 7 additions & 0 deletions src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Expand Up @@ -55,6 +55,7 @@ QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
, mEmbedForm( false )
, mReadOnlySelector( false )
, mAllowMapIdentification( false )
, mOpenFormButtonVisible( true )
{
mTopLayout = new QVBoxLayout( this );
mTopLayout->setContentsMargins( 0, 0, 0, 0 );
Expand Down Expand Up @@ -350,6 +351,12 @@ void QgsRelationReferenceWidget::setAllowMapIdentification( bool allowMapIdentif
mAllowMapIdentification = allowMapIdentification;
}

void QgsRelationReferenceWidget::setOpenFormButtonVisible(bool openFormButtonVisible)
{
mOpenFormButton->setVisible(openFormButtonVisible);
mOpenFormButtonVisible = openFormButtonVisible;
}

void QgsRelationReferenceWidget::showEvent( QShowEvent* e )
{
Q_UNUSED( e )
Expand Down
5 changes: 5 additions & 0 deletions src/gui/editorwidgets/qgsrelationreferencewidget.h
Expand Up @@ -33,6 +33,7 @@ class QgsVectorLayerTools;
class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY( bool openFormButtonVisible READ openFormButtonVisible WRITE setOpenFormButtonVisible )

public:
enum CanvasExtent
Expand Down Expand Up @@ -67,6 +68,9 @@ class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
bool allowMapIdentification() {return mAllowMapIdentification;}
void setAllowMapIdentification( bool allowMapIdentification );

bool openFormButtonVisible() {return mOpenFormButtonVisible;}
void setOpenFormButtonVisible( bool openFormButtonVisible );

protected:
virtual void showEvent( QShowEvent* e );

Expand Down Expand Up @@ -114,6 +118,7 @@ class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
bool mEmbedForm;
bool mReadOnlySelector;
bool mAllowMapIdentification;
bool mOpenFormButtonVisible;

// UI
QVBoxLayout* mTopLayout;
Expand Down

0 comments on commit e1cb437

Please sign in to comment.