Skip to content

Commit

Permalink
Improving the "Add/Discover relation" dialogs
Browse files Browse the repository at this point in the history
adding title, tooltips and help button to documentation
  • Loading branch information
DelazJ authored and nyalldawson committed Jul 28, 2020
1 parent 91132af commit 83dba67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/app/qgsdiscoverrelationsdialog.cpp
Expand Up @@ -15,6 +15,7 @@
#include "qgsdiscoverrelationsdialog.h"
#include "qgsvectorlayer.h"
#include "qgsrelationmanager.h"
#include "qgshelp.h"

#include <QPushButton>

Expand All @@ -25,6 +26,11 @@ QgsDiscoverRelationsDialog::QgsDiscoverRelationsDialog( const QList<QgsRelation>
setupUi( this );

mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
mButtonBox->addButton( QDialogButtonBox::Help );
connect( mButtonBox, &QDialogButtonBox::helpRequested, this, [ = ]
{
QgsHelp::openHelp( QStringLiteral( "working_with_vector/attribute_table.html#defining-1-n-relation" ) );
} );
connect( mRelationsTable->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsDiscoverRelationsDialog::onSelectionChanged );

mFoundRelations = QgsRelationManager::discoverRelations( existingRelations, layers );
Expand Down
12 changes: 10 additions & 2 deletions src/app/qgsrelationadddlg.cpp
Expand Up @@ -29,6 +29,7 @@
#include "qgsfieldcombobox.h"
#include "qgsmaplayerproxymodel.h"
#include "qgsapplication.h"
#include "qgshelp.h"



Expand All @@ -43,11 +44,13 @@ QgsFieldPairWidget::QgsFieldPairWidget( int index, QWidget *parent )
mAddButton = new QToolButton( this );
mAddButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/symbologyAdd.svg" ) ) );
mAddButton->setMinimumWidth( 30 );
mAddButton->setToolTip( "Add new fields to pair" );
mLayout->addWidget( mAddButton, 0, Qt::AlignLeft );

mRemoveButton = new QToolButton( this );
mRemoveButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/symbologyRemove.svg" ) ) );
mRemoveButton->setMinimumWidth( 30 );
mRemoveButton->setToolTip( "Remove the last pair of fields" );
mLayout->addWidget( mRemoveButton, 0, Qt::AlignLeft );

mSpacerItem = new QSpacerItem( 30, 30, QSizePolicy::Minimum, QSizePolicy::Maximum );
Expand Down Expand Up @@ -120,7 +123,8 @@ void QgsFieldPairWidget::changeEnable()
QgsRelationAddDlg::QgsRelationAddDlg( QWidget *parent )
: QDialog( parent )
{
QGridLayout *layout = new QGridLayout(); // column 0 is kept free for alignmenent purpose
setWindowTitle( "Add New Relation" );
QGridLayout *layout = new QGridLayout(); // column 0 is kept free for alignment purpose

// row 0: name
// col 1
Expand Down Expand Up @@ -176,9 +180,13 @@ QgsRelationAddDlg::QgsRelationAddDlg( QWidget *parent )
// row 6: button box
mButtonBox = new QDialogButtonBox( this );
mButtonBox->setOrientation( Qt::Horizontal );
mButtonBox->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
mButtonBox->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsRelationAddDlg::accept );
connect( mButtonBox, &QDialogButtonBox::rejected, this, &QgsRelationAddDlg::reject );
connect( mButtonBox, &QDialogButtonBox::helpRequested, this, [ = ]
{
QgsHelp::openHelp( QStringLiteral( "working_with_vector/attribute_table.html#defining-1-n-relations" ) );
} );
layout->addWidget( mButtonBox, 7, 1, 1, 2 );

// set layout
Expand Down

0 comments on commit 83dba67

Please sign in to comment.