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