QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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,
77 this, &QgsConfigureShortcutsDialog::actionChanged );
78
79 populateActions();
80}
81
82void QgsConfigureShortcutsDialog::populateActions()
83{
84 const QList<QObject *> objects = mManager->listAll();
85
86 QList<QTreeWidgetItem *> items;
87 items.reserve( objects.count() );
88 const auto constObjects = objects;
89 for ( QObject *obj : constObjects )
90 {
91 QString actionText;
92 QString sequence;
93 QIcon icon;
94 const QString settingKey = mManager->objectSettingKey( obj );
95
96 if ( QAction *action = qobject_cast< QAction * >( obj ) )
97 {
98 actionText = action->text();
99 actionText.remove( '&' ); // remove the accelerator
100 sequence = action->shortcut().toString( QKeySequence::NativeText );
101 icon = action->icon();
102 }
103 else if ( QShortcut *shortcut = qobject_cast< QShortcut * >( obj ) )
104 {
105 actionText = shortcut->whatsThis();
106 sequence = shortcut->key().toString( QKeySequence::NativeText );
107 icon = shortcut->property( "Icon" ).value<QIcon>();
108 }
109 else
110 {
111 continue;
112 }
113
114 if ( actionText.isEmpty() )
115 {
116 continue;
117 }
118
119 QStringList lst;
120 lst << actionText << sequence;
121 QTreeWidgetItem *item = new QTreeWidgetItem( lst );
122 item->setIcon( 0, icon );
123 item->setData( 0, Qt::UserRole, QVariant::fromValue( obj ) );
124 item->setToolTip( 0, settingKey );
125 items.append( item );
126 }
127
128 treeActions->addTopLevelItems( items );
129
130 // make sure everything's visible and sorted
131 treeActions->resizeColumnToContents( 0 );
132 treeActions->sortItems( 0, Qt::AscendingOrder );
133
134 actionChanged( treeActions->currentItem(), nullptr );
135}
136
137void QgsConfigureShortcutsDialog::saveShortcuts( bool saveAll )
138{
139 QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Shortcuts" ), QDir::homePath(),
140 tr( "XML file" ) + " (*.xml);;" + tr( "All files" ) + " (*)" );
141 // return dialog focus on Mac
142 activateWindow();
143 raise();
144
145 if ( fileName.isEmpty() )
146 return;
147
148 // ensure the user never omitted the extension from the file name
149 if ( !fileName.endsWith( QLatin1String( ".xml" ), Qt::CaseInsensitive ) )
150 {
151 fileName += QLatin1String( ".xml" );
152 }
153
154 QFile file( fileName );
155 if ( !file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) )
156 {
157 QMessageBox::warning( this, tr( "Saving Shortcuts" ),
158 tr( "Cannot write file %1:\n%2." )
159 .arg( fileName,
160 file.errorString() ) );
161 return;
162 }
163
164 QgsSettings settings;
165
166 QDomDocument doc( QStringLiteral( "shortcuts" ) );
167 QDomElement root = doc.createElement( QStringLiteral( "qgsshortcuts" ) );
168 root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.1" ) );
169 root.setAttribute( QStringLiteral( "locale" ), settings.value( QgsApplication::settingsLocaleUserLocale->key(), "en_US" ).toString() );
170 doc.appendChild( root );
171
172 const QList<QObject *> objects = mManager->listAll();
173 for ( QObject *obj : objects )
174 {
175 QString actionText;
176 QString actionShortcut;
177 QString actionSettingKey;
178 QKeySequence sequence;
179
180 if ( QAction *action = qobject_cast< QAction * >( obj ) )
181 {
182 actionText = action->text().remove( '&' );
183 actionShortcut = action->shortcut().toString( QKeySequence::NativeText );
184 sequence = mManager->defaultKeySequence( action );
185 }
186 else if ( QShortcut *shortcut = qobject_cast< QShortcut * >( obj ) )
187 {
188 actionText = shortcut->whatsThis();
189 actionShortcut = shortcut->key().toString( QKeySequence::NativeText );
190 sequence = mManager->defaultKeySequence( shortcut );
191 }
192 else
193 {
194 continue;
195 }
196
197 actionSettingKey = mManager->objectSettingKey( obj );
198
199 if ( actionSettingKey.isEmpty() )
200 {
201 continue;
202 }
203
204 // skip unchanged shortcuts if only user-definied were requested
205 if ( !saveAll && sequence == QKeySequence( actionShortcut ) )
206 {
207 continue;
208 }
209
210 QDomElement el = doc.createElement( QStringLiteral( "action" ) );
211 el.setAttribute( QStringLiteral( "name" ), actionText );
212 el.setAttribute( QStringLiteral( "shortcut" ), actionShortcut );
213 el.setAttribute( QStringLiteral( "setting" ), actionSettingKey );
214 root.appendChild( el );
215 }
216
217 QTextStream out( &file );
218 doc.save( out, 4 );
219}
220
221void QgsConfigureShortcutsDialog::loadShortcuts()
222{
223 const QString fileName = QFileDialog::getOpenFileName( this, tr( "Load Shortcuts" ), QDir::homePath(),
224 tr( "XML file" ) + " (*.xml);;" + tr( "All files" ) + " (*)" );
225
226 if ( fileName.isEmpty() )
227 {
228 return;
229 }
230
231 QFile file( fileName );
232 if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
233 {
234 QMessageBox::warning( this, tr( "Loading Shortcuts" ),
235 tr( "Cannot read file %1:\n%2." )
236 .arg( fileName,
237 file.errorString() ) );
238 return;
239 }
240
241 QDomDocument doc;
242 QString errorStr;
243 int errorLine;
244 int errorColumn;
245
246 if ( !doc.setContent( &file, true, &errorStr, &errorLine, &errorColumn ) )
247 {
248 QMessageBox::information( this, tr( "Loading Shortcuts" ),
249 tr( "Parse error at line %1, column %2:\n%3" )
250 .arg( errorLine )
251 .arg( errorColumn )
252 .arg( errorStr ) );
253 return;
254 }
255
256 const QDomElement root = doc.documentElement();
257 if ( root.tagName() != QLatin1String( "qgsshortcuts" ) )
258 {
259 QMessageBox::information( this, tr( "Loading Shortcuts" ),
260 tr( "The file is not an shortcuts exchange file." ) );
261 return;
262 }
263
264 QString currentLocale;
265
266 const bool localeOverrideFlag = QgsApplication::settingsLocaleOverrideFlag->value();
267 if ( localeOverrideFlag )
268 {
270 }
271 else // use QGIS locale
272 {
273 currentLocale = QLocale().name();
274 }
275
276 const QString versionStr = root.attribute( QStringLiteral( "version" ) );
277 const QgsProjectVersion version( versionStr );
278
279 if ( root.attribute( QStringLiteral( "locale" ) ) != currentLocale )
280 {
281 if ( version < QgsProjectVersion( QStringLiteral( "1.1" ) ) )
282 {
283 QMessageBox::information( this, tr( "Loading Shortcuts" ),
284 tr( "The file contains shortcuts created with different locale, so you can't use it." ) );
285 return;
286 }
287 else // From version 1.1, if objectName is not empty, it is used as key.
288 {
289 QMessageBox::information( this, tr( "Loading Shortcuts" ),
290 tr( "The file contains shortcuts created with different locale, so some shortcuts may not work." ) );
291 }
292 }
293
294 QString actionName;
295 QString actionShortcut;
296 QString actionSettingKey;
297
298 QDomElement child = root.firstChildElement();
299 while ( !child.isNull() )
300 {
301 actionShortcut = child.attribute( QStringLiteral( "shortcut" ) );
302 if ( version < QgsProjectVersion( QStringLiteral( "1.1" ) ) )
303 {
304 actionName = child.attribute( QStringLiteral( "name" ) );
305 mManager->setKeySequence( actionName, actionShortcut );
306 }
307 else
308 {
309 actionSettingKey = child.attribute( QStringLiteral( "setting" ) );
310 QObject *obj = mManager->objectForSettingKey( actionSettingKey );
311 if ( obj )
312 mManager->setObjectKeySequence( obj, actionShortcut );
313
314 }
315
316 child = child.nextSiblingElement();
317 }
318
319 treeActions->clear();
320 populateActions();
321}
322
323void QgsConfigureShortcutsDialog::changeShortcut()
324{
325 setFocus(); // make sure we have focus
326 setGettingShortcut( true );
327}
328
329void QgsConfigureShortcutsDialog::resetShortcut()
330{
331 QObject *object = currentObject();
332 const QString sequence = mManager->objectDefaultKeySequence( object );
333 setCurrentActionShortcut( sequence );
334}
335
336void QgsConfigureShortcutsDialog::setNoShortcut()
337{
338 setCurrentActionShortcut( QKeySequence() );
339}
340
341QAction *QgsConfigureShortcutsDialog::currentAction()
342{
343 return qobject_cast<QAction *>( currentObject() );
344}
345
346QShortcut *QgsConfigureShortcutsDialog::currentShortcut()
347{
348 return qobject_cast<QShortcut *>( currentObject() );
349}
350
351void QgsConfigureShortcutsDialog::actionChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous )
352{
353 Q_UNUSED( current )
354 Q_UNUSED( previous )
355 // cancel previous shortcut setting (if any)
356 setGettingShortcut( false );
357
358 QString shortcut;
359 QKeySequence sequence;
360 if ( QAction *action = currentAction() )
361 {
362 // show which one is the default action
363 shortcut = mManager->defaultKeySequence( action );
364 sequence = action->shortcut();
365 }
366 else if ( QShortcut *object = currentShortcut() )
367 {
368 // show which one is the default action
369 shortcut = mManager->defaultKeySequence( object );
370 sequence = object->key();
371 }
372 else
373 {
374 return;
375 }
376
377 if ( shortcut.isEmpty() )
378 shortcut = tr( "None" );
379 btnResetShortcut->setText( tr( "Set default (%1)" ).arg( shortcut ) );
380
381 // if there's no shortcut, disable set none
382 btnSetNoShortcut->setEnabled( !sequence.isEmpty() );
383 // if the shortcut is default, disable set default
384 btnResetShortcut->setEnabled( sequence != QKeySequence( shortcut ) );
385}
386
388{
389 if ( !mGettingShortcut )
390 {
391 QDialog::keyPressEvent( event );
392 return;
393 }
394
395 const int key = event->key();
396 switch ( key )
397 {
398 // modifiers
399 case Qt::Key_Meta:
400 mModifiers |= Qt::META;
401 updateShortcutText();
402 break;
403 case Qt::Key_Alt:
404 mModifiers |= Qt::ALT;
405 updateShortcutText();
406 break;
407 case Qt::Key_Control:
408 mModifiers |= Qt::CTRL;
409 updateShortcutText();
410 break;
411 case Qt::Key_Shift:
412 mModifiers |= Qt::SHIFT;
413 updateShortcutText();
414 break;
415
416 // escape aborts the acquisition of shortcut
417 case Qt::Key_Escape:
418 setGettingShortcut( false );
419 break;
420
421 default:
422 mKey = key;
423 updateShortcutText();
424 }
425}
426
428{
429 if ( !mGettingShortcut )
430 {
431 QDialog::keyReleaseEvent( event );
432 return;
433 }
434
435 const int key = event->key();
436 switch ( key )
437 {
438 // modifiers
439 case Qt::Key_Meta:
440 mModifiers &= ~Qt::META;
441 updateShortcutText();
442 break;
443 case Qt::Key_Alt:
444 mModifiers &= ~Qt::ALT;
445 updateShortcutText();
446 break;
447 case Qt::Key_Control:
448 mModifiers &= ~Qt::CTRL;
449 updateShortcutText();
450 break;
451 case Qt::Key_Shift:
452 mModifiers &= ~Qt::SHIFT;
453 updateShortcutText();
454 break;
455
456 case Qt::Key_Escape:
457 break;
458
459 default:
460 {
461 // an ordinary key - set it with modifiers as a shortcut
462 setCurrentActionShortcut( QKeySequence( mModifiers + mKey ) );
463 setGettingShortcut( false );
464 }
465 }
466}
467
468QObject *QgsConfigureShortcutsDialog::currentObject()
469{
470 if ( !treeActions->currentItem() )
471 return nullptr;
472
473 QObject *object = treeActions->currentItem()->data( 0, Qt::UserRole ).value<QObject *>();
474 return object;
475}
476
477void QgsConfigureShortcutsDialog::updateShortcutText()
478{
479 // update text of the button so that user can see what has typed already
480 const QKeySequence s( mModifiers + mKey );
481 btnChangeShortcut->setText( tr( "Input: " ) + s.toString( QKeySequence::NativeText ) );
482}
483
484void QgsConfigureShortcutsDialog::setGettingShortcut( bool getting )
485{
486 mModifiers = 0;
487 mKey = 0;
488 mGettingShortcut = getting;
489 if ( !getting )
490 {
491 btnChangeShortcut->setChecked( false );
492 btnChangeShortcut->setText( tr( "Change" ) );
493 }
494 else
495 {
496 updateShortcutText();
497 }
498}
499
500void QgsConfigureShortcutsDialog::setCurrentActionShortcut( const QKeySequence &s )
501{
502 QObject *object = currentObject();
503 if ( !object )
504 return;
505
506 // first check whether this action is not taken already
507 QObject *otherObject = mManager->objectForSequence( s );
508 if ( otherObject == object )
509 return;
510
511 if ( otherObject )
512 {
513 QString otherText;
514 if ( QAction *otherAction = qobject_cast< QAction * >( otherObject ) )
515 {
516 otherText = otherAction->text();
517 otherText.remove( '&' ); // remove the accelerator
518 }
519 else if ( QShortcut *otherShortcut = qobject_cast< QShortcut * >( otherObject ) )
520 {
521 otherText = otherShortcut->whatsThis();
522 }
523
524 const int res = QMessageBox::question( this, tr( "Change Shortcut" ),
525 tr( "This shortcut is already assigned to action %1. Reassign?" ).arg( otherText ),
526 QMessageBox::Yes | QMessageBox::No );
527
528 if ( res != QMessageBox::Yes )
529 return;
530
531 // reset action of the conflicting other action!
532 mManager->setObjectKeySequence( otherObject, QString() );
533 QList<QTreeWidgetItem *> items = treeActions->findItems( otherText, Qt::MatchExactly );
534 if ( !items.isEmpty() ) // there should be exactly one
535 items[0]->setText( 1, QString() );
536 }
537
538 // update manager
539 mManager->setObjectKeySequence( object, s.toString( QKeySequence::NativeText ) );
540
541 // update gui
542 treeActions->currentItem()->setText( 1, s.toString( QKeySequence::NativeText ) );
543
544 actionChanged( treeActions->currentItem(), nullptr );
545}
546
547void QgsConfigureShortcutsDialog::mLeFilter_textChanged( const QString &text )
548{
549 for ( int i = 0; i < treeActions->topLevelItemCount(); i++ )
550 {
551 QTreeWidgetItem *item = treeActions->topLevelItem( i );
552 if ( !item->text( 0 ).contains( text, Qt::CaseInsensitive ) && !item->text( 1 ).contains( text, Qt::CaseInsensitive ) )
553 {
554 item->setHidden( true );
555 }
556 else
557 {
558 item->setHidden( false );
559 }
560 }
561}
562
563void QgsConfigureShortcutsDialog::showHelp()
564{
565 QgsHelp::openHelp( QStringLiteral( "introduction/qgis_configuration.html#shortcuts" ) );
566}
567
568void QgsConfigureShortcutsDialog::saveShortcutsPdf()
569{
570 QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Shortcuts" ), QDir::homePath(),
571 tr( "PDF file" ) + " (*.pdf);;" + tr( "All files" ) + " (*)" );
572 // return dialog focus on Mac
573 activateWindow();
574 raise();
575
576 if ( fileName.isEmpty() )
577 return;
578
579 if ( !fileName.endsWith( QLatin1String( ".pdf" ), Qt::CaseInsensitive ) )
580 {
581 fileName += QLatin1String( ".pdf" );
582 }
583
584 QTextDocument *document = new QTextDocument;
585 QTextCursor cursor( document );
586
587 QTextTableFormat tableFormat;
588 tableFormat.setBorder( 0 );
589 tableFormat.setCellSpacing( 0 );
590 tableFormat.setCellPadding( 4 );
591 tableFormat.setHeaderRowCount( 1 );
592
593 QVector<QTextLength> constraints;
594 constraints << QTextLength( QTextLength::PercentageLength, 5 );
595 constraints << QTextLength( QTextLength::PercentageLength, 80 );
596 constraints << QTextLength( QTextLength::PercentageLength, 15 );
597 tableFormat.setColumnWidthConstraints( constraints );
598
599 QTextTableCellFormat headerFormat;
600 headerFormat.setFontWeight( QFont::Bold );
601 headerFormat.setBottomPadding( 4 );
602
603 QTextCharFormat rowFormat;
604 rowFormat.setVerticalAlignment( QTextCharFormat::AlignMiddle );
605
606 QTextCharFormat altRowFormat;
607 altRowFormat.setBackground( QBrush( QColor( 238, 238, 236 ) ) );
608 altRowFormat.setVerticalAlignment( QTextCharFormat::AlignMiddle );
609
610 int row = 0;
611 QTextTable *table = cursor.insertTable( 1, 3, tableFormat );
612 table->mergeCells( 0, 0, 1, 2 );
613 QTextCursor c = table->cellAt( row, 0 ).firstCursorPosition();
614 c.setCharFormat( headerFormat );
615 c.insertText( tr( "Action" ) );
616 c = table->cellAt( row, 2 ).firstCursorPosition();
617 c.setCharFormat( headerFormat );
618 c.insertText( tr( "Shortcut" ) );
619
620 const QList<QObject *> objects = mManager->listAll();
621 for ( QObject *obj : objects )
622 {
623 QString actionText;
624 QString sequence;
625 QIcon icon;
626
627 if ( QAction *action = qobject_cast< QAction * >( obj ) )
628 {
629 actionText = action->text().remove( '&' );
630 sequence = action->shortcut().toString( QKeySequence::NativeText );
631 icon = action->icon();
632 }
633 else if ( QShortcut *shortcut = qobject_cast< QShortcut * >( obj ) )
634 {
635 actionText = shortcut->whatsThis();
636 sequence = shortcut->key().toString( QKeySequence::NativeText );
637 icon = shortcut->property( "Icon" ).value<QIcon>();
638 }
639 else
640 {
641 continue;
642 }
643
644 // skip actions without shortcut and name
645 if ( actionText.isEmpty() || sequence.isEmpty() )
646 {
647 continue;
648 }
649
650 row += 1;
651 table->appendRows( 1 );
652
653 if ( row % 2 )
654 {
655 table->cellAt( row, 0 ).setFormat( altRowFormat );
656 table->cellAt( row, 1 ).setFormat( altRowFormat );
657 table->cellAt( row, 2 ).setFormat( altRowFormat );
658 }
659 else
660 {
661 table->cellAt( row, 0 ).setFormat( rowFormat );
662 table->cellAt( row, 1 ).setFormat( rowFormat );
663 table->cellAt( row, 2 ).setFormat( rowFormat );
664 }
665
666 if ( !icon.isNull() )
667 {
668 c = table->cellAt( row, 0 ).firstCursorPosition();
669 c.insertImage( icon.pixmap( QSize( 24, 24 ) ).toImage() );
670 }
671 table->cellAt( row, 1 ).firstCursorPosition().insertText( actionText );
672 table->cellAt( row, 2 ).firstCursorPosition().insertText( sequence );
673 }
674
675 QPdfWriter pdfWriter( fileName );
676 pdfWriter.setPageLayout( QPageLayout( QPageSize( QPageSize::A4 ), QPageLayout::Portrait, QMarginsF( 20, 10, 10, 10 ) ) );
677 document->setPageSize( QSizeF( pdfWriter.pageLayout().fullRect( QPageLayout::Point ).size() ) );
678 document->print( &pdfWriter );
679}
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:124
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:209
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