[Qt-creator] "promote to" for a custum (designer) widget

Jonas Eriksen Hjortlund JEH at pedax.com
Mon Jul 18 10:10:27 CEST 2016


Hi Eike
Thanks for your  input.
It turns out - it is possible with a (odd) workaround
https://forum.qt.io/topic/69356/custom-designer-plugin-and-the-promote-feature

Short story is to use a QDesignerCustomWidgetCollectionInterface
And add the widget -twice- to the list returned by customWidgets().
Then the menu is active.(?!)
Worked on both linux and windows. ( Qt 5.6)
Best regards


-----Original Message-----
From: Eike Ziller [mailto:Eike.Ziller at qt.io] 
Sent: 18. juli 2016 09:24
To: Jonas Eriksen Hjortlund
Cc: qt-creator at qt-project.org
Subject: Re: [Qt-creator] "promote to" for a custum (designer) widget


> On Jul 17, 2016, at 10:24 AM, Jonas Eriksen Hjortlund <JEH at pedax.com> wrote:
> 
> Hi
> I already asked this in user forum but no one seems to know why.
>  
> For test i used
> http://doc.qt.io/qt-5/qtdesigner-worldtimeclockplugin-example.html
>  
> It load and works as expected.
>  
> However, right clicking it, do not give
>  
> “Promote to..” menu item that is available for all other widgets. ?
>  
> How can I make the custom widget promotable ?
> Im sorry if its already in docs but I read it 3 times now and I see no 
> mention of How class can be promotable.

From http://doc.qt.io/qt-5/designer-using-custom-widgets.html#promoting-widgets :

"To add a placeholder, select an object of a suitable base class and choose Promote to ... from the form's context menu.”

It is not very clear on what “suitable” is, but from the previous mentions of "compare the API of the missing widget with those of standard Qt widgets” and "For specialized widgets that do not share a common API with standard Qt widgets,...” I’d conclude that “suitable base class” == “standard Qt widget”.

Br, Eike


--
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
+123 45 6789012
http://qt.io
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B





More information about the Qt-creator mailing list