[Interest] Why I still prefer widgets...

Furkan Üzümcü furkanuzumcu at gmail.com
Tue Sep 10 21:06:57 CEST 2019

If you look into how ComboBox is styled in the code, you’ll notice that the implicit size of the combo box depends on the implicit size of the background, implicit size of the content item, and the padding/inset that’s set for the ComboBox. In order to achieve what you are describing, you can customize the contentItem property of the ComboBox to disable eliding.

By default, ComboBox uses TextField as the content item and thus the behaviour you see. Also, although not 100% related, check out QtQuick.Layouts. Layout attach property provides some useful functionality for that as well.

Furkan Üzümcü
On Sep 10, 2019, 14:54 -0400, Jason H , wrote:
> ComboBox {
> anchors {
> top: parent.top
> right: parent.right
> }
> model: Object.keys(Data.imeis) // and IMEI is 15 characters long
> }
> I feel like when I did this with widgets, the combobox, if set to preferred (default) would size itself to fit the content. But in QML I get elided text.
> So how to compute the proper width? Well I've got to dive into FontMetrics and it's just_so_much_more_work. I hope I'm wrong.
> What I would give for a sizePolicy!
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190910/551a4c12/attachment.html>

More information about the Interest mailing list