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. Changing editor size in QStyledItemDelegate

Changing editor size in QStyledItemDelegate

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 925 Views 2 Watching
  • 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.
  • G Offline
    G Offline
    gabor53
    wrote on last edited by
    #1

    Hi,
    I have a QStandardItemModel with QStyledItemDelegate. Because the records include pictures the rows are quite high and the editors (QLineEdit, QTextEdit, QComboBox) don't look too good. Is it possible to change the size of these editors somehow? Especially their height.
    Thank you.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Can you try in
      In
      ::createEditor(QWidget *parent,
      const QStyleOptionViewItem &option,
      const QModelIndex &index) const
      ....
      StarEditor *editor = new StarEditor(parent); // Create editor
      editor->resize( option.rect.width(), option.rect.height() )
      ....

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        I think reimplementing sizeHint in the delegate should be enough

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        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