Results 1 to 5 of 5

Thread: SQL and QItemDelegate problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: SQL and QItemDelegate problem

    Quote Originally Posted by vieraci View Post
    Yes I could do that, but I'm trying not to duplicate the data un-necessarily.
    You are not duplicating data.
    And then I can fill the combo box with data after I create it...

    Qt Code:
    1. ComboBoxDelegate *delegate = new ComboBoxDelegate(this);
    2. delegate->addItem(string, int);
    3. delegate->setEditColumn(int);
    To copy to clipboard, switch view to plain text mode 
    This way the class is re-useable
    This way you do duplicate data :-) Just fetch the data into the model in your delegate's constructor and then set the model on a combo box in createEditor or in setEditorData using QComboBox::setModel().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. The following user says thank you to wysota for this useful post:

    vieraci (31st May 2009)

  3. #2
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    29
    Thanked 5 Times in 5 Posts

    Lightbulb Solved: SQL and QItemDelegate problem

    Of course ! Why didn't I think of it myself...
    Create the QSqlQueryModel in the constructor, then the rest is as you said.

    Thanks again wysota.

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
  •  
Qt is a trademark of The Qt Company.