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. Handle to factory edit widget

Handle to factory edit widget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 924 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 insert my own editor widget into a QTableView. I am trying to follow the lone example Qt offers which does it for a Color ComboBox.

    My issue is that I want a handle to the edit widget. IN the code below I want to get a pointer to ColorListEditor. Say for instance I want to change the colours dynamically and so want a pointer to the widget so I can call a method like 'resetColors(QStrList colors);

    Does anyone know how I can get such a handle to the created widget.

    Thanks

    @QItemEditorFactory *factory = new QItemEditorFactory;

    QItemEditorCreatorBase *colorListCreator =
        new QStandardItemEditorCreator<ColorListEditor>();
    
    // How do I get a handle to the newly created ColorListEditor ?
    
    factory->registerEditor(QVariant::Color, colorListCreator);
    
    QItemEditorFactory::setDefaultFactory(factory);@
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From quick look to the classes you would have to keep a pointer to your editor creator, update the color list there and apply it each time you create a new editor or you could create a QStyleItemDelegate where you set the list in createEditor.

      Hope it helps

      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

        Thanks

        I think I will just create a separate edit area below the table.

        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