Engauge Digitizer 2
Loading...
Searching...
No Matches
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.
 ~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.
virtual void leaveEvent (QEvent *)
 Hover exit triggers restoration of the background color.
void updateBackground ()
 Update background given the current state.

Detailed Description

Adds hover highlighting to QLineEdit.

Definition at line 15 of file DlgEditPointGraphLineEdit.h.

Constructor & Destructor Documentation

◆ DlgEditPointGraphLineEdit()

DlgEditPointGraphLineEdit::DlgEditPointGraphLineEdit ( QWidget * widget = 0)

Single constructor.

Definition at line 11 of file DlgEditPointGraphLineEdit.cpp.

11 :
12 QLineEdit (widget),
13 m_hover (false)
14{
15 LOG4CPP_INFO_S ((*mainCat)) << "DlgEditPointGraphLineEdit::DlgEditPointGraphLineEdit";
16}
log4cpp::Category * mainCat
Definition Logger.cpp:14
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ ~DlgEditPointGraphLineEdit()

DlgEditPointGraphLineEdit::~DlgEditPointGraphLineEdit ( )

Definition at line 18 of file DlgEditPointGraphLineEdit.cpp.

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

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 23 of file DlgEditPointGraphLineEdit.cpp.

24{
25 m_hover = true;
27}
void updateBackground()
Update background given the current state.

◆ leaveEvent()

void DlgEditPointGraphLineEdit::leaveEvent ( QEvent * )
virtual

Hover exit triggers restoration of the background color.

Definition at line 29 of file DlgEditPointGraphLineEdit.cpp.

30{
31 m_hover = false;
33}

◆ updateBackground()

void DlgEditPointGraphLineEdit::updateBackground ( )

Update background given the current state.

Definition at line 35 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);
40}

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