itom
Loading...
Searching...
No Matches
SearchBox Class Reference

#include <searchBox.h>

Inheritance diagram for SearchBox:

Public Types

typedef QLineEdit Superclass
 Superclass typedef.
 

Public Member Functions

 SearchBox (QWidget *parent=0)
 
QString placeholderText () const
 
void setPlaceholderText (const QString &defaultText)
 
void setShowSearchIcon (bool show)
 False by default.
 
bool showSearchIcon () const
 
void setAlwaysShowClearIcon (bool show)
 False by default.
 
bool alwaysShowClearIcon () const
 
void setSearchIcon (const QIcon &icon)
 Set the search icon.
 
QIcon searchIcon () const
 Get the current search icon.
 
void setClearIcon (const QIcon &icon)
 Set the clear icon.
 
QIcon clearIcon () const
 Get the current clear icon.
 

Protected Slots

void updateClearButtonState ()
 Change the clear icon's state to enabled or disabled.
 

Protected Member Functions

virtual void paintEvent (QPaintEvent *)
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void resizeEvent (QResizeEvent *event)
 

Protected Attributes

QScopedPointer< SearchBoxPrivated_ptr
 

Properties

QString placeholderText
 
bool showSearchIcon
 
QIcon searchIcon
 
QIcon clearIcon
 

Private Member Functions

 Q_DECLARE_PRIVATE (SearchBox)
 
 Q_DISABLE_COPY (SearchBox)
 

Detailed Description

QLineEdit with two QIcons on each side: search and clear. "Search" selects all the text "Clear" clears the current text See QLineEdit::text to set/get the current text. SearchBox's purpose is to be used to filter other widgets. e.g.: SearchBox searchBox; QSortFilterProxyModel filterModel; QObject::connect(&searchBox, SIGNAL(textChanged(QString)), &filterModel, SLOT(setFilterFixedString(QString))); ...

Property Documentation

◆ clearIcon

QIcon SearchBox::clearIcon
readwrite

The QIcon to use for the clear icon. The default is a round grey button with a white cross.

◆ placeholderText

QString SearchBox::placeholderText
readwrite

Qt < 4.7 don't have a placeholderText property, as we need it, we define it manually.

◆ searchIcon

QIcon SearchBox::searchIcon
readwrite

The QIcon to use for the search icon at the left. The default is a magnifying glass icon.

◆ showSearchIcon

bool SearchBox::showSearchIcon
readwrite

Show an icon at left side of the line edit, indicating that the text field is used to search/filter something. The default is false.


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