Results 1 to 10 of 10

Thread: ItemDelegate show text intead of number

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: ItemDelegate show text intead of number

    Your delegate can paint whatever you want, no need to change the view

    Cheers,
    _

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

    ^NyAw^ (6th March 2015)

  3. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: ItemDelegate show text intead of number

    Hi,

    My Delegate shows what I want and I have editors like QComboBox working well. The problem now is that I don't know how to show my own editor.

    What I have done is to create a QWidget inherited class that contains some checkBoxes (created using QtDesigner). On "createEditor" method I create a object of this class an return it as editor. I can see(on debugger) that the editor is initialized well but it is not displayed. So the problem now is to display the widget that I created on QtDesigner.

    Thanks,
    Òscar Llarch i Galán

  4. #3
    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: ItemDelegate show text intead of number

    What have you checked already?

    That the constructor of the editor widget is called?
    That the showEvent() method of the widget is called?

    Cheers,
    _

  5. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: ItemDelegate show text intead of number

    Hi,

    Searching in the forum I found this http://www.qtcentre.org/threads/5420...ditor+delegate that explains that the problem is because the size of my widget is grater than the available space.

    My widget is greater than the cell space and I want to show the widget like a popup widget that overlays the cell. It's something like the attached imageCustom Delegate.png

    Thanks,
    Òscar Llarch i Galán

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

    Default Re: ItemDelegate show text intead of number

    It's very unusual to do something like that. Usually you'd use a combobox to show such a large list. Are those options mutually exclusive or not?
    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.


  7. #6
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: ItemDelegate show text intead of number

    Hi,

    The options are to select the Outputs of an acquisition card. The user can select wich Outputs to be active on each case.
    For example, on case 0 the user could select to enable the out0 and out1 and on case 1 enable out1, so the outs are not exclusive.

    Thanks,
    Last edited by ^NyAw^; 16th March 2015 at 09:59.
    Òscar Llarch i Galán

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

    Default Re: ItemDelegate show text intead of number

    You can follow the same rule that QComboBox follows -- make your editor open a popup window which lists the outputs to be selected. Alternatively just use a combo box with a model with checkable entries.
    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.


  9. #8
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: ItemDelegate show text intead of number

    Hi,

    You can follow the same rule that QComboBox follows -- make your editor open a popup window which lists the outputs to be selected
    I have been inspectiong QComboBox code but I'm not able to understand why its able to show the list of items.

    Alternatively just use a combo box with a model with checkable entries.
    This is what I'm trying with no luck.

    Thanks,
    Òscar Llarch i Galán

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

    Default Re: ItemDelegate show text intead of number

    Quote Originally Posted by ^NyAw^ View Post
    I have been inspectiong QComboBox code but I'm not able to understand why its able to show the list of items.
    When you click it, it shows another widget which happens to be a QListView showing a model of its items.

    This is what I'm trying with no luck.
    Just set a custom model on the combobox.
    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.


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

    ^NyAw^ (17th March 2015)

Similar Threads

  1. Number to Text
    By Markov in forum Newbie
    Replies: 2
    Last Post: 22nd February 2017, 09:16
  2. Replies: 4
    Last Post: 18th December 2013, 20:02
  3. Qt line number in text editor
    By Nyx in forum Qt Programming
    Replies: 6
    Last Post: 24th August 2010, 10:16
  4. qdirmodel question: show file number of a folder?
    By zl2k in forum Qt Programming
    Replies: 3
    Last Post: 7th November 2008, 07:07
  5. Replies: 4
    Last Post: 22nd August 2008, 10:08

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.