QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
•All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
18#include "qgsshortcutsmanager.h"
19#include "qgsapplication.h"
20#include "qgslogger.h"
21#include "qgssettings.h"
22#include "qgsgui.h"
23#include "qgsprojectversion.h"
24
25#include <QKeyEvent>
26#include <QKeySequence>
27#include <QMessageBox>
28#include <QShortcut>
29#include <QDomDocument>
30#include <QFileDialog>
31#include <QTextStream>
32#include <QMenu>
33#include <QAction>
34#include <QPrinter>
35#include <QTextDocument>
36#include <QTextCursor>
37#include <QTextTable>
38#include <QTextTableFormat>
39#include <QTextTableCellFormat>
40#include <QTextCharFormat>
41
43 : QDialog( parent )
44 , mManager( manager )
45{
46 setupUi( this );
48
49 mSaveMenu = new QMenu( this );
50 mSaveUserShortcuts = new QAction( tr( "Save User Shortcuts…" ), this );
51 mSaveMenu->addAction( mSaveUserShortcuts );
52 connect( mSaveUserShortcuts, &QAction::triggered, this, [this] { saveShortcuts( false ); } );
53
54 mSaveAllShortcuts = new QAction( tr( "Save All Shortcuts…" ), this );
55 mSaveMenu->addAction( mSaveAllShortcuts );
56 connect( mSaveAllShortcuts, &QAction::triggered, this, [this] { saveShortcuts(); } );
57
58 mSaveAsPdf = new QAction( tr( "Save as PDF…" ), this );
59 mSaveMenu->addAction( mSaveAsPdf );
60 connect( mSaveAsPdf, &QAction::triggered, this, &QgsConfigureShortcutsDialog::saveShortcutsPdf );
61
62 btnSaveShortcuts->setMenu( mSaveMenu );
63
64 connect( mLeFilter, &QgsFilterLineEdit::textChanged, this, &QgsConfigureShortcutsDialog::mLeFilter_textChanged );
65
66 if ( !mManager )
67 mManager = QgsGui::shortcutsManager();
68
69 connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsConfigureShortcutsDialog::showHelp ); // Vérifier nommage des boutons
70 connect( btnChangeShortcut, &QAbstractButton::clicked, this, &QgsConfigureShortcutsDialog::changeShortcut );
71 connect( btnResetShortcut, &QAbstractButton::clicked, this, &QgsConfigureShortcutsDialog::resetShortcut );
72 connect( btnSetNoShortcut, &QAbstractButton::clicked, this, &QgsConfigureShortcutsDialog::setNoShortcut );
73 connect( btnLoadShortcuts, &QAbstractButton::clicked, this, &QgsConfigureShortcutsDialog::loadShortcuts );
74
75 connect( treeActions, &QTreeWidget::currentItemChanged,
76 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(),
139 tr( "XML file" ) + " (*.xml);;" + tr( "All files" ) + " (*)" );
140
141 if ( fileName.isEmpty() )
142 return;
143
144 // ensure the user never omitted the extension from the file name
145 if ( !fileName.endsWith( QLatin1String( ".xml" ), Qt::CaseInsensitive ) )
146 {
147 fileName += QLatin1String( ".xml" );
148 }
149
150 QFile file( fileName );
151 if ( !file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) )
152 {
153 QMessageBox::warning( this, tr( "Saving Shortcuts" ),
154 tr( "Cannot write file %1:\n%2." )
155 .arg( fileName,
156 file.errorString() ) );
157 return;
158 }
159
160 QgsSettings settings;
161
162 QDomDocument doc( QStringLiteral( "shortcuts" ) );
163 QDomElement root = doc.createElement( QStringLiteral( "qgsshortcuts" ) );
164 root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.1" ) );
165 root.setAttribute( QStringLiteral( "locale" ), settings.value( QgsApplication::settingsLocaleUserLocale->key(), "en_US" ).toString() );
166 doc.appendChild( root );
167
168 const QList<QObject *> objects = mManager->listAll();
169 for ( QObject *obj : objects )
170 {
171 QString actionText;
172 QString actionShortcut;
173 QString actionSettingKey;
174 QKeySequence sequence;
175
176 if ( QAction *action = qobject_cast< QAction * >( obj ) )
177 {
178 actionText = action->text().remove( '&' );
179 actionShortcut = action->shortcut().toString( QKeySequence::NativeText );
180 sequence = mManager->defaultKeySequence( action );
181 }
182 else if ( QShortcut *shortcut = qobject_cast< QShortcut * >( obj ) )
183 {
184 actionText = shortcut->whatsThis();
185 actionShortcut = shortcut->key().toString( QKeySequence::NativeText );
186 sequence = mManager->defaultKeySequence( shortcut );
187 }
188 else
189 {
190 continue;
191 }
192
193 actionSettingKey = mManager->objectSettingKey( obj );
194
195 if ( actionSettingKey.isEmpty() )
196 {
197 continue;
198 }
199
200 // skip unchanged shortcuts if only user-definied were requested
201 if ( !saveAll && sequence == QKeySequence( actionShortcut ) )
202 {
203 continue;
204 }
205
206 QDomElement el = doc.createElement( QStringLiteral( "action" ) );
207 el.setAttribute( QStringLiteral( "name" ), actionText );
208 el.setAttribute( QStringLiteral( "shortcut" ), actionShortcut );
209 el.setAttribute( QStringLiteral( "setting" ), actionSettingKey );
210 root.appendChild( el );
211 }
212
213 QTextStream out( &file );
214 doc.save( out, 4 );
215}
216
217void QgsConfigureShortcutsDialog::loadShortcuts()
218{
219 const QString fileName = QFileDialog::getOpenFileName( this, tr( "Load Shortcuts" ), QDir::homePath(),
220 tr( "XML file" ) + " (*.xml);;" + tr( "All files" ) + " (*)" );
221
222 if ( fileName.isEmpty() )
223 {
224 return;
225 }
226
227 QFile file( fileName );
228 if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
229 {
230 QMessageBox::warning( this, tr( "Loading Shortcuts" ),
231 tr( "Cannot read file %1:\n%2." )
232 .arg( fileName,
233 file.errorString() ) );
234 return;
235 }
236
237 QDomDocument doc;
238 QString errorStr;
239 int errorLine;
240 int errorColumn;
241
242 if ( !doc.setContent( &file, true, &errorStr, &errorLine, &errorColumn ) )
243 {
244 QMessageBox::information( this, tr( "Loading Shortcuts" ),
245 tr( "Parse error at line %1, column %2:\n%3" )
246 .arg( errorLine )
247 .arg( errorColumn )
248 .arg( errorStr ) );
249 return;
250 }
251
252 const QDomElement root = doc.documentElement();
253 if ( root.tagName() != QLatin1String( "qgsshortcuts" ) )
254 {
255 QMessageBox::information( this, tr( "Loading Shortcuts" ),
256 tr( "The file is not an shortcuts exchange file." ) );
257 return;
258 }
259
260 QString currentLocale;
261
262 const bool localeOverrideFlag = QgsApplication::settingsLocaleOverrideFlag->value();
263 if ( localeOverrideFlag )
264 {
266 }
267 else // use QGIS locale
268 {
269 currentLocale = QLocale().name();
270 }
271
272 const QString versionStr = root.attribute( QStringLiteral( "version" ) );
273 const QgsProjectVersion version( versionStr );
274
275 if ( root.attribute( QStringLiteral( "locale" ) ) != currentLocale )
276 {
277 if ( version < QgsProjectVersion( QStringLiteral( "1.1" ) ) )
278 {
279 QMessageBox::information( this, tr( "Loading Shortcuts" ),
280 tr( "The file contains shortcuts created with different locale, so you can't use it." ) );
281 return;
282 }
283 else // From version 1.1, if objectName is not empty, it is used as key.
284 {
285 QMessageBox::information( this, tr( "Loading Shortcuts" ),
286 tr( "The file contains shortcuts created with different locale, so some shortcuts may not work." ) );
287 }
288 }
289
290 QString actionName;
291 QString actionShortcut;
292 QString actionSettingKey;
293
294 QDomElement child = root.firstChildElement();
295 while ( !child.isNull() )
296 {
297 actionShortcut = child.attribute( QStringLiteral( "shortcut" ) );
298 if ( version < QgsProjectVersion( QStringLiteral( "1.1" ) ) )
299 {
300 actionName = child.attribute( QStringLiteral( "name" ) );
301 mManager->setKeySequence( actionName, actionShortcut );
302 }
303 else
304 {
305 actionSettingKey = child.attribute( QStringLiteral( "setting" ) );
306 QObject *obj = mManager->objectForSettingKey( actionSettingKey );
307 if ( obj )
308 mManager->setObjectKeySequence( obj, actionShortcut );
309
310 }
311
312 child = child.nextSiblingElement();
313 }
314
315 treeActions->clear();
316 populateActions();
317}
318
319void QgsConfigureShortcutsDialog::changeShortcut()
320{
321 setFocus(); // make sure we have focus
322 setGettingShortcut( true );
323}
324
325void QgsConfigureShortcutsDialog::resetShortcut()
326{
327 QObject *object = currentObject();
328 const QString sequence = mManager->objectDefaultKeySequence( object );
329 setCurrentActionShortcut( sequence );
330}
331
332void QgsConfigureShortcutsDialog::setNoShortcut()
333{
334 setCurrentActionShortcut( QKeySequence() );
335}
336
337QAction *QgsConfigureShortcutsDialog::currentAction()
338{
339 return qobject_cast<QAction *>( currentObject() );
340}
341
342QShortcut *QgsConfigureShortcutsDialog::currentShortcut()
343{
344 return qobject_cast<QShortcut *>( currentObject() );
345}
346
347void QgsConfigureShortcutsDialog::actionChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous )
348{
349 Q_UNUSED( current )
350 Q_UNUSED( previous )
351 // cancel previous shortcut setting (if any)
352 setGettingShortcut( false );
353
354 QString shortcut;
355 QKeySequence sequence;
356 if ( QAction *action = currentAction() )
357 {
358 // show which one is the default action
359 shortcut = mManager->defaultKeySequence( action );
360 sequence = action->shortcut();
361 }
362 else if ( QShortcut *object = currentShortcut() )
363 {
364 // show which one is the default action
365 shortcut = mManager->defaultKeySequence( object );
366 sequence = object->key();
367 }
368 else
369 {
370 return;
371 }
372
373 if ( shortcut.isEmpty() )
374 shortcut = tr( "None" );
375 btnResetShortcut->setText( tr( "Set default (%1)" ).arg( shortcut ) );
376
377 // if there's no shortcut, disable set none
378 btnSetNoShortcut->setEnabled( !sequence.isEmpty() );
379 // if the shortcut is default, disable set default
380 btnResetShortcut->setEnabled( sequence != QKeySequence( shortcut ) );
381}
382
384{
385 if ( !mGettingShortcut )
386 {
387 QDialog::keyPressEvent( event );
388 return;
389 }
390
391 const int key = event->key();
392 switch ( key )
393 {
394 // modifiers
395 case Qt::Key_Meta:
396 mModifiers |= Qt::META;
397 updateShortcutText();
398 break;
399 case Qt::Key_Alt:
400 mModifiers |= Qt::ALT;
401 updateShortcutText();
402 break;
403 case Qt::Key_Control:
404 mModifiers |= Qt::CTRL;
405 updateShortcutText();
406 break;
407 case Qt::Key_Shift:
408 mModifiers |= Qt::SHIFT;
409 updateShortcutText();
410 break;
411
412 // escape aborts the acquisition of shortcut
413 case Qt::Key_Escape:
414 setGettingShortcut( false );
415 break;
416
417 default:
418 mKey = key;
419 updateShortcutText();
420 }
421}
422
424{
425 if ( !mGettingShortcut )
426 {
427 QDialog::keyReleaseEvent( event );
428 return;
429 }
430
431 const int key = event->key();
432 switch ( key )
433 {
434 // modifiers
435 case Qt::Key_Meta:
436 mModifiers &= ~Qt::META;
437 updateShortcutText();
438 break;
439 case Qt::Key_Alt:
440 mModifiers &= ~Qt::ALT;
441 updateShortcutText();
442 break;
443 case Qt::Key_Control:
444 mModifiers &= ~Qt::CTRL;
445 updateShortcutText();
446 break;
447 case Qt::Key_Shift:
448 mModifiers &= ~Qt::SHIFT;
449 updateShortcutText();
450 break;
451
452 case Qt::Key_Escape:
453 break;
454
455 default:
456 {
457 // an ordinary key - set it with modifiers as a shortcut
458 setCurrentActionShortcut( QKeySequence( mModifiers + mKey ) );
459 setGettingShortcut( false );
460 }
461 }
462}
463
464QObject *QgsConfigureShortcutsDialog::currentObject()
465{
466 if ( !treeActions->currentItem() )
467 return nullptr;
468
469 QObject *object = treeActions->currentItem()->data( 0, Qt::UserRole ).value<QObject *>();
470 return object;
471}
472
473void QgsConfigureShortcutsDialog::updateShortcutText()
474{
475 // update text of the button so that user can see what has typed already
476 const QKeySequence s( mModifiers + mKey );
477 btnChangeShortcut->setText( tr( "Input: " ) + s.toString( QKeySequence::NativeText ) );
478}
479
480void QgsConfigureShortcutsDialog::setGettingShortcut( bool getting )
481{
482 mModifiers = 0;
483 mKey = 0;
484 mGettingShortcut = getting;
485 if ( !getting )
486 {
487 btnChangeShortcut->setChecked( false );
488 btnChangeShortcut->setText( tr( "Change" ) );
489 }
490 else
491 {
492 updateShortcutText();
493 }
494}
495
496void QgsConfigureShortcutsDialog::setCurrentActionShortcut( const QKeySequence &s )
497{
498 QObject *object = currentObject();
499 if ( !object )
500 return;
501
502 // first check whether this action is not taken already
503 QObject *otherObject = mManager->objectForSequence( s );
504 if ( otherObject == object )
505 return;
506
507 if ( otherObject )
508 {
509 QString otherText;
510 if ( QAction *otherAction = qobject_cast< QAction * >( otherObject ) )
511 {
512 otherText = otherAction->text();
513 otherText.remove( '&' ); // remove the accelerator
514 }
515 else if ( QShortcut *otherShortcut = qobject_cast< QShortcut * >( otherObject ) )
516 {
517 otherText = otherShortcut->whatsThis();
518 }
519
520 const int res = QMessageBox::question( this, tr( "Change Shortcut" ),
521 tr( "This shortcut is already assigned to action %1. Reassign?" ).arg( otherText ),
522 QMessageBox::Yes | QMessageBox::No );
523
524 if ( res != QMessageBox::Yes )
525 return;
526
527 // reset action of the conflicting other action!
528 mManager->setObjectKeySequence( otherObject, QString() );
529 QList<QTreeWidgetItem *> items = treeActions->findItems( otherText, Qt::MatchExactly );
530 if ( !items.isEmpty() ) // there should be exactly one
531 items[0]->setText( 1, QString() );
532 }
533
534 // update manager
535 mManager->setObjectKeySequence( object, s.toString( QKeySequence::NativeText ) );
536
537 // update gui
538 treeActions->currentItem()->setText( 1, s.toString( QKeySequence::NativeText ) );
539
540 actionChanged( treeActions->currentItem(), nullptr );
541}
542
543void QgsConfigureShortcutsDialog::mLeFilter_textChanged( const QString &text )
544{
545 for ( int i = 0; i < treeActions->topLevelItemCount(); i++ )
546 {
547 QTreeWidgetItem *item = treeActions->topLevelItem( i );
548 if ( !item->text( 0 ).contains( text, Qt::CaseInsensitive ) && !item->text( 1 ).contains( text, Qt::CaseInsensitive ) )
549 {
550 item->setHidden( true );
551 }
552 else
553 {
554 item->setHidden( false );
555 }
556 }
557}
558
559void QgsConfigureShortcutsDialog::showHelp()
560{
561 QgsHelp::openHelp( QStringLiteral( "introduction/qgis_configuration.html#keyboard-shortcuts" ) );
562}
563
564void QgsConfigureShortcutsDialog::saveShortcutsPdf()
565{
566 QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Shortcuts" ), QDir::homePath(),
567 tr( "PDF file" ) + " (*.pdf);;" + tr( "All files" ) + " (*)" );
568
569 if ( fileName.isEmpty() )
570 return;
571
572 if ( !fileName.endsWith( QLatin1String( ".pdf" ), Qt::CaseInsensitive ) )
573 {
574 fileName += QLatin1String( ".pdf" );
575 }
576
577 QTextDocument *document = new QTextDocument;
578 QTextCursor cursor( document );
579
580 QTextTableFormat tableFormat;
581 tableFormat.setBorder( 0 );
582 tableFormat.setCellSpacing( 0 );
583 tableFormat.setCellPadding( 4 );
584 tableFormat.setHeaderRowCount( 1 );
585
586 QVector<QTextLength> constraints;
587 constraints << QTextLength( QTextLength::PercentageLength, 5 );
588 constraints << QTextLength( QTextLength::PercentageLength, 80 );
589 constraints << QTextLength( QTextLength::PercentageLength, 15 );
590 tableFormat.setColumnWidthConstraints( constraints );
591
592 QTextTableCellFormat headerFormat;
593 headerFormat.setFontWeight( QFont::Bold );
594 headerFormat.setBottomPadding( 4 );
595
596 QTextCharFormat rowFormat;
597 rowFormat.setVerticalAlignment( QTextCharFormat::AlignMiddle );
598
599 QTextCharFormat altRowFormat;
600 altRowFormat.setBackground( QBrush( QColor( 238, 238, 236 ) ) );
601 altRowFormat.setVerticalAlignment( QTextCharFormat::AlignMiddle );
602
603 int row = 0;
604 QTextTable *table = cursor.insertTable( 1, 3, tableFormat );
605 table->mergeCells( 0, 0, 1, 2 );
606 QTextCursor c = table->cellAt( row, 0 ).firstCursorPosition();
607 c.setCharFormat( headerFormat );
608 c.insertText( tr( "Action" ) );
609 c = table->cellAt( row, 2 ).firstCursorPosition();
610 c.setCharFormat( headerFormat );
611 c.insertText( tr( "Shortcut" ) );
612
613 const QList<QObject *> objects = mManager->listAll();
614 for ( QObject *obj : objects )
615 {
616 QString actionText;
617 QString sequence;
618 QIcon icon;
619
620 if ( QAction *action = qobject_cast< QAction * >( obj ) )
621 {
622 actionText = action->text().remove( '&' );
623 sequence = action->shortcut().toString( QKeySequence::NativeText );
624 icon = action->icon();
625 }
626 else if ( QShortcut *shortcut = qobject_cast< QShortcut * >( obj ) )
627 {
628 actionText = shortcut->whatsThis();
629 sequence = shortcut->key().toString( QKeySequence::NativeText );
630 icon = shortcut->property( "Icon" ).value<QIcon>();
631 }
632 else
633 {
634 continue;
635 }
636
637 // skip actions without shortcut and name
638 if ( actionText.isEmpty() || sequence.isEmpty() )
639 {
640 continue;
641 }
642
643 row += 1;
644 table->appendRows( 1 );
645
646 if ( row % 2 )
647 {
648 table->cellAt( row, 0 ).setFormat( altRowFormat );
649 table->cellAt( row, 1 ).setFormat( altRowFormat );
650 table->cellAt( row, 2 ).setFormat( altRowFormat );
651 }
652 else
653 {
654 table->cellAt( row, 0 ).setFormat( rowFormat );
655 table->cellAt( row, 1 ).setFormat( rowFormat );
656 table->cellAt( row, 2 ).setFormat( rowFormat );
657 }
658
659 if ( !icon.isNull() )
660 {
661 c = table->cellAt( row, 0 ).firstCursorPosition();
662 c.insertImage( icon.pixmap( QSize( 24, 24 ) ).toImage() );
663 }
664 table->cellAt( row, 1 ).firstCursorPosition().insertText( actionText );
665 table->cellAt( row, 2 ).firstCursorPosition().insertText( sequence );
666 }
667
668 QPrinter printer( QPrinter::ScreenResolution );
669 printer.setOutputFormat( QPrinter::PdfFormat );
670 printer.setPageLayout( QPageLayout( QPageSize( QPageSize::A4 ), QPageLayout::Portrait, QMarginsF( 20, 10, 10, 10 ) ) );
671 printer.setOutputFileName( fileName );
672 document->setPageSize( QSizeF( printer.pageRect( QPrinter::DevicePixel ).size() ) );
673
674 document->print( &printer );
675}
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:118
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:193
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Definition: qgshelp.cpp:38
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:63
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