keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
20.91k stars 1.44k forks source link

Entry edit: Tag list border not following style #7447

Open schlimmchen opened 2 years ago

schlimmchen commented 2 years ago

Overview

Border of tag list edit widget is not yet handled properly.

Steps to Reproduce

Select dark theme (the issue is still valid for the light theme, but the intermediate border is only visible with the dark theme). Edit entry. Observe the tag list edit widget style that does not blend in with the remaining text inputs.

Screenshot from 2022-02-21 17-11-56

Expected Behavior

The input field's style shall be similar to the other inputs. The border color shall be highlighted when the tags list is focused/being edited.

Actual Behavior

No focus based hightlighting, intermediate border/spacing around viewport.

Context

It seems the new input class TagsEdit is just not handled in BaseStyle.cpp? I could not find where or how the other inputs get their highlighted border, but it seems it's handled there?

The situation improves with this patch:

From e21720ee335262a0e6b925b167a3a9904e02713f Mon Sep 17 00:00:00 2001
From: Bernhard Kirchen <schlimmchen@posteo.net>
Date: Mon, 21 Feb 2022 17:09:28 +0100
Subject: [PATCH] WIP: fix border of tag edit widget in entry edit view

---
 src/gui/styles/base/basestyle.qss | 4 ++++
 src/gui/tag/TagsEdit.cpp          | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gui/styles/base/basestyle.qss b/src/gui/styles/base/basestyle.qss
index 545980f8..1f029736 100644
--- a/src/gui/styles/base/basestyle.qss
+++ b/src/gui/styles/base/basestyle.qss
@@ -30,6 +30,10 @@ DatabaseWidget, DatabaseWidget #groupView, DatabaseWidget #tagView {
     border: none;
 }

+EditEntryWidget TagsEdit {
+    border: 1px solid palette(light);
+}
+
 EntryPreviewWidget QLineEdit, EntryPreviewWidget QTextEdit,
 EntryPreviewWidget TagsEdit
 {
diff --git a/src/gui/tag/TagsEdit.cpp b/src/gui/tag/TagsEdit.cpp
index b4bfb7f7..73919fbe 100644
--- a/src/gui/tag/TagsEdit.cpp
+++ b/src/gui/tag/TagsEdit.cpp
@@ -598,7 +598,7 @@ TagsEdit::TagsEdit(QWidget* parent)
     impl->setCursorVisible(hasFocus());
     impl->updateDisplayText();

-    viewport()->setContentsMargins(1, 1, 1, 1);
+    viewport()->setContentsMargins(3, 3, 3, 3);
 }

 TagsEdit::~TagsEdit() = default;
-- 
2.34.1

Screenshot from 2022-02-21 17-29-26

However, I am pretty sure that is the wrong approach. And it does not add a focus highlight.

Revision: bfbc0e5e Operating System: Linux Desktop Env: Gnome Windowing System: Wayland

droidmonkey commented 2 years ago

That widget defines its own paint and might be missing a couple pieces