PDA

View Full Version : QLineEdit too short when editing item in QTreeView



hakkman
18th August 2021, 21:19
I posted this in the "Newbie" forum a couple of days ago, but got no response.

I have a QTreeView control in my program. Everything looks great. The only stylesheet I have applied to it is this:



treeViewStyleSheet = """
QTreeView {
alternate-background-color: #eff0f0;
background: #f7f8f9;
}
QTreeView::item {
font: 400 14pt "Source Sans Pro";
padding:4px;
selection-color: #ffffff;
selection-background-color: #0071c5;
}
"""

When viewing items, everything looks fine - spacing is good, looks exactly the way I want
13703

When editing items, the QLineEdit is too short, and the underscores in the text become invisible.
13704

How can I make the edit control take up the full row height when a field is being edited without changing anything about how the tree looks when it's not being edited?

d_stranz
19th August 2021, 15:43
How can I make the edit control take up the full row height when a field is being edited

Try adding a style condition to handle the
QTreeView::item::selected::active state and set the padding to zero. Don't know if this will work.