Create/Preview Custom Widget without using forms

  • Hello,

    I have created custom widgets using forms before with great success. However, my current work project is to create custom widgets without the use of the form. Is there a way to preview the custom widget to see how it looks before actually building the plugin project, and then adding it to another application? Thanks!

  • Lifetime Qt Champion

    If you don't use UI file and all looks comes from code,
    how would you be able to
    preview it before code is running ?


    You can use promotion feature to see it running very easy without adding the an actual plugin. (to creator/designer)

    See "Promoting Widgets"

  • @mrjj

    The document you provided is a little confusing. I assume that the promotion feature is done on the application side? Is it possible to do so, while still in the development stage of the widget? Let's say I'm building a calculator, but I want to see how my layouts are looking so far, but my entire calculator widget is not yet complete. Is there a way to view what is created up to that point?

  • Lifetime Qt Champion

    @Sh1gs The promotion feature is for Qt Designer. That means it is used during designing your widget in Qt Designer. So, you would need to use Designer. As @mrjj said it is just not possible to preview widgets created manually in code without executing the app.

  • @jsulm

    I figured that was the case, but I wanted to be sure. I will just make a test application of the widget I want to create and when all that coding works, I'll go ahead and make the custom plugin. Thanks for your inputs!

  • Lifetime Qt Champion

    Just as a note.
    You can visually design the UI in Designer and then just grab the c++ code. ;)
    If you look inside the setupUI, there is the code for what u have"drawn"

Log in to reply