QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsconfigureshortcutsdialog.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsconfigureshortcutsdialog.cpp
3 -------------------------------
4 begin : May 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17#include "moc_qgsconfigureshortcutsdialog.cpp"
18
19#include "qgsshortcutsmanager.h"
20#include "qgsapplication.h"
21#include "qgslogger.h"
22#include "qgssettings.h"
23#include "qgsgui.h"
24#include "qgsprojectversion.h"
25
26#include <QKeyEvent>
27#include <QKeySequence>
28#include <QMessageBox>
29#include <QShortcut>
30#include <QDomDocument>
31#include <QFileDialog>
32#include <QTextStream>
33#include <QMenu>
34#include <QAction>
35#include <QPdfWriter>
36#include <QTextDocument>
37#include <QTextCursor>
38#include <QTextTable>
39#include <QTextTableFormat>
40#include <QTextTableCellFormat>
41#include <QTextCharFormat>
42
44 : QDialog( parent )
45 , mManager( manager )
46{
47 setupUi( this );
49
50 mSaveMenu = new QMenu( this );
51 mSaveUserShortcuts = new QAction( tr( "Save User Shortcuts…" ), this );
52 mSaveMenu->addAction( mSaveUserShortcuts );
53 connect( mSaveUserShortcuts, &QAction::triggered, this, [this] { saveShortcuts( false ); } );
54
55 mSaveAllShortcuts = new QAction( tr( "Save All Shortcuts…" ), this );
56 mSaveMenu->addAction( mSaveAllShortcuts );
57 connect( mSaveAllShortcuts, &QAction::triggered, this, [this] { saveShortcuts(); } );
58
59 mSaveAsPdf = new QAction( tr( "Save as PDF…" ), this );
60 mSaveMenu->addAction( mSaveAsPdf );
61 connect( mSaveAsPdf, &QAction::triggered, this, &QgsConfigureShortcutsDialog::saveShortcutsPdf );
62
63 btnSaveShortcuts->setMenu( mSaveMenu );
64
65 connect( mLeFilter, &QgsFilterLineEdit::textChanged, this, &QgsConfigureShortcutsDialog::mLeFilter_textChanged );
66
67 if ( !mManager )
68 mManager = QgsGui::shortcutsManager();
69
70 connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsConfigureShortcutsDialog::showHelp ); // Vérifier nommage des boutons
71 connect( btnChangeShortcut, &QAbstractButton::clicked, this, &QgsConfigureShortcutsDialog::changeShortcut );
72 connect( btnResetShortcut, &QAbstractButton::clicked, this, &QgsConfigureShortcutsDialog::resetShortcut );
73 connect( btnSetNoShortcut, &QAbstractButton::clicked, this, &QgsConfigureShortcutsDialog::setNoShortcut );
74 connect( btnLoadShortcuts, &QAbstractButton::clicked, this, &QgsConfigureShortcutsDialog::loadShortcuts );
75
76 connect( treeActions, &QTreeWidget::currentItemChanged, this, &QgsConfigureShortcutsDialog::actionChanged );
77
78 populateActions();
79}
80
81void QgsConfigureShortcutsDialog::populateActions()
82{
83 const QList<QObject *> objects = mManager->listAll();
84
85 QList<QTreeWidgetItem *> items;
86 items.reserve( objects.count() );
87 const auto constObjects = objects;
88 for ( QObject *obj : constObjects )
89 {
90 QString actionText;
91 QString sequence;
92 QIcon icon;
93 const QString settingKey = mManager->objectSettingKey( obj );
94
95 if ( QAction *action = qobject_cast<QAction *>( obj ) )
96 {
97 actionText = action->text();
98 actionText.remove( '&' ); // remove the accelerator
99 sequence = action->shortcut().toString( QKeySequence::NativeText );
100 icon = action->icon();
101 }
102 else if ( QShortcut *shortcut = qobject_cast<QShortcut *>( obj ) )
103 {
104 actionText = shortcut->whatsThis();
105 sequence = shortcut->key().toString( QKeySequence::NativeText );
106 icon = shortcut->property( "Icon" ).value<QIcon>();
107 }
108 else
109 {
110 continue;
111 }
112
113 if ( actionText.isEmpty() )
114 {
115 continue;
116 }
117
118 QStringList lst;
119 lst << actionText << sequence;
120 QTreeWidgetItem *item = new QTreeWidgetItem( lst );
121 item->setIcon( 0, icon );
122 item->setData( 0, Qt::UserRole, QVariant::fromValue( obj ) );
123 item->setToolTip( 0, settingKey );
124 items.append( item );
125 }
126
127 treeActions->addTopLevelItems( items );
128
129 // make sure everything's visible and sorted
130 treeActions->resizeColumnToContents( 0 );
131 treeActions->sortItems( 0, Qt::AscendingOrder );
132
133 actionChanged( treeActions->currentItem(), nullptr );
134}
135
136void QgsConfigureShortcutsDialog::saveShortcuts( bool saveAll )
137{
138 QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Shortcuts" ), QDir::homePath(), tr( "XML file" ) + " (*.xml);;" + tr( "All files" ) + " (*)" );
139 // return dialog focus on Mac
140 activateWindow();
141 raise();
142
143 if ( fileName.isEmpty() )
144 return;
145
146 // ensure the user never omitted the extension from the file name
147 if ( !fileName.endsWith( QLatin1String( ".xml" ), Qt::CaseInsensitive ) )
148 {
149 fileName += QLatin1String( ".xml" );
150 }
151
152 QFile file( fileName );
153 if ( !file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) )
154 {
155 QMessageBox::warning( this, tr( "Saving Shortcuts" ), tr( "Cannot write file %1:\n%2." ).arg( fileName, file.errorString() ) );
156 return;
157 }
158
159 QgsSettings settings;
160
161 QDomDocument doc( QStringLiteral( "shortcuts" ) );
162 QDomElement root = doc.createElement( QStringLiteral( "qgsshortcuts" ) );
163 root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.1" ) );
164 root.setAttribute( QStringLiteral( "locale" ), settings.value( QgsApplication::settingsLocaleUserLocale->key(), "en_US" ).toString() );
165 doc.appendChild( root );
166
167 const QList<QObject *> objects = mManager->listAll();
168 for ( QObject *obj : objects )
169 {
170 QString actionText;
171 QString actionShortcut;
172 QString actionSettingKey;
173 QKeySequence sequence;
174
175 if ( QAction *action = qobject_cast<QAction *>( obj ) )
176 {
177 actionText = action->text().remove( '&' );
178 actionShortcut = action->shortcut().toString( QKeySequence::NativeText );
179 sequence = mManager->defaultKeySequence( action );
180 }
181 else if ( QShortcut *shortcut = qobject_cast<QShortcut *>( obj ) )
182 {
183 actionText = shortcut->whatsThis();
184 actionShortcut = shortcut->key().toString( QKeySequence::NativeText );
185 sequence = mManager->defaultKeySequence( shortcut );
186 }
187 else
188 {
189 continue;
190 }
191
192 actionSettingKey = mManager->objectSettingKey( obj );
193
194 if ( actionSettingKey.isEmpty() )
195 {
196 continue;
197 }
198
199 // skip unchanged shortcuts if only user-definied were requested
200 if ( !saveAll && sequence == QKeySequence( actionShortcut ) )
201 {
202 continue;
203 }
204
205 QDomElement el = doc.createElement( QStringLiteral( "action" ) );
206 el.setAttribute( QStringLiteral( "name" ), actionText );
207 el.setAttribute( QStringLiteral( "shortcut" ), actionShortcut );
208 el.setAttribute( QStringLiteral( "setting" ), actionSettingKey );
209 root.appendChild( el );
210 }
211
212 QTextStream out( &file );
213 doc.save( out, 4 );
214}
215
216void QgsConfigureShortcutsDialog::loadShortcuts()
217{
218 const QString fileName = QFileDialog::getOpenFileName( this, tr( "Load Shortcuts" ), QDir::homePath(), tr( "XML file" ) + " (*.xml);;" + tr( "All files" ) + " (*)" );
219
220 if ( fileName.isEmpty() )
221 {
222 return;
223 }
224
225 QFile file( fileName );
226 if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
227 {
228 QMessageBox::warning( this, tr( "Loading Shortcuts" ), tr( "Cannot read file %1:\n%2." ).arg( fileName, file.errorString() ) );
229 return;
230 }
231
232 QDomDocument doc;
233 QString errorStr;
234 int errorLine;
235 int errorColumn;
236
237 if ( !doc.setContent( &file, true, &errorStr, &errorLine, &errorColumn ) )
238 {
239 QMessageBox::information( this, tr( "Loading Shortcuts" ), tr( "Parse error at line %1, column %2:\n%3" ).arg( errorLine ).arg( errorColumn ).arg( errorStr ) );
240 return;
241 }
242
243 const QDomElement root = doc.documentElement();
244 if ( root.tagName() != QLatin1String( "qgsshortcuts" ) )
245 {
246 QMessageBox::information( this, tr( "Loading Shortcuts" ), tr( "The file is not an shortcuts exchange file." ) );
247 return;
248 }
249
250 QString currentLocale;
251
252 const bool localeOverrideFlag = QgsApplication::settingsLocaleOverrideFlag->value();
253 if ( localeOverrideFlag )
254 {
256 }
257 else // use QGIS locale
258 {
259 currentLocale = QLocale().name();
260 }
261
262 const QString versionStr = root.attribute( QStringLiteral( "version" ) );
263 const QgsProjectVersion version( versionStr );
264
265 if ( root.attribute( QStringLiteral( "locale" ) ) != currentLocale )
266 {
267 if ( version < QgsProjectVersion( QStringLiteral( "1.1" ) ) )
268 {
269 QMessageBox::information( this, tr( "Loading Shortcuts" ), tr( "The file contains shortcuts created with different locale, so you can't use it." ) );
270 return;
271 }
272 else // From version 1.1, if objectName is not empty, it is used as key.
273 {
274 QMessageBox::information( this, tr( "Loading Shortcuts" ), tr( "The file contains shortcuts created with different locale, so some shortcuts may not work." ) );
275 }
276 }
277
278 QString actionName;
279 QString actionShortcut;
280 QString actionSettingKey;
281
282 QDomElement child = root.firstChildElement();
283 while ( !child.isNull() )
284 {
285 actionShortcut = child.attribute( QStringLiteral( "shortcut" ) );
286 if ( version < QgsProjectVersion( QStringLiteral( "1.1" ) ) )
287 {
288 actionName = child.attribute( QStringLiteral( "name" ) );
289 mManager->setKeySequence( actionName, actionShortcut );
290 }
291 else
292 {
293 actionSettingKey = child.attribute( QStringLiteral( "setting" ) );
294 QObject *obj = mManager->objectForSettingKey( actionSettingKey );
295 if ( obj )
296 mManager->setObjectKeySequence( obj, actionShortcut );
297 }
298
299 child = child.nextSiblingElement();
300 }
301
302 treeActions->clear();
303 populateActions();
304}
305
306void QgsConfigureShortcutsDialog::changeShortcut()
307{
308 setFocus(); // make sure we have focus
309 setGettingShortcut( true );
310}
311
312void QgsConfigureShortcutsDialog::resetShortcut()
313{
314 QObject *object = currentObject();
315 const QString sequence = mManager->objectDefaultKeySequence( object );
316 setCurrentActionShortcut( sequence );
317}
318
319void QgsConfigureShortcutsDialog::setNoShortcut()
320{
321 setCurrentActionShortcut( QKeySequence() );
322}
323
324QAction *QgsConfigureShortcutsDialog::currentAction()
325{
326 return qobject_cast<QAction *>( currentObject() );
327}
328
329QShortcut *QgsConfigureShortcutsDialog::currentShortcut()
330{
331 return qobject_cast<QShortcut *>( currentObject() );
332}
333
334void QgsConfigureShortcutsDialog::actionChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous )
335{
336 Q_UNUSED( current )
337 Q_UNUSED( previous )
338 // cancel previous shortcut setting (if any)
339 setGettingShortcut( false );
340
341 QString shortcut;
342 QKeySequence sequence;
343 if ( QAction *action = currentAction() )
344 {
345 // show which one is the default action
346 shortcut = mManager->defaultKeySequence( action );
347 sequence = action->shortcut();
348 }
349 else if ( QShortcut *object = currentShortcut() )
350 {
351 // show which one is the default action
352 shortcut = mManager->defaultKeySequence( object );
353 sequence = object->key();
354 }
355 else
356 {
357 return;
358 }
359
360 if ( shortcut.isEmpty() )
361 shortcut = tr( "None" );
362 btnResetShortcut->setText( tr( "Set default (%1)" ).arg( shortcut ) );
363
364 // if there's no shortcut, disable set none
365 btnSetNoShortcut->setEnabled( !sequence.isEmpty() );
366 // if the shortcut is default, disable set default
367 btnResetShortcut->setEnabled( sequence != QKeySequence( shortcut ) );
368}
369
371{
372 if ( !mGettingShortcut )
373 {
374 QDialog::keyPressEvent( event );
375 return;
376 }
377
378 const int key = event->key();
379 switch ( key )
380 {
381 // modifiers
382 case Qt::Key_Meta:
383 mModifiers |= Qt::META;
384 updateShortcutText();
385 break;
386 case Qt::Key_Alt:
387 mModifiers |= Qt::ALT;
388 updateShortcutText();
389 break;
390 case Qt::Key_Control:
391 mModifiers |= Qt::CTRL;
392 updateShortcutText();
393 break;
394 case Qt::Key_Shift:
395 mModifiers |= Qt::SHIFT;
396 updateShortcutText();
397 break;
398
399 // escape aborts the acquisition of shortcut
400 case Qt::Key_Escape:
401 setGettingShortcut( false );
402 break;
403
404 default:
405 mKey = key;
406 updateShortcutText();
407 }
408}
409
411{
412 if ( !mGettingShortcut )
413 {
414 QDialog::keyReleaseEvent( event );
415 return;
416 }
417
418 const int key = event->key();
419 switch ( key )
420 {
421 // modifiers
422 case Qt::Key_Meta:
423 mModifiers &= ~Qt::META;
424 updateShortcutText();
425 break;
426 case Qt::Key_Alt:
427 mModifiers &= ~Qt::ALT;
428 updateShortcutText();
429 break;
430 case Qt::Key_Control:
431 mModifiers &= ~Qt::CTRL;
432 updateShortcutText();
433 break;
434 case Qt::Key_Shift:
435 mModifiers &= ~Qt::SHIFT;
436 updateShortcutText();
437 break;
438
439 case Qt::Key_Escape:
440 break;
441
442 default:
443 {
444 // an ordinary key - set it with modifiers as a shortcut
445 setCurrentActionShortcut( QKeySequence( mModifiers + mKey ) );
446 setGettingShortcut( false );
447 }
448 }
449}
450
451QObject *QgsConfigureShortcutsDialog::currentObject()
452{
453 if ( !treeActions->currentItem() )
454 return nullptr;
455
456 QObject *object = treeActions->currentItem()->data( 0, Qt::UserRole ).value<QObject *>();
457 return object;
458}
459
460void QgsConfigureShortcutsDialog::updateShortcutText()
461{
462 // update text of the button so that user can see what has typed already
463 const QKeySequence s( mModifiers + mKey );
464 btnChangeShortcut->setText( tr( "Input: " ) + s.toString( QKeySequence::NativeText ) );
465}
466
467void QgsConfigureShortcutsDialog::setGettingShortcut( bool getting )
468{
469 mModifiers = 0;
470 mKey = 0;
471 mGettingShortcut = getting;
472 if ( !getting )
473 {
474 btnChangeShortcut->setChecked( false );
475 btnChangeShortcut->setText( tr( "Change" ) );
476 }
477 else
478 {
479 updateShortcutText();
480 }
481}
482
483void QgsConfigureShortcutsDialog::setCurrentActionShortcut( const QKeySequence &s )
484{
485 QObject *object = currentObject();
486 if ( !object )
487 return;
488
489 // first check whether this action is not taken already
490 QObject *otherObject = mManager->objectForSequence( s );
491 if ( otherObject == object )
492 return;
493
494 if ( otherObject )
495 {
496 QString otherText;
497 if ( QAction *otherAction = qobject_cast<QAction *>( otherObject ) )
498 {
499 otherText = otherAction->text();
500 otherText.remove( '&' ); // remove the accelerator
501 }
502 else if ( QShortcut *otherShortcut = qobject_cast<QShortcut *>( otherObject ) )
503 {
504 otherText = otherShortcut->whatsThis();
505 }
506
507 const int res = QMessageBox::question( this, tr( "Change Shortcut" ), tr( "This shortcut is already assigned to action %1. Reassign?" ).arg( otherText ), QMessageBox::Yes | QMessageBox::No );
508
509 if ( res != QMessageBox::Yes )
510 return;
511
512 // reset action of the conflicting other action!
513 mManager->setObjectKeySequence( otherObject, QString() );
514 QList<QTreeWidgetItem *> items = treeActions->findItems( otherText, Qt::MatchExactly );
515 if ( !items.isEmpty() ) // there should be exactly one
516 items[0]->setText( 1, QString() );
517 }
518
519 // update manager
520 mManager->setObjectKeySequence( object, s.toString( QKeySequence::NativeText ) );
521
522 // update gui
523 treeActions->currentItem()->setText( 1, s.toString( QKeySequence::NativeText ) );
524
525 actionChanged( treeActions->currentItem(), nullptr );
526}
527
528void QgsConfigureShortcutsDialog::mLeFilter_textChanged( const QString &text )
529{
530 for ( int i = 0; i < treeActions->topLevelItemCount(); i++ )
531 {
532 QTreeWidgetItem *item = treeActions->topLevelItem( i );
533 if ( !item->text( 0 ).contains( text, Qt::CaseInsensitive ) && !item->text( 1 ).contains( text, Qt::CaseInsensitive ) )
534 {
535 item->setHidden( true );
536 }
537 else
538 {
539 item->setHidden( false );
540 }
541 }
542}
543
544void QgsConfigureShortcutsDialog::showHelp()
545{
546 QgsHelp::openHelp( QStringLiteral( "introduction/qgis_configuration.html#shortcuts" ) );
547}
548
549void QgsConfigureShortcutsDialog::saveShortcutsPdf()
550{
551 QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Shortcuts" ), QDir::homePath(), tr( "PDF file" ) + " (*.pdf);;" + tr( "All files" ) + " (*)" );
552 // return dialog focus on Mac
553 activateWindow();
554 raise();
555
556 if ( fileName.isEmpty() )
557 return;
558
559 if ( !fileName.endsWith( QLatin1String( ".pdf" ), Qt::CaseInsensitive ) )
560 {
561 fileName += QLatin1String( ".pdf" );
562 }
563
564 QTextDocument *document = new QTextDocument;
565 QTextCursor cursor( document );
566
567 QTextTableFormat tableFormat;
568 tableFormat.setBorder( 0 );
569 tableFormat.setCellSpacing( 0 );
570 tableFormat.setCellPadding( 4 );
571 tableFormat.setHeaderRowCount( 1 );
572
573 QVector<QTextLength> constraints;
574 constraints << QTextLength( QTextLength::PercentageLength, 5 );
575 constraints << QTextLength( QTextLength::PercentageLength, 80 );
576 constraints << QTextLength( QTextLength::PercentageLength, 15 );
577 tableFormat.setColumnWidthConstraints( constraints );
578
579 QTextTableCellFormat headerFormat;
580 headerFormat.setFontWeight( QFont::Bold );
581 headerFormat.setBottomPadding( 4 );
582
583 QTextCharFormat rowFormat;
584 rowFormat.setVerticalAlignment( QTextCharFormat::AlignMiddle );
585
586 QTextCharFormat altRowFormat;
587 altRowFormat.setBackground( QBrush( QColor( 238, 238, 236 ) ) );
588 altRowFormat.setVerticalAlignment( QTextCharFormat::AlignMiddle );
589
590 int row = 0;
591 QTextTable *table = cursor.insertTable( 1, 3, tableFormat );
592 table->mergeCells( 0, 0, 1, 2 );
593 QTextCursor c = table->cellAt( row, 0 ).firstCursorPosition();
594 c.setCharFormat( headerFormat );
595 c.insertText( tr( "Action" ) );
596 c = table->cellAt( row, 2 ).firstCursorPosition();
597 c.setCharFormat( headerFormat );
598 c.insertText( tr( "Shortcut" ) );
599
600 const QList<QObject *> objects = mManager->listAll();
601 for ( QObject *obj : objects )
602 {
603 QString actionText;
604 QString sequence;
605 QIcon icon;
606
607 if ( QAction *action = qobject_cast<QAction *>( obj ) )
608 {
609 actionText = action->text().remove( '&' );
610 sequence = action->shortcut().toString( QKeySequence::NativeText );
611 icon = action->icon();
612 }
613 else if ( QShortcut *shortcut = qobject_cast<QShortcut *>( obj ) )
614 {
615 actionText = shortcut->whatsThis();
616 sequence = shortcut->key().toString( QKeySequence::NativeText );
617 icon = shortcut->property( "Icon" ).value<QIcon>();
618 }
619 else
620 {
621 continue;
622 }
623
624 // skip actions without shortcut and name
625 if ( actionText.isEmpty() || sequence.isEmpty() )
626 {
627 continue;
628 }
629
630 row += 1;
631 table->appendRows( 1 );
632
633 if ( row % 2 )
634 {
635 table->cellAt( row, 0 ).setFormat( altRowFormat );
636 table->cellAt( row, 1 ).setFormat( altRowFormat );
637 table->cellAt( row, 2 ).setFormat( altRowFormat );
638 }
639 else
640 {
641 table->cellAt( row, 0 ).setFormat( rowFormat );
642 table->cellAt( row, 1 ).setFormat( rowFormat );
643 table->cellAt( row, 2 ).setFormat( rowFormat );
644 }
645
646 if ( !icon.isNull() )
647 {
648 c = table->cellAt( row, 0 ).firstCursorPosition();
649 c.insertImage( icon.pixmap( QSize( 24, 24 ) ).toImage() );
650 }
651 table->cellAt( row, 1 ).firstCursorPosition().insertText( actionText );
652 table->cellAt( row, 2 ).firstCursorPosition().insertText( sequence );
653 }
654
655 QPdfWriter pdfWriter( fileName );
656 pdfWriter.setPageLayout( QPageLayout( QPageSize( QPageSize::A4 ), QPageLayout::Portrait, QMarginsF( 20, 10, 10, 10 ) ) );
657 document->setPageSize( QSizeF( pdfWriter.pageLayout().fullRect( QPageLayout::Point ).size() ) );
658 document->print( &pdfWriter );
659}
static const QgsSettingsEntryBool * settingsLocaleOverrideFlag
Settings entry locale override flag.
static const QgsSettingsEntryString * settingsLocaleUserLocale
Settings entry locale user locale.
QgsConfigureShortcutsDialog(QWidget *parent=nullptr, QgsShortcutsManager *manager=nullptr)
Constructor for QgsConfigureShortcutsDialog.
void keyReleaseEvent(QKeyEvent *event) override
void keyPressEvent(QKeyEvent *event) override
static QgsShortcutsManager * shortcutsManager()
Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.
Definition qgsgui.cpp:125
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
Definition qgsgui.cpp:210
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Definition qgshelp.cpp:39
A class to describe the version of a project.
T valueWithDefaultOverride(const T &defaultValueOverride, const QString &dynamicKeyPart=QString()) const
Returns the settings value with a defaultValueOverride and with an optional dynamicKeyPart.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
QString key(const QString &dynamicKeyPart=QString()) const
Returns settings entry key.
This class is a composition of two QSettings instances:
Definition qgssettings.h:64
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
Shortcuts manager is a class that contains a list of QActions and QShortcuts that have been registere...
bool setKeySequence(const QString &name, const QString &sequence)
Modifies an action or shortcut's key sequence.
QList< QObject * > listAll() const
Returns a list of both actions and shortcuts in the manager.
QObject * objectForSettingKey(const QString &name) const
Returns the QShortcut or QAction matching the the full setting key Return nullptr if the key was not ...
QString objectDefaultKeySequence(QObject *object) const
Returns the default sequence for an object (either a QAction or QShortcut).
QString defaultKeySequence(QAction *action) const
Returns the default sequence for an action.
bool setObjectKeySequence(QObject *object, const QString &sequence)
Modifies an object's (either a QAction or a QShortcut) key sequence.
QString objectSettingKey(QObject *object) const
Returns the full settings key matching the QShortcut or QAction Return an empty QString if the QObjec...
QObject * objectForSequence(const QKeySequence &sequence) const
Returns the object (QAction or QShortcut) matching the specified key sequence,.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c