LeechCraft  0.6.70-13729-g7046a9d2a7
Modular cross-platform feature rich live environment.
LC::Util::ClearLineEditAddon Class Reference

Provides a "clear text" action for line edits. More...

#include "clearlineeditaddon.h"

+ Inheritance diagram for LC::Util::ClearLineEditAddon:
+ Collaboration diagram for LC::Util::ClearLineEditAddon:

Public Member Functions

 ClearLineEditAddon (ICoreProxy_ptr proxy, QLineEdit *edit)
 Creates the addon and installs it on the given edit. More...
 
 ClearLineEditAddon (ICoreProxy_ptr proxy, QLineEdit *edit, LineEditButtonManager *manager)
 Creates the addon and installs it on the given edit. More...
 
void SetEscClearsEdit (bool clears)
 Toggles whether Esc button clears the line edit. More...
 

Detailed Description

Provides a "clear text" action for line edits.

Using this class is as simple as this:

QLineEdit *edit = ...; // or some QLineEdit-derived class
new ClearLineEditAddon { proxy, edit }; // proxy is the one passed to IInfo::Init()

The constructor takes a pointer to the proxy object that is passed to IInfo::Init() method of the plugin instance object and the pointer to the line edit where the addon should be installed.

The line edit takes the ownership of the addon, so there is no need to keep track of it or explicitly delete it.

See also
IInfo::Init()

Definition at line 65 of file clearlineeditaddon.h.

Constructor & Destructor Documentation

◆ ClearLineEditAddon() [1/2]

LC::Util::ClearLineEditAddon::ClearLineEditAddon ( ICoreProxy_ptr  proxy,
QLineEdit *  edit 
)

Creates the addon and installs it on the given edit.

Please note that if you want to use this addon with other buttons on the line edit you may consider using another constructor overload, taking an additional LineEditButtonManager parameter.

Parameters
[in]proxyThe proxy passed to IInfo::Init() of the plugin.
[in]editThe line edit to install this addon into. The edit takes ownership of the addon.

Definition at line 43 of file clearlineeditaddon.cpp.

◆ ClearLineEditAddon() [2/2]

LC::Util::ClearLineEditAddon::ClearLineEditAddon ( ICoreProxy_ptr  proxy,
QLineEdit *  edit,
LineEditButtonManager manager 
)

Creates the addon and installs it on the given edit.

This constructors allows the line edit addon to be used easily with other buttons installed on the line edit using the passed button manager.

Parameters
[in]proxyThe proxy passed to IInfo::Init() of the plugin.
[in]editThe line edit to install this addon into. The edit takes ownership of the addon.
[in]managerThe line edit button manager to use instead of the default internal one.

Definition at line 48 of file clearlineeditaddon.cpp.

Member Function Documentation

◆ SetEscClearsEdit()

void LC::Util::ClearLineEditAddon::SetEscClearsEdit ( bool  clears)

Toggles whether Esc button clears the line edit.

By default, Esc clears the line edit.

Parameters
[in]clearsWhether pressing Esc should clear the line edit.

Definition at line 85 of file clearlineeditaddon.cpp.


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