Nominate our 2022 Qt Champions!

"Default QML file to run" setting for Run and Debug options in Qt Creator?

  • Since nobody has yet used the phrase "default qml file" on the forums, and since Qt Creator could stand to be a BIT more user-friendly in this regard, I'm going to pose this question to the community here on the Qt Forums;
    How do you set a Default QML file to be run when you press Ctrl+R or F5 in the Qt Creator?

    You see, often times, I will be editing a sort of "Component.qml" file that needs, for various reasons, to be transparent, variable width, or some other dynamic setting that prevents said file from being self-inclusive with regards to its layout. Meanwhile, I've got something of a "Layout.qml" file or files, wherein the various components that I am editing are included in a possible layout scenario.

    Suffice it to say, I do not normally EDIT the Layout.qml file when I am building the logic for the Component.qml file. And the thing that I do NOT like to do, when I am doing a lot of work on the keyboard, is stop, reach over to the mouse, find and click the miniature "Layout.qml" option within 'Projects' to load up that file or find "Layout.qml" within 'Open Documents' (which changes all of the code I see in the editor), JUST TO RUN THE FILE PROPERLY. I would prefer to hit Ctrl+R or F5 WHILE I am editing Component.qml, and have Qt Creator JUST KNOW that I mean to open Layout.qml instead of Component.qml.

    I don't much care whether that means that I've set Layout.qml as the "Default QML file" for this session, or whether it means that Component.qml is somehow registered as 'always opening Layout.qml instead'. I just want it to NOT open a little useless window where I can't see my component because the text and background are the same color and none of the Component's functions loaded because they're dependent on some of the system-level functions within Layout.qml to run properly. Hopefully with this verbose explanation, I have pre-answered "Why would you want to do that?" question that invariably comes up first in every forum on the internet.

    So please, anyone who knows, let me know how to remedy this situation. I just want to be able to look at Component.qml, press F5, and have Qt Creator know that I actually want Layout.qml to come up so I can see my component in its proper context.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    For discussing such a feature, I'd recommend posting to the Qt Creator mailing list. You'll find the Qt Creator's developers/maintainers (this forum is more user oriented)

  • Alright. Thanks. That sounded like a lot of work so I scanned through the application's many features and found "Run Settings" has something called "Main QML file" that seems to operate the way I expect.