Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Editor created by QStyledItemDelegate is not inheriting container width

Editor created by QStyledItemDelegate is not inheriting container width

Scheduled Pinned Locked Moved Solved General and Desktop
qstyleditemdeleeditordelegate
2 Posts 1 Posters 928 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Colin James
    wrote on last edited by Colin James
    #1

    I'm currently working on a program that has an editor component built on a QListView that uses a QStyledItemDelegate to draw the item in the list. I'm using createEditor to create another widget for editing the selected list item's contents but, no matter what widget I use, it does not inherit the full width of the list cell.

    I've looked at all the layout and geometry settings to no avail.
    Below is an image that demonstrates the issue:
    0_1560855451433_Screenshot from 2019-06-18 11-56-26.png

    As you can see, the editor widget is offset to the left by quite a bit. My understanding was that the editor is just an overlay and should inherit the region/rect that the delegate has.

    Any insight would be much appreciated.

    C 1 Reply Last reply
    1
    • C Colin James

      I'm currently working on a program that has an editor component built on a QListView that uses a QStyledItemDelegate to draw the item in the list. I'm using createEditor to create another widget for editing the selected list item's contents but, no matter what widget I use, it does not inherit the full width of the list cell.

      I've looked at all the layout and geometry settings to no avail.
      Below is an image that demonstrates the issue:
      0_1560855451433_Screenshot from 2019-06-18 11-56-26.png

      As you can see, the editor widget is offset to the left by quite a bit. My understanding was that the editor is just an overlay and should inherit the region/rect that the delegate has.

      Any insight would be much appreciated.

      C Offline
      C Offline
      Colin James
      wrote on last edited by
      #2

      I eventually managed to fix this by implementing updateEditorGeometry and calling editor->setGeometry(option.rect);. I should have looked into base class member functions sooner!

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved