Stellarium  0.20.4
Public Slots | Signals | Public Member Functions | Protected Member Functions
ShortcutLineEdit Class Reference

Specialized GUI control for entering keyboard shortcut combinations. More...

#include <ShortcutLineEdit.hpp>

Public Slots

void clear ()
 Clear contents and stored keys.
 
void backspace ()
 Remove the last key from the key sequence.
 
void setContents (QKeySequence ks)
 Emits contentsChanged() if the new sequence is not the same.
 

Signals

void focusChanged (bool focus)
 Needed for enabling/disabling buttons in ShortcutsDialog. More...
 
void contentsChanged ()
 

Public Member Functions

 ShortcutLineEdit (QWidget *parent=Q_NULLPTR)
 
QKeySequence getKeySequence () const
 
bool isEmpty () const
 

Protected Member Functions

virtual void keyPressEvent (QKeyEvent *e) Q_DECL_OVERRIDE
 
virtual void focusInEvent (QFocusEvent *e) Q_DECL_OVERRIDE
 
virtual void focusOutEvent (QFocusEvent *e) Q_DECL_OVERRIDE
 

Detailed Description

Allows Emacs-style key sequences (for example "Ctrl+E, Ctrl+2") no longer than four combinations. See the documentation of QKeySequence for details.

When ShortcutLineEdit receives the focus, its whole contents get selected. On a key press, if any of the contents are selected, the new key replaces all the previous contents. Otherwise, it's appended to the sequence.

Member Function Documentation

◆ focusChanged

void ShortcutLineEdit::focusChanged ( bool  focus)
signal
Parameters
[out]focusfalse if the widget has the focus, true otherwise.