mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-25 07:19:42 -05: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/Tools.h"
|
||||
#include "gui/Font.h"
|
||||
|
||||
const QColor URLEdit::ErrorColor = QColor(255, 125, 125);
|
||||
#include "gui/styles/StateColorPalette.h"
|
||||
|
||||
URLEdit::URLEdit(QWidget* parent)
|
||||
: QLineEdit(parent)
|
||||
@ -50,7 +49,9 @@ void URLEdit::updateStylesheet()
|
||||
const QString stylesheetTemplate("QLineEdit { background: %1; }");
|
||||
|
||||
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);
|
||||
} else {
|
||||
m_errorAction->setVisible(false);
|
||||
|
@ -28,8 +28,6 @@ class URLEdit : public QLineEdit
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const QColor ErrorColor;
|
||||
|
||||
explicit URLEdit(QWidget* parent = nullptr);
|
||||
void enableVerifyMode();
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "core/Entry.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/Tools.h"
|
||||
#include "gui/styles/StateColorPalette.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -70,7 +71,8 @@ QVariant EntryURLModel::data(const QModelIndex& index, int role) const
|
||||
const auto urlValid = Tools::checkUrlValid(value);
|
||||
|
||||
if (role == Qt::BackgroundRole && !urlValid) {
|
||||
return QColor(255, 125, 125);
|
||||
StateColorPalette statePalette;
|
||||
return statePalette.color(StateColorPalette::ColorRole::Error);
|
||||
} else if (role == Qt::DecorationRole && !urlValid) {
|
||||
return m_errorIcon;
|
||||
} else if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||
|
Loading…
Reference in New Issue
Block a user