[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Combobox with Multiple Columns
From:       Willem Buitendyk <willem () pcfish ! ca>
Date:       2015-05-19 21:33:34
Message-ID: 9DC0CCC2-4077-4BAF-8F14-040D4393F526 () pcfish ! ca
[Download RAW message or body]

Thanks Dave.

I actually just figured this out before lunch and have it working as you suggest with \
QTableView.  In my case, I've just set the query so that the first field is the one I \
want the value from.  Works very well.  I also hide the horizontal and vertical \
header for a cleaner look.

Cheers,

Willem



> On May 19, 2015, at 1:36 PM, David Boddie <david@boddie.org.uk> wrote:
> 
> On Mon, 18 May 2015 20:28:59 -0700, Willem Buitendyk wrote:
> 
> > Newbie here.
> > 
> > I'm trying to find information on populating a QComobox with multiple
> > columns from a datasource.  I can currently populate using: 
> > 
> > setModelColumn(self.model.fieldIndex("some_field_name"))
> > 
> > I would like to have the combobox display two columns for each row but only
> > return the value in the first column.
> 
> You should be able to replace the view with a QTableView using the
> QComboBox's setView() method. You will probably have to configure it to
> show things exactly the way you want them.
> 
> As to only getting values from the first column, I'm not sure how the view
> affects this so it may just work with the setModelColumn() call you used
> but I've not tried this.
> 
> David
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic