Results 1 to 2 of 2

Thread: Access QDoubleSpinBox in QTableView / MyTableModel

  1. #1
    Join Date
    Dec 2016
    Location
    New England, US
    Posts
    31
    Thanks
    6
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Access QDoubleSpinBox in QTableView / MyTableModel

    MyTableModel, a subclass of QAbstractTableModel, consists entirely of doubles, and is the model for my QTableView. I have made the table editable, and I see that the QDoubleSpinBox editor is installed in the table view with 2 decimal places. I want to setDecimals(6).

    The question is how and where do I access the installed editor QDoubleSpinBox so that I can change the number of decimal places?

    If I cannot access the installed editor, I believe I have to subclass QStyledItemDelegate and provide QDoubleSpinBox editor in the createEditor method. Of course, set this item delegate on the QTableView cells. Please confirm.

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Access QDoubleSpinBox in QTableView / MyTableModel

    Yes, I think you'll have to do a custom delegate.

    Cheers,
    _

Similar Threads

  1. QDoubleSpinBox
    By prashant in forum Qt Programming
    Replies: 0
    Last Post: 7th October 2009, 17:30
  2. QDoubleSpinBox rounding
    By Talkless in forum Qt Programming
    Replies: 1
    Last Post: 7th January 2009, 13:40
  3. QDoubleSpinBox and QDoubleValidator
    By George Neil in forum Qt Programming
    Replies: 1
    Last Post: 26th June 2008, 01:36
  4. QDoubleSpinBox
    By coderbob in forum Qt Programming
    Replies: 6
    Last Post: 20th March 2008, 12:30
  5. Qt4.2.2 QDoubleSpinBox QSpinBox
    By TheKedge in forum Qt Programming
    Replies: 4
    Last Post: 15th October 2007, 22:27

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.