LibrePCB Developers Documentation
Loading...
Searching...
No Matches
EditorCommand Class Referencefinal

Command for editors, e.g. to be added to a QMenu. More...

#include <editorcommand.h>

Inherits QObject.

+ Collaboration diagram for EditorCommand:

Public Types

enum class  Flag
 
enum class  ActionFlag
 

Signals

void shortcutsChanged (const QList< QKeySequence > &sequences)
 

Public Member Functions

 EditorCommand ()=delete
 
 EditorCommand (const EditorCommand &other)=delete
 
 EditorCommand (const QString &identifier, const char *text, const char *description, const QString &iconFp, Flags flags, const QList< QKeySequence > &defaultKeySequences, QObject *parent=nullptr) noexcept
 
 ~EditorCommand () noexcept
 
const QString & getIdentifier () const noexcept
 
const QString & getText () const noexcept
 
QString getDisplayText () const noexcept
 
QString getDisplayTextNoTr () const noexcept
 
const QString & getDescription () const noexcept
 
const QIcon & getIcon () const noexcept
 
const Flags & getFlags () const noexcept
 
const QList< QKeySequence > getDefaultKeySequences () const noexcept
 
const QList< QKeySequence > & getKeySequences () const noexcept
 
void setKeySequences (const QList< QKeySequence > &sequences) noexcept
 
void updateTranslations () noexcept
 
QAction * createAction (QObject *parent, ActionFlags flags=ActionFlags()) const noexcept
 
template<typename TContext , typename TSlot >
QAction * createAction (QObject *parent, const TContext *context, TSlot slot, ActionFlags flags=ActionFlags()) const noexcept
 
EditorCommandoperator= (const EditorCommand &rhs)=delete
 

Private Member Functions

QAction * setupAction (QAction *action, ActionFlags flags) const noexcept
 
bool eventFilter (QObject *obj, QEvent *event) noexcept override
 

Static Private Member Functions

static QString unescapeAmpersand (QString text) noexcept
 

Private Attributes

QString mIdentifier
 
const char * mTextNoTr
 
QString mText
 
const char * mDescriptionNoTr
 
QString mDescription
 
QIcon mIcon
 
Flags mFlags
 
QList< QKeySequence > mDefaultKeySequences
 
QList< QKeySequence > mKeySequences
 

Detailed Description

Command for editors, e.g. to be added to a QMenu.

Member Enumeration Documentation

◆ Flag

enum class Flag
strong
Enumerator
OpensPopup 
AboutRole 
AboutQtRole 
PreferencesRole 
QuitRole 

◆ ActionFlag

enum class ActionFlag
strong
Enumerator
NoShortcuts 

Create an action without shortcuts.

WidgetShortcut 

Restrict the shortcut to its widget.

ApplicationShortcut 

Make the shortcut application global.

QueuedConnection 

Create a queued signal/slot connection.

ReactOnToggle 

React on toggled() instead of triggered().

Constructor & Destructor Documentation

◆ EditorCommand() [1/3]

EditorCommand ( )
delete

◆ EditorCommand() [2/3]

EditorCommand ( const EditorCommand other)
delete

◆ EditorCommand() [3/3]

EditorCommand ( const QString &  identifier,
const char *  text,
const char *  description,
const QString &  iconFp,
Flags  flags,
const QList< QKeySequence > &  defaultKeySequences,
QObject *  parent = nullptr 
)
noexcept
+ Here is the call graph for this function:

◆ ~EditorCommand()

~EditorCommand ( )
noexcept

Member Function Documentation

◆ getIdentifier()

const QString & getIdentifier ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getText()

const QString & getText ( ) const
inlinenoexcept

◆ getDisplayText()

QString getDisplayText ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ getDisplayTextNoTr()

QString getDisplayTextNoTr ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ getDescription()

const QString & getDescription ( ) const
inlinenoexcept

◆ getIcon()

const QIcon & getIcon ( ) const
inlinenoexcept

◆ getFlags()

const Flags & getFlags ( ) const
inlinenoexcept

◆ getDefaultKeySequences()

const QList< QKeySequence > getDefaultKeySequences ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getKeySequences()

const QList< QKeySequence > & getKeySequences ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ setKeySequences()

void setKeySequences ( const QList< QKeySequence > &  sequences)
noexcept
+ Here is the caller graph for this function:

◆ updateTranslations()

void updateTranslations ( )
noexcept
+ Here is the caller graph for this function:

◆ createAction() [1/2]

QAction * createAction ( QObject *  parent,
ActionFlags  flags = ActionFlags() 
) const
noexcept
+ Here is the caller graph for this function:

◆ createAction() [2/2]

template<typename TContext , typename TSlot >
QAction * createAction ( QObject *  parent,
const TContext *  context,
TSlot  slot,
ActionFlags  flags = ActionFlags() 
) const
inlinenoexcept
+ Here is the call graph for this function:

◆ operator=()

EditorCommand & operator= ( const EditorCommand rhs)
delete

◆ shortcutsChanged

void shortcutsChanged ( const QList< QKeySequence > &  sequences)
signal
+ Here is the caller graph for this function:

◆ setupAction()

QAction * setupAction ( QAction *  action,
ActionFlags  flags 
) const
privatenoexcept
+ Here is the call graph for this function:

◆ eventFilter()

bool eventFilter ( QObject *  obj,
QEvent *  event 
)
overrideprivatenoexcept

◆ unescapeAmpersand()

QString unescapeAmpersand ( QString  text)
staticprivatenoexcept
+ Here is the caller graph for this function:

Member Data Documentation

◆ mIdentifier

QString mIdentifier
private

◆ mTextNoTr

const char* mTextNoTr
private

◆ mText

QString mText
private

◆ mDescriptionNoTr

const char* mDescriptionNoTr
private

◆ mDescription

QString mDescription
private

◆ mIcon

QIcon mIcon
private

◆ mFlags

Flags mFlags
private

◆ mDefaultKeySequences

QList<QKeySequence> mDefaultKeySequences
private

◆ mKeySequences

QList<QKeySequence> mKeySequences
private

The documentation for this class was generated from the following files: