Results 1 to 2 of 2

Thread: QLineEdit too short when editing item in QTreeView

  1. #1
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QLineEdit too short when editing item in QTreeView

    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:

    Qt Code:
    1. treeViewStyleSheet = """
    2. QTreeView {
    3. alternate-background-color: #eff0f0;
    4. background: #f7f8f9;
    5. }
    6. QTreeView::item {
    7. font: 400 14pt "Source Sans Pro";
    8. padding:4px;
    9. selection-color: #ffffff;
    10. selection-background-color: #0071c5;
    11. }
    12. """
    To copy to clipboard, switch view to plain text mode 
    When viewing items, everything looks fine - spacing is good, looks exactly the way I want
    treeview_normal.png

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

    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?
    Last edited by d_stranz; 19th August 2021 at 16:35.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QLineEdit too short when editing item in QTreeView

    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
    Qt Code:
    1. QTreeView::item::selected::active
    To copy to clipboard, switch view to plain text mode 
    state and set the padding to zero. Don't know if this will work.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QLineEdit for editing hexadecimal and decimal numbers
    By schall_l in forum Qt Programming
    Replies: 2
    Last Post: 28th April 2012, 12:38
  2. editing string in QLineEdit with QRegExpValidator
    By Al_ in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2012, 11:51
  3. Editing QLineEdit boxes with QSignalMapper class.
    By savaliya_ambani in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 2nd October 2010, 08:20
  4. Editing problem in QTreeView
    By ugurkoltuk in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2010, 08:09
  5. QTreeView and item editing
    By roxton in forum Qt Programming
    Replies: 3
    Last Post: 25th July 2008, 19:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.