Results 1 to 4 of 4

Thread: QDataWidgetMapper does nothing on QComboBox when foreign key is null.

  1. #1
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QDataWidgetMapper does nothing on QComboBox when foreign key is null.

    Hello everyone,

    I feel quite disappointed about something obvious. It seems that there is no way to select item index -1 through a data mapper when the associated foreign key is NULL. I can't believe that the people who made that excellent framework did not think about that.

    Does anyone have a workaround for this situation ?

    Many thanks in advance !

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDataWidgetMapper does nothing on QComboBox when foreign key is null.

    Set a custom delegate on the widget mapper and reimplement setModelData() and setEditorData() for it. Then you can setup the combobox any way you want.
    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.


  3. #3
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDataWidgetMapper does nothing on QComboBox when foreign key is null.

    Thanks wysota. I met your answer on different pages. Sorry for that.

    But I realized that the problem is somewhere else: my relational model does not contain the records having a null foreign key. As far as I can see, I am screwed.

  4. #4
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDataWidgetMapper does nothing on QComboBox when foreign key is null.

    I finally got it. That page could be removed...

Similar Threads

  1. QDataWidgetMapper and QComboBox
    By buckadl in forum Qt Programming
    Replies: 0
    Last Post: 8th December 2010, 22:40
  2. Custom QLineEdit to store NULL with QDataWidgetMapper
    By certqt in forum Qt Programming
    Replies: 3
    Last Post: 9th November 2010, 14:15
  3. QDataWidgetMapper and QComboBox
    By mazurekwrc in forum Qt Programming
    Replies: 0
    Last Post: 31st March 2009, 14:02
  4. QDataWidgetMapper and QCombobox
    By miraks in forum Qt Programming
    Replies: 4
    Last Post: 6th December 2008, 18:53
  5. FOREIGN KEY + QComboBox
    By eleanor in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2007, 11:37

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.