Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
MantidQt::MantidWidgets::HintingLineEdit Class Reference

HintingLineEdit : A QLineEdit widget providing autocompletion. More...

#include <HintingLineEdit.h>

Inheritance diagram for MantidQt::MantidWidgets::HintingLineEdit:

Public Member Functions

 HintingLineEdit (QWidget *parent, std::vector< Hint > hints)
 
 ~HintingLineEdit () override
 

Protected Slots

void hideHints ()
 Hides the list of hints. More...
 
void updateHints (const QString &text)
 Rebuild a list of hints whenever the user edits the text, and use the hints to make auto completion suggestions. More...
 

Protected Member Functions

void clearSuggestion ()
 Remove any existing auto completion suggestion. More...
 
void insertSuggestion ()
 Insert an auto completion suggestion beneath the user's cursor and select it. More...
 
void keyPressEvent (QKeyEvent *e) override
 Handle a key press event. More...
 
void nextSuggestion ()
 Change to the next available auto completion suggestion. More...
 
void prevSuggestion ()
 Change to the previous auto completion suggestion. More...
 
void showToolTip ()
 Show a tooltip with the current relevant hints. More...
 
void updateMatches ()
 Updates the list of hints matching the user's current input. More...
 

Protected Attributes

std::string m_currentPrefix
 
bool m_dontComplete
 
QLabel * m_hintLabel
 
std::vector< Hintm_hints
 
std::vector< Hint >::const_iterator m_match
 
std::vector< Hintm_matches
 

Detailed Description

HintingLineEdit : A QLineEdit widget providing autocompletion.

Definition at line 28 of file HintingLineEdit.h.

Constructor & Destructor Documentation

◆ HintingLineEdit()

MantidQt::MantidWidgets::HintingLineEdit::HintingLineEdit ( QWidget *  parent,
std::vector< Hint hints 
)

Definition at line 17 of file HintingLineEdit.cpp.

References hideHints(), m_hintLabel, and updateHints().

◆ ~HintingLineEdit()

MantidQt::MantidWidgets::HintingLineEdit::~HintingLineEdit ( )
overridedefault

Member Function Documentation

◆ clearSuggestion()

void MantidQt::MantidWidgets::HintingLineEdit::clearSuggestion ( )
protected

Remove any existing auto completion suggestion.

Definition at line 143 of file HintingLineEdit.cpp.

Referenced by nextSuggestion(), and prevSuggestion().

◆ hideHints

void MantidQt::MantidWidgets::HintingLineEdit::hideHints ( )
protectedslot

Hides the list of hints.

Definition at line 89 of file HintingLineEdit.cpp.

References m_hintLabel.

Referenced by HintingLineEdit().

◆ insertSuggestion()

void MantidQt::MantidWidgets::HintingLineEdit::insertSuggestion ( )
protected

Insert an auto completion suggestion beneath the user's cursor and select it.

Definition at line 123 of file HintingLineEdit.cpp.

References m_currentPrefix, m_dontComplete, m_match, and m_matches.

Referenced by nextSuggestion(), prevSuggestion(), and updateHints().

◆ keyPressEvent()

void MantidQt::MantidWidgets::HintingLineEdit::keyPressEvent ( QKeyEvent *  e)
overrideprotected

Handle a key press event.

Parameters
e: A pointer to the event

Definition at line 40 of file HintingLineEdit.cpp.

References m_dontComplete, nextSuggestion(), and prevSuggestion().

◆ nextSuggestion()

void MantidQt::MantidWidgets::HintingLineEdit::nextSuggestion ( )
protected

Change to the next available auto completion suggestion.

Definition at line 154 of file HintingLineEdit.cpp.

References clearSuggestion(), insertSuggestion(), m_match, and m_matches.

Referenced by keyPressEvent().

◆ prevSuggestion()

void MantidQt::MantidWidgets::HintingLineEdit::prevSuggestion ( )
protected

Change to the previous auto completion suggestion.

Definition at line 166 of file HintingLineEdit.cpp.

References clearSuggestion(), insertSuggestion(), m_match, and m_matches.

Referenced by keyPressEvent().

◆ showToolTip()

void MantidQt::MantidWidgets::HintingLineEdit::showToolTip ( )
protected

Show a tooltip with the current relevant hints.

Definition at line 103 of file HintingLineEdit.cpp.

References height, m_hintLabel, and m_matches.

Referenced by updateHints().

◆ updateHints

void MantidQt::MantidWidgets::HintingLineEdit::updateHints ( const QString &  text)
protectedslot

Rebuild a list of hints whenever the user edits the text, and use the hints to make auto completion suggestions.

Parameters
text: The new contents of the QLineEdit

Definition at line 60 of file HintingLineEdit.cpp.

References insertSuggestion(), m_currentPrefix, showToolTip(), and updateMatches().

Referenced by HintingLineEdit().

◆ updateMatches()

void MantidQt::MantidWidgets::HintingLineEdit::updateMatches ( )
protected

Updates the list of hints matching the user's current input.

Definition at line 92 of file HintingLineEdit.cpp.

References m_hints, m_match, and m_matches.

Referenced by updateHints().

Member Data Documentation

◆ m_currentPrefix

std::string MantidQt::MantidWidgets::HintingLineEdit::m_currentPrefix
protected

Definition at line 44 of file HintingLineEdit.h.

Referenced by insertSuggestion(), and updateHints().

◆ m_dontComplete

bool MantidQt::MantidWidgets::HintingLineEdit::m_dontComplete
protected

Definition at line 46 of file HintingLineEdit.h.

Referenced by insertSuggestion(), and keyPressEvent().

◆ m_hintLabel

QLabel* MantidQt::MantidWidgets::HintingLineEdit::m_hintLabel
protected

Definition at line 47 of file HintingLineEdit.h.

Referenced by hideHints(), HintingLineEdit(), and showToolTip().

◆ m_hints

std::vector<Hint> MantidQt::MantidWidgets::HintingLineEdit::m_hints
protected

Definition at line 43 of file HintingLineEdit.h.

Referenced by updateMatches().

◆ m_match

std::vector<Hint>::const_iterator MantidQt::MantidWidgets::HintingLineEdit::m_match
protected

Definition at line 45 of file HintingLineEdit.h.

Referenced by insertSuggestion(), nextSuggestion(), prevSuggestion(), and updateMatches().

◆ m_matches

std::vector<Hint> MantidQt::MantidWidgets::HintingLineEdit::m_matches
protected

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