Engauge Digitizer  2
DlgEditPointGraphLineEdit.cpp
1 /******************************************************************************************************
2  * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #include "DlgEditPointGraphLineEdit.h"
8 #include "Logger.h"
9 #include <QWidget>
10 
12  QLineEdit (widget),
13  m_hover (false)
14 {
15  LOG4CPP_INFO_S ((*mainCat)) << "DlgEditPointGraphLineEdit::DlgEditPointGraphLineEdit";
16 }
17 
18 DlgEditPointGraphLineEdit::~DlgEditPointGraphLineEdit()
19 {
20  LOG4CPP_INFO_S ((*mainCat)) << "DlgEditPointGraphLineEdit::~DlgEditPointGraphLineEdit";
21 }
22 
24 {
25  m_hover = true;
27 }
28 
30 {
31  m_hover = false;
33 }
34 
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 }
void updateBackground()
Update background given the current state.
virtual void enterEvent(QEvent *)
Hover entry triggers clearing of the background color so user does not think of widget as disabled an...
virtual void leaveEvent(QEvent *)
Hover exit triggers restoration of the background color.
DlgEditPointGraphLineEdit(QWidget *widget=0)
Single constructor.