@@ -95,19 +95,22 @@ void QgsAttributeActionDialog::insertRow( int row, const QgsAction& action )
95
95
item = new QTableWidgetItem ( textForType ( action.type () ) );
96
96
item->setData ( Qt::UserRole, action.type () );
97
97
item->setFlags ( item->flags () & ~Qt::ItemIsEditable );
98
- mAttributeActionTable ->setItem ( row, 0 , item );
98
+ mAttributeActionTable ->setItem ( row, Type , item );
99
99
100
- // Name
101
- mAttributeActionTable ->setItem ( row, 1 , new QTableWidgetItem ( action.name () ) );
100
+ // Description
101
+ mAttributeActionTable ->setItem ( row, Description, new QTableWidgetItem ( action.name () ) );
102
+
103
+ // Short Title
104
+ mAttributeActionTable ->setItem ( row, ShortTitle, new QTableWidgetItem ( action.shortTitle () ) );
102
105
103
106
// Action text
104
- mAttributeActionTable ->setItem ( row, 2 , new QTableWidgetItem ( action.action () ) );
107
+ mAttributeActionTable ->setItem ( row, ActionText , new QTableWidgetItem ( action.action () ) );
105
108
106
109
// Capture output
107
110
item = new QTableWidgetItem ();
108
- item->setFlags ( item->flags () & ~( Qt::ItemIsEditable | Qt::ItemIsUserCheckable ) );
111
+ item->setFlags ( item->flags () & ~( Qt::ItemIsEditable ) );
109
112
item->setCheckState ( action.capture () ? Qt::Checked : Qt::Unchecked );
110
- mAttributeActionTable ->setItem ( row, 3 , item );
113
+ mAttributeActionTable ->setItem ( row, Capture , item );
111
114
112
115
// Icon
113
116
QIcon icon = action.icon ();
@@ -182,11 +185,12 @@ void QgsAttributeActionDialog::swapRows( int row1, int row2 )
182
185
183
186
QgsAction QgsAttributeActionDialog::rowToAction ( int row ) const
184
187
{
185
- QgsAction action ( static_cast <QgsAction::ActionType>( mAttributeActionTable ->item ( row, 0 )->data ( Qt::UserRole ).toInt () ),
186
- mAttributeActionTable ->item ( row, 1 )->text (),
187
- mAttributeActionTable ->item ( row, 2 )->text (),
188
+ QgsAction action ( static_cast <QgsAction::ActionType>( mAttributeActionTable ->item ( row, Type )->data ( Qt::UserRole ).toInt () ),
189
+ mAttributeActionTable ->item ( row, Description )->text (),
190
+ mAttributeActionTable ->item ( row, ActionText )->text (),
188
191
mAttributeActionTable ->verticalHeaderItem ( row )->data ( Qt::UserRole ).toString (),
189
- mAttributeActionTable ->item ( row, 3 )->checkState () == Qt::Checked );
192
+ mAttributeActionTable ->item ( row, Capture )->checkState () == Qt::Checked,
193
+ mAttributeActionTable ->item ( row, ShortTitle )->text () );
190
194
return action;
191
195
}
192
196
@@ -237,7 +241,7 @@ void QgsAttributeActionDialog::insert()
237
241
238
242
if ( dlg.exec () )
239
243
{
240
- QString name = uniqueName ( dlg.name () );
244
+ QString name = uniqueName ( dlg.description () );
241
245
242
246
insertRow ( pos, dlg.type (), name, dlg.actionText (), dlg.iconPath (), dlg.capture () );
243
247
}
@@ -280,23 +284,25 @@ void QgsAttributeActionDialog::itemDoubleClicked( QTableWidgetItem* item )
280
284
int row = item->row ();
281
285
282
286
QgsAttributeActionPropertiesDialog actionProperties (
283
- static_cast <QgsAction::ActionType>( mAttributeActionTable ->item ( row, 0 )->data ( Qt::UserRole ).toInt () ),
284
- mAttributeActionTable ->item ( row, 1 )->text (),
287
+ static_cast <QgsAction::ActionType>( mAttributeActionTable ->item ( row, Type )->data ( Qt::UserRole ).toInt () ),
288
+ mAttributeActionTable ->item ( row, Description )->text (),
289
+ mAttributeActionTable ->item ( row, ShortTitle )->text (),
285
290
mAttributeActionTable ->verticalHeaderItem ( row )->data ( Qt::UserRole ).toString (),
286
- mAttributeActionTable ->item ( row, 2 )->text (),
287
- mAttributeActionTable ->item ( row, 3 )->checkState () == Qt::Checked,
291
+ mAttributeActionTable ->item ( row, ActionText )->text (),
292
+ mAttributeActionTable ->item ( row, Capture )->checkState () == Qt::Checked,
288
293
mLayer
289
294
);
290
295
291
296
actionProperties.setWindowTitle ( tr ( " Edit action" ) );
292
297
293
298
if ( actionProperties.exec () )
294
299
{
295
- mAttributeActionTable ->item ( row, 0 )->setData ( Qt::UserRole, actionProperties.type () );
296
- mAttributeActionTable ->item ( row, 0 )->setText ( textForType ( actionProperties.type () ) );
297
- mAttributeActionTable ->item ( row, 1 )->setText ( actionProperties.name () );
298
- mAttributeActionTable ->item ( row, 2 )->setText ( actionProperties.actionText () );
299
- mAttributeActionTable ->item ( row, 3 )->setCheckState ( actionProperties.capture () ? Qt::Checked : Qt::Unchecked );
300
+ mAttributeActionTable ->item ( row, Type )->setData ( Qt::UserRole, actionProperties.type () );
301
+ mAttributeActionTable ->item ( row, Type )->setText ( textForType ( actionProperties.type () ) );
302
+ mAttributeActionTable ->item ( row, Description )->setText ( actionProperties.description () );
303
+ mAttributeActionTable ->item ( row, ShortTitle )->setText ( actionProperties.shortTitle () );
304
+ mAttributeActionTable ->item ( row, ActionText )->setText ( actionProperties.actionText () );
305
+ mAttributeActionTable ->item ( row, Capture )->setCheckState ( actionProperties.capture () ? Qt::Checked : Qt::Unchecked );
300
306
mAttributeActionTable ->verticalHeaderItem ( row )->setData ( Qt::UserRole, actionProperties.iconPath () );
301
307
mAttributeActionTable ->verticalHeaderItem ( row )->setIcon ( QIcon ( actionProperties.iconPath () ) );
302
308
}
0 commit comments