Skip to content
Permalink
Browse files

Improving the "Add/Discover relation" dialogs

adding title, tooltips and help button to documentation
  • Loading branch information
DelazJ authored and nyalldawson committed Jul 28, 2020
1 parent 91132af commit 83dba6786c0513228f57b6a497a4a06d50f14838
Showing with 16 additions and 2 deletions.
  1. +6 −0 src/app/qgsdiscoverrelationsdialog.cpp
  2. +10 −2 src/app/qgsrelationadddlg.cpp
@@ -15,6 +15,7 @@
#include "qgsdiscoverrelationsdialog.h"
#include "qgsvectorlayer.h"
#include "qgsrelationmanager.h"
#include "qgshelp.h"

#include <QPushButton>

@@ -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 );
@@ -29,6 +29,7 @@
#include "qgsfieldcombobox.h"
#include "qgsmaplayerproxymodel.h"
#include "qgsapplication.h"
#include "qgshelp.h"



@@ -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 );
@@ -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
@@ -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

0 comments on commit 83dba67

Please sign in to comment.
You can’t perform that action at this time.