[Qt-interest] Set a constraint on QComboBox [Make every item unique]

Robert Hairgrove evorgriahr at hispeed.ch
Sun Mar 14 07:49:43 CET 2010


Aaron Lewis wrote:
> Hi,
>    How can i make a QComboBox has no same entries ? I mean to set an
> restrict.
> 
>    If there's no such functions , i'd have to create one myself. (Before
> inserting into it , check the constraint)
> 
> Will appreciate your help ;-)
> 

 From another thread, I noticed that you are working with a database -- 
if you want to populate the combo box from a query result set, just 
write the query as "SELECT DISTINCT ... (whatever)...". Or if there is 
already a unique index on the column, then there will be no duplicates.

Things like this are much easier to enforce in the database back end.



More information about the Qt-interest-old mailing list