Class SBGActionSearchButton#
ClassList > SBGActionSearchButton
This class is a convenience widget that represents a push button associated with a line edit for search. More...
#include <SBGActionSearchButton.hpp>
Inherits the following classes: QPushButton
Public Slots#
| Type | Name |
|---|---|
| slot void | onTextChanged Handles the text changed signal. |
Public Functions#
| Type | Name |
|---|---|
| SBGActionSearchButton (QLineEdit * lineEdit, QWidget * parent=nullptr) Builds an action search button associated with the lineEdit . |
|
| virtual | ~SBGActionSearchButton () Destructor. |
Protected Functions#
| Type | Name |
|---|---|
| virtual bool | event (QEvent * e) override Handles events. |
| virtual void | mousePressEvent (QMouseEvent * event) override Handles mouse events. |
Detailed Description#
It automatically changes its icon depending on the text changes in the associated line edit, and it on clicking it clears the line edit.
Short name: SBActionSearchButton
Public Slots Documentation#
slot onTextChanged#
Handles the text changed signal.
Updates the button icon and tooltip based on the current text of the associated line edit.
This slot is called whenever the text in the associated line edit changes.
Public Functions Documentation#
function SBGActionSearchButton#
Builds an action search button associated with the lineEdit .
Constructs a search button associated with a line edit.
If you want to add this button to your search line edit, then create it with passing the line edit object and add this button in the same horizontal layout next to the line edit.
// create the search button associated with the search lineEdit
SBGActionSearchButton* lineEditSearchButton = new SBGActionSearchButton(lineEdit);
// add the search button in the same horizontal layout with the line edit
ui.horizontalLayoutLineEditSearch->addWidget(lineEditSearchButton);
Clicking on the clear button will clear the line edit.
Parameters:
lineEditThe line edit widget to associate with the button.parentOptional parent widget.
function ~SBGActionSearchButton#
Destructor.
Destroys the search button and releases its resources.
Protected Functions Documentation#
function event#
Handles events.
Handles generic events for the button, updating the icon on hover when there is text.
This method changes the button icon when the mouse enters or leaves the button while the associated line edit contains text.
Parameters:
eThe event to be processed.
Returns:
The result of the base class event handling.
function mousePressEvent#
Handles mouse events.
Handles mouse press events for the button.
Clears the associated line edit when the button is clicked and sets focus to it.
Parameters:
eventThe mouse press event.