[PyQt] Setting QComboBox "clicked on" width

Nick Gaens mail at nickgaens.com
Thu May 27 12:08:12 BST 2010


Hello, try something like:

self.comboBox.currentIndexChanged.connect(self.onCurrentIndexChanged)


> def onCurrentIndexChanged(self, newIndex):

    self.comboBox.adjustSize() # Don't know if this works automagically, but
> given the newIndex argument,

                                                you could fetch the current
> selected string and calculate the required width yourself in the worst case



On Thu, May 27, 2010 at 12:01 PM, aaron barclay <aaron.diplopic at gmail.com>wrote:

> Hello,
>
> I am having trouble setting a QComboBox. I would like the ComboBox to be
> quite narrow, that is easy enough, but when clicked on I would like the
> combobox to expand the listed results to full width of the text. Is this
> possible? Any help appreciated.
>
> Regards,
> aaron.
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
Nick Gaens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100527/be785961/attachment.html>


More information about the PyQt mailing list