Web Analytics Made Easy - Statcounter
Skip to content

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.

void SBGActionSearchButton::onTextChanged;


Public Functions Documentation#

function SBGActionSearchButton#

Builds an action search button associated with the lineEdit .

SBGActionSearchButton::SBGActionSearchButton (
    QLineEdit * lineEdit,
    QWidget * parent=nullptr
) 

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.


function ~SBGActionSearchButton#

Destructor.

virtual SBGActionSearchButton::~SBGActionSearchButton () 


Protected Functions Documentation#

function event#

Handles events.

virtual bool SBGActionSearchButton::event (
    QEvent * e
) override


function mousePressEvent#

Handles mouse events.

virtual void SBGActionSearchButton::mousePressEvent (
    QMouseEvent * event
) override