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. Help with setting value in QStyledItemDelegate combobox
Forum Updated to NodeBB v4.3 + New Features

Help with setting value in QStyledItemDelegate combobox

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.1k Views 1 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.
  • D Offline
    D Offline
    DBoosalis
    wrote on last edited by
    #1

    I want to programaticlly set the value(display text) of a QStandardItem. The QTable uses QStyledItemDelegate which makes use of QComboBox in the createEditor method to offer a drop down selection( Note: items do not have the same list of items in their edit->combobox). Based on certain actions of my program I would like to set the index from the QStyleItemDelegate->editor's->QComboBox.

    So I guess my question is - how would I set the value to say index 1 of the combobox for a QStandardItem.

    Hope this is easy to do. Any suggestions very much appreciated

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

      Hi,

      What kind of action would that be to modify your QComboBox's index ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DBoosalis
        wrote on last edited by
        #3

        Hi and thanks for taking the time to inquire. First it is actually a QTreeView I am using and not a QTableView (my mistake). I have a copy button in the toolbar and the idea is to copy one item in the tree, so I want to walk the source item and all of its children and its children, etc. I have no problem making the items but when it comes to setting the values where an item is a combox box is my question.

        Sorry for the double post with my question, I thought this thread was deleted when that nutcase hijacked my thread with his crusade against Digia

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Don't worry about your threads, only his posts get deleted.

          Then next question, were does the data from your combo box come from ? If I understand your correctly, the content of the combo box should be the current value stored in the model when you start editing ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

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