Results 1 to 3 of 3

Thread: QCheckBox on QDataWidgetMapper

  1. #1
    Join Date
    Jan 2008
    Posts
    39
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default QCheckBox on QDataWidgetMapper

    Hello

    I am building an application using PyQt and SQLite3.

    I need the equivalent of a boolean datatype which is not available in sqlite so I am using an integer field. I have a QCheckbox on my dialogue which is used to display/set the value of this field using a QDataWidgetMapper.

    My question is do I need to overide data, setdata in my model so that the value of this field is displayed/stored correctly in the dialogue. At the moment I am getting what looks like html. I am assuming that is because the default delegate can't interpret the integer field correctly for the checkbox.

    Thanks in advance.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCheckBox on QDataWidgetMapper

    Inherit the model class. In that class make ur own display function. Call this function instead of the setData function.
    Pseudo code -
    Qt Code:
    1. class myModel :public someModel
    2. {
    3. private :
    4. setData() ; // original setData . Redeclaring it in private will make it private.
    5.  
    6. public :
    7. mySetData()
    8. {
    9. // do ur conversion
    10. setData(); call the private method
    11. }
    12. };
    To copy to clipboard, switch view to plain text mode 

    Hope u get the idea

  3. The following user says thank you to aamer4yu for this useful post:

    Banjo (5th June 2008)

  4. #3
    Join Date
    Jan 2008
    Posts
    39
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QCheckBox on QDataWidgetMapper

    Hello
    Thanks for that. I had a bit of a closer look and found that the QTextEdit is where the html is coming from so I just upgraded and now use QPlainTextEdit.
    Last edited by Banjo; 5th June 2008 at 06:06.

Similar Threads

  1. QDataWidgetmapper
    By locus in forum Qt Programming
    Replies: 7
    Last Post: 5th June 2012, 11:24
  2. inserting QCheckBox into the Header
    By ru_core in forum Qt Programming
    Replies: 16
    Last Post: 16th April 2008, 19:26
  3. Replies: 3
    Last Post: 21st January 2008, 12:22
  4. QDataWidgetMapper and QSqlRelationalTableModel problem
    By larry104 in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2007, 15:46
  5. QDataWidgetMapper <=> QComboBox best practice
    By saknopper in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2007, 10:50

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.