mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-07 00:03:52 -05:00
Address PR comments
This commit is contained in:
parent
c27d472e8c
commit
cc8178821a
@ -34,7 +34,7 @@ Utility class that encapsulates an action based on vector attributes.
|
||||
Default constructor
|
||||
%End
|
||||
|
||||
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false );
|
||||
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false);
|
||||
%Docstring
|
||||
Create a new QgsAction
|
||||
|
||||
@ -42,10 +42,9 @@ Create a new QgsAction
|
||||
:param description: A human readable description string
|
||||
:param command: The action text. Its interpretation depends on the type
|
||||
:param capture: If this is set to ``True``, the output will be captured when an action is run
|
||||
:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode. Not available in Python bindings.
|
||||
%End
|
||||
|
||||
QgsAction( ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString() );
|
||||
QgsAction( ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString());
|
||||
%Docstring
|
||||
Create a new QgsAction
|
||||
|
||||
@ -57,10 +56,9 @@ Create a new QgsAction
|
||||
:param shortTitle: A short string used to label user interface elements like buttons
|
||||
:param actionScopes: A set of scopes in which this action will be available
|
||||
:param notificationMessage: A particular message which reception will trigger the action
|
||||
:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode. Not available in Python bindings.
|
||||
%End
|
||||
|
||||
QgsAction( const QUuid &id, ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString() );
|
||||
QgsAction( const QUuid &id, ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString());
|
||||
%Docstring
|
||||
Create a new QgsAction
|
||||
|
||||
@ -73,9 +71,9 @@ Create a new QgsAction
|
||||
:param shortTitle: A short string used to label user interface elements like buttons
|
||||
:param actionScopes: A set of scopes in which this action will be available
|
||||
:param notificationMessage: A particular message which reception will trigger the action
|
||||
:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode. Not available in Python bindings.
|
||||
%End
|
||||
|
||||
|
||||
QString name() const;
|
||||
%Docstring
|
||||
The name of the action. This may be a longer description.
|
||||
|
||||
@ -58,8 +58,7 @@ class CORE_EXPORT QgsAction
|
||||
* \param capture If this is set to TRUE, the output will be captured when an action is run
|
||||
* \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode. Not available in Python bindings.
|
||||
*/
|
||||
#ifndef SIP_RUN
|
||||
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false, bool enabledOnlyWhenEditable = false )
|
||||
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false, bool enabledOnlyWhenEditable SIP_PYARGREMOVE = false )
|
||||
: mType( type )
|
||||
, mDescription( description )
|
||||
, mCommand( command )
|
||||
@ -67,16 +66,6 @@ class CORE_EXPORT QgsAction
|
||||
, mId( QUuid::createUuid() )
|
||||
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
|
||||
{}
|
||||
#else
|
||||
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false )
|
||||
: mType( type )
|
||||
, mDescription( description )
|
||||
, mCommand( command )
|
||||
, mCaptureOutput( capture )
|
||||
, mId( QUuid::createUuid() )
|
||||
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
|
||||
{}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new QgsAction
|
||||
@ -91,8 +80,7 @@ class CORE_EXPORT QgsAction
|
||||
* \param notificationMessage A particular message which reception will trigger the action
|
||||
* \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode. Not available in Python bindings.
|
||||
*/
|
||||
#ifndef SIP_RUN
|
||||
QgsAction( ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString(), bool enabledOnlyWhenEditable = false )
|
||||
QgsAction( ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString(), bool enabledOnlyWhenEditable SIP_PYARGREMOVE = false )
|
||||
: mType( type )
|
||||
, mDescription( description )
|
||||
, mShortTitle( shortTitle )
|
||||
@ -104,20 +92,6 @@ class CORE_EXPORT QgsAction
|
||||
, mId( QUuid::createUuid() )
|
||||
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
|
||||
{}
|
||||
#else
|
||||
QgsAction( ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString() )
|
||||
: mType( type )
|
||||
, mDescription( description )
|
||||
, mShortTitle( shortTitle )
|
||||
, mIcon( icon )
|
||||
, mCommand( action )
|
||||
, mCaptureOutput( capture )
|
||||
, mActionScopes( actionScopes )
|
||||
, mNotificationMessage( notificationMessage )
|
||||
, mId( QUuid::createUuid() )
|
||||
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
|
||||
{}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new QgsAction
|
||||
@ -133,8 +107,7 @@ class CORE_EXPORT QgsAction
|
||||
* \param notificationMessage A particular message which reception will trigger the action
|
||||
* \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode. Not available in Python bindings.
|
||||
*/
|
||||
#ifndef SIP_RUN
|
||||
QgsAction( const QUuid &id, ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString(), bool enabledOnlyWhenEditable = false )
|
||||
QgsAction( const QUuid &id, ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString(), bool enabledOnlyWhenEditable SIP_PYARGREMOVE = false )
|
||||
: mType( type )
|
||||
, mDescription( description )
|
||||
, mShortTitle( shortTitle )
|
||||
@ -146,20 +119,7 @@ class CORE_EXPORT QgsAction
|
||||
, mId( id )
|
||||
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
|
||||
{}
|
||||
#else
|
||||
QgsAction( const QUuid &id, ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString ¬ificationMessage = QString() )
|
||||
: mType( type )
|
||||
, mDescription( description )
|
||||
, mShortTitle( shortTitle )
|
||||
, mIcon( icon )
|
||||
, mCommand( action )
|
||||
, mCaptureOutput( capture )
|
||||
, mActionScopes( actionScopes )
|
||||
, mNotificationMessage( notificationMessage )
|
||||
, mId( id )
|
||||
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
|
||||
{}
|
||||
#endif
|
||||
|
||||
|
||||
//! The name of the action. This may be a longer description.
|
||||
QString name() const { return mDescription; }
|
||||
|
||||
@ -48,7 +48,7 @@ void QgsActionWidgetWrapper::setEnabled( bool enabled )
|
||||
{
|
||||
if ( valid() && layer() )
|
||||
{
|
||||
mActionButton->setEnabled( ! mAction.isEnabledOnlyWhenEditable() || enabled );
|
||||
mActionButton->setEnabled( !mAction.isEnabledOnlyWhenEditable() || enabled );
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ void QgsActionWidgetWrapper::initWidget( QWidget *editor )
|
||||
// Configure push button
|
||||
if ( ! icon.isNull() )
|
||||
{
|
||||
mActionButton->setIcon( mAction.icon() );
|
||||
mActionButton->setIcon( icon );
|
||||
mActionButton->setToolTip( description );
|
||||
}
|
||||
else
|
||||
@ -91,7 +91,7 @@ void QgsActionWidgetWrapper::initWidget( QWidget *editor )
|
||||
}
|
||||
}
|
||||
|
||||
if ( mAction.isEnabledOnlyWhenEditable() && ! layer()->isEditable() )
|
||||
if ( mAction.isEnabledOnlyWhenEditable() && !layer()->isEditable() )
|
||||
{
|
||||
mActionButton->setEnabled( false );
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ void QgsValueRelationWidgetWrapper::showIndeterminateState()
|
||||
{
|
||||
for ( int i = 0; i < nofColumns; ++i )
|
||||
{
|
||||
whileBlocking( mTableWidget ) ->item( j, i )->setCheckState( Qt::PartiallyChecked );
|
||||
whileBlocking( mTableWidget )->item( j, i )->setCheckState( Qt::PartiallyChecked );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,8 +111,8 @@ void QgsAttributeActionDialog::insertRow( int row, const QgsAction &action )
|
||||
|
||||
// Type
|
||||
item = new QTableWidgetItem( textForType( action.type() ) );
|
||||
item->setData( Qt::UserRole, action.type() );
|
||||
item->setData( Qt::UserRole + 1, action.id() );
|
||||
item->setData( Role::ActionType, action.type() );
|
||||
item->setData( Role::ActionId, action.id() );
|
||||
item->setFlags( item->flags() & ~Qt::ItemIsEditable );
|
||||
mAttributeActionTable->setItem( row, Type, item );
|
||||
|
||||
@ -225,9 +225,9 @@ void QgsAttributeActionDialog::swapRows( int row1, int row2 )
|
||||
|
||||
QgsAction QgsAttributeActionDialog::rowToAction( int row ) const
|
||||
{
|
||||
const QUuid id { mAttributeActionTable->item( row, Type )->data( Qt::UserRole + 1 ).toUuid() };
|
||||
const QUuid id { mAttributeActionTable->item( row, Type )->data( Role::ActionId ).toUuid() };
|
||||
QgsAction action( id,
|
||||
static_cast<QgsAction::ActionType>( mAttributeActionTable->item( row, Type )->data( Qt::UserRole ).toInt() ),
|
||||
static_cast<QgsAction::ActionType>( mAttributeActionTable->item( row, Type )->data( Role::ActionType ).toInt() ),
|
||||
mAttributeActionTable->item( row, Description )->text(),
|
||||
mAttributeActionTable->item( row, ActionText )->data( Qt::UserRole ).toString(),
|
||||
mAttributeActionTable->verticalHeaderItem( row )->data( Qt::UserRole ).toString(),
|
||||
@ -334,7 +334,7 @@ void QgsAttributeActionDialog::itemDoubleClicked( QTableWidgetItem *item )
|
||||
const int row = item->row();
|
||||
|
||||
QgsAttributeActionPropertiesDialog actionProperties(
|
||||
static_cast<QgsAction::ActionType>( mAttributeActionTable->item( row, Type )->data( Qt::UserRole ).toInt() ),
|
||||
static_cast<QgsAction::ActionType>( mAttributeActionTable->item( row, Type )->data( Role::ActionType ).toInt() ),
|
||||
mAttributeActionTable->item( row, Description )->text(),
|
||||
mAttributeActionTable->item( row, ShortTitle )->text(),
|
||||
mAttributeActionTable->verticalHeaderItem( row )->data( Qt::UserRole ).toString(),
|
||||
@ -350,7 +350,7 @@ void QgsAttributeActionDialog::itemDoubleClicked( QTableWidgetItem *item )
|
||||
|
||||
if ( actionProperties.exec() )
|
||||
{
|
||||
mAttributeActionTable->item( row, Type )->setData( Qt::UserRole, actionProperties.type() );
|
||||
mAttributeActionTable->item( row, Type )->setData( Role::ActionType, actionProperties.type() );
|
||||
mAttributeActionTable->item( row, Type )->setText( textForType( actionProperties.type() ) );
|
||||
mAttributeActionTable->item( row, Description )->setText( actionProperties.description() );
|
||||
mAttributeActionTable->item( row, ShortTitle )->setText( actionProperties.shortTitle() );
|
||||
|
||||
@ -51,6 +51,13 @@ class GUI_EXPORT QgsAttributeActionDialog: public QWidget, private Ui::QgsAttrib
|
||||
EnabledOnlyWhenEditable
|
||||
};
|
||||
|
||||
//! UserRole for Type data
|
||||
enum Role
|
||||
{
|
||||
ActionType = Qt::UserRole,
|
||||
ActionId = Qt::UserRole + 1
|
||||
};
|
||||
|
||||
public:
|
||||
QgsAttributeActionDialog( const QgsActionManager &actions,
|
||||
QWidget *parent = nullptr );
|
||||
|
||||
@ -588,7 +588,7 @@ void QgsAttributesFormProperties::loadAttributeSpecificEditor( QgsAttributesDnDT
|
||||
}
|
||||
case DnDTreeItemData::Action:
|
||||
{
|
||||
receiver->clearSelection();
|
||||
receiver->selectFirstMatchingItem( itemData );
|
||||
break;
|
||||
}
|
||||
case DnDTreeItemData::QmlWidget:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user