Results 1 to 6 of 6

Thread: problem with comboBox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: problem with comboBox

    Quote Originally Posted by tinysoft View Post
    is there any way to do this in a simple way ?
    Yes, surely! But You still haven't said what the content of query is, what in your combo box is displayed etc...

    One (of some) improvements: use a do-while scope. (or for loop) So you can integrate the check of the first item

  2. #2
    Join Date
    Apr 2010
    Location
    Sudan
    Posts
    46
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with comboBox

    the query is containing numbers of employees , the combo box containing there names, so i sorted the query by the names alphabet like this :

    Qt Code:
    1. query.exec("select emp_no from employees order by name;");
    To copy to clipboard, switch view to plain text mode 

    i want to synchronize the line Edit with the combo box so when user enter number to the line edit , i should get the index of that number on the query and send the index to the combo box to be its current index number.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: problem with comboBox

    Instead of alway query the database set the id direct as user data to your combo box. then simply loop through the box and check there. Or if it is a long combo box create a local index hash.

  4. The following user says thank you to Lykurg for this useful post:

    tinysoft (3rd May 2010)

Similar Threads

  1. ComboBox Completer Index Problem
    By majatu in forum Qt Programming
    Replies: 3
    Last Post: 7th June 2009, 14:30
  2. Combobox style problem
    By zgulser in forum Qt Tools
    Replies: 5
    Last Post: 13th March 2009, 09:01
  3. [Qt 4.3.1]A problem with combobox style
    By Tamara in forum Qt Programming
    Replies: 3
    Last Post: 19th September 2007, 10:49
  4. color comboBox problem
    By chguy2 in forum Qt Programming
    Replies: 2
    Last Post: 22nd April 2007, 09:57
  5. Problem with a combobox
    By Tindor in forum Qt Programming
    Replies: 2
    Last Post: 22nd November 2006, 19:18

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.