Engauge Digitizer  2
Public Member Functions | List of all members
DlgEditPointGraphLineEdit Class Reference

Adds hover highlighting to QLineEdit. More...

#include <DlgEditPointGraphLineEdit.h>

Inheritance diagram for DlgEditPointGraphLineEdit:
Inheritance graph
Collaboration diagram for DlgEditPointGraphLineEdit:
Collaboration graph

Public Member Functions

 DlgEditPointGraphLineEdit (QWidget *widget=0)
 Single constructor. More...
 
 ~DlgEditPointGraphLineEdit ()
 
virtual void enterEvent (QEvent *)
 Hover entry triggers clearing of the background color so user does not think of widget as disabled and is encouraged to enter text. More...
 
virtual void leaveEvent (QEvent *)
 Hover exit triggers restoration of the background color. More...
 
void updateBackground ()
 Update background given the current state. More...
 

Detailed Description

Adds hover highlighting to QLineEdit.

Definition at line 14 of file DlgEditPointGraphLineEdit.h.

Constructor & Destructor Documentation

◆ DlgEditPointGraphLineEdit()

DlgEditPointGraphLineEdit::DlgEditPointGraphLineEdit ( QWidget *  widget = 0)

Single constructor.

Definition at line 10 of file DlgEditPointGraphLineEdit.cpp.

11  :
12  QLineEdit (widget),
13  m_hover (false)
14 {
15  LOG4CPP_INFO_S ((*mainCat)) << "DlgEditPointGraphLineEdit::DlgEditPointGraphLineEdit";

◆ ~DlgEditPointGraphLineEdit()

DlgEditPointGraphLineEdit::~DlgEditPointGraphLineEdit ( )

Definition at line 17 of file DlgEditPointGraphLineEdit.cpp.

19 {
20  LOG4CPP_INFO_S ((*mainCat)) << "DlgEditPointGraphLineEdit::~DlgEditPointGraphLineEdit";

Member Function Documentation

◆ enterEvent()

void DlgEditPointGraphLineEdit::enterEvent ( QEvent *  )
virtual

Hover entry triggers clearing of the background color so user does not think of widget as disabled and is encouraged to enter text.

Definition at line 22 of file DlgEditPointGraphLineEdit.cpp.

24 {
25  m_hover = true;

◆ leaveEvent()

void DlgEditPointGraphLineEdit::leaveEvent ( QEvent *  )
virtual

Hover exit triggers restoration of the background color.

Definition at line 28 of file DlgEditPointGraphLineEdit.cpp.

30 {
31  m_hover = false;

◆ updateBackground()

void DlgEditPointGraphLineEdit::updateBackground ( )

Update background given the current state.

Definition at line 34 of file DlgEditPointGraphLineEdit.cpp.

36 {
37  QString color = (m_hover || !text().isEmpty() ? QString ("white") : QString ("#d3d3d3"));
38  QString style = QString ("QLineEdit { background-color: %1; }").arg (color);
39  setStyleSheet (style);

The documentation for this class was generated from the following files:
LOG4CPP_INFO_S
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
mainCat
log4cpp::Category * mainCat
Definition: Logger.cpp:14
DlgEditPointGraphLineEdit::updateBackground
void updateBackground()
Update background given the current state.
Definition: DlgEditPointGraphLineEdit.cpp:34