ShortcutEdit styling rework
This commit is contained in:
parent
7c7b2ef2d5
commit
b0dd282d92
|
@ -1,8 +1,10 @@
|
|||
#include "ShortcutEdit.h"
|
||||
#include <QStyle>
|
||||
|
||||
ShortcutEdit::ShortcutEdit(QWidget* parent) : QLineEdit(parent)
|
||||
{
|
||||
keyInt = -1;
|
||||
mError = true;
|
||||
}
|
||||
|
||||
const QKeySequence ShortcutEdit::getKeysequence() const
|
||||
|
@ -13,12 +15,17 @@ const QKeySequence ShortcutEdit::getKeysequence() const
|
|||
return QKeySequence(keyInt);
|
||||
}
|
||||
|
||||
bool ShortcutEdit::error() const
|
||||
{
|
||||
return mError;
|
||||
}
|
||||
|
||||
void ShortcutEdit::setErrorState(bool error)
|
||||
{
|
||||
if(error)
|
||||
setStyleSheet("color: #DD0000");
|
||||
else
|
||||
setStyleSheet("color: #222222");
|
||||
this->mError = error;
|
||||
|
||||
this->style()->unpolish(this);
|
||||
this->style()->polish(this);
|
||||
}
|
||||
|
||||
void ShortcutEdit::keyPressEvent(QKeyEvent* event)
|
||||
|
|
|
@ -8,11 +8,14 @@
|
|||
class ShortcutEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool error MEMBER mError READ error)
|
||||
int keyInt;
|
||||
bool mError;
|
||||
|
||||
public:
|
||||
explicit ShortcutEdit(QWidget* parent = 0);
|
||||
const QKeySequence getKeysequence() const;
|
||||
bool error() const;
|
||||
|
||||
public slots:
|
||||
void setErrorState(bool error);
|
||||
|
|
Loading…
Reference in New Issue