Results 1 to 2 of 2

Thread: ComboBox default value

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2016
    Posts
    81
    Thanks
    31
    Qt products
    Qt5
    Platforms
    Windows

    Default ComboBox default value

    Hi,
    I want to set default value for combobox. But "find" method returns -1.
    Qt Code:
    1. MyComboBox{
    2. id:cmbZoom
    3. model:XmlListModel {
    4. id: xmlZoomModel
    5. source: "files/zoom.XML"
    6. query: "/tbl_zoomCalib/record"
    7. XmlRole { name: "text"; query: "@zoom/string()" }
    8. XmlRole { name: "value"; query: "@number/string()" }
    9. }
    10. textRole: "text"
    11. onCurrentIndexChanged: {
    12. myXML.newZoom=xmlZoomModel.get(currentIndex).text;
    13. }
    14. Component.onCompleted: {
    15. currentIndex=cmbZoom.find("20");
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by neda; 5th April 2016 at 08:20.

Similar Threads

  1. Color ComboBox
    By ioannis in forum Qt Programming
    Replies: 14
    Last Post: 23rd March 2016, 07:08
  2. how do I use comboBox
    By QT++ in forum Newbie
    Replies: 5
    Last Post: 2nd July 2013, 14:13
  3. Help ComboBox
    By vinny gracindo in forum Newbie
    Replies: 3
    Last Post: 20th November 2009, 19:41
  4. ComboBox of bmp:s
    By SailinShoes in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2008, 15:22
  5. Color combobox
    By chguy2 in forum Qt Programming
    Replies: 9
    Last Post: 5th April 2007, 14:23

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.