mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Fix error background color for URLs
This commit is contained in:
parent
a88fe61a7b
commit
c511cb518c
@ -24,8 +24,7 @@
|
|||||||
#include "core/Resources.h"
|
#include "core/Resources.h"
|
||||||
#include "core/Tools.h"
|
#include "core/Tools.h"
|
||||||
#include "gui/Font.h"
|
#include "gui/Font.h"
|
||||||
|
#include "gui/styles/StateColorPalette.h"
|
||||||
const QColor URLEdit::ErrorColor = QColor(255, 125, 125);
|
|
||||||
|
|
||||||
URLEdit::URLEdit(QWidget* parent)
|
URLEdit::URLEdit(QWidget* parent)
|
||||||
: QLineEdit(parent)
|
: QLineEdit(parent)
|
||||||
@ -50,7 +49,9 @@ void URLEdit::updateStylesheet()
|
|||||||
const QString stylesheetTemplate("QLineEdit { background: %1; }");
|
const QString stylesheetTemplate("QLineEdit { background: %1; }");
|
||||||
|
|
||||||
if (!Tools::checkUrlValid(text())) {
|
if (!Tools::checkUrlValid(text())) {
|
||||||
setStyleSheet(stylesheetTemplate.arg(ErrorColor.name()));
|
StateColorPalette statePalette;
|
||||||
|
QColor color = statePalette.color(StateColorPalette::ColorRole::Error);
|
||||||
|
setStyleSheet(stylesheetTemplate.arg(color.name()));
|
||||||
m_errorAction->setVisible(true);
|
m_errorAction->setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
m_errorAction->setVisible(false);
|
m_errorAction->setVisible(false);
|
||||||
|
@ -28,8 +28,6 @@ class URLEdit : public QLineEdit
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const QColor ErrorColor;
|
|
||||||
|
|
||||||
explicit URLEdit(QWidget* parent = nullptr);
|
explicit URLEdit(QWidget* parent = nullptr);
|
||||||
void enableVerifyMode();
|
void enableVerifyMode();
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/Resources.h"
|
#include "core/Resources.h"
|
||||||
#include "core/Tools.h"
|
#include "core/Tools.h"
|
||||||
|
#include "gui/styles/StateColorPalette.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -70,7 +71,8 @@ QVariant EntryURLModel::data(const QModelIndex& index, int role) const
|
|||||||
const auto urlValid = Tools::checkUrlValid(value);
|
const auto urlValid = Tools::checkUrlValid(value);
|
||||||
|
|
||||||
if (role == Qt::BackgroundRole && !urlValid) {
|
if (role == Qt::BackgroundRole && !urlValid) {
|
||||||
return QColor(255, 125, 125);
|
StateColorPalette statePalette;
|
||||||
|
return statePalette.color(StateColorPalette::ColorRole::Error);
|
||||||
} else if (role == Qt::DecorationRole && !urlValid) {
|
} else if (role == Qt::DecorationRole && !urlValid) {
|
||||||
return m_errorIcon;
|
return m_errorIcon;
|
||||||
} else if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
} else if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||||
|
Loading…
Reference in New Issue
Block a user