[Development] Problem withQtCreator Plugin, ICore::showNewItemDialog

Jakob Lettenbichler jakob.lettenbichler at artech.at
Tue Oct 8 17:55:32 CEST 2019


Hiho,

This is a QtCreator Plugin question, I hope that's the correct mailing list fort hat...


I have a QtCreatorPlugin that shall open some wizard if the QtCreator is started via command line passing an argument.
That works for me as expected, everything is fine, except that sometimes the Wizard then lies behind the QtCreator window and sometimes it is in front of it (racing condition?).
The relevant code parts are:

bool HMIProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorString)
{
    if (arguments.count(QLatin1String("-newhmiproject")) != 0)
        m_autoStartNewProject = true;
   [...]
}

void HMIProjectManagerPlugin::extensionsInitialized()
{
    if (!m_autoStartNewProject) return;
    using namespace Core;
    QList<IWizardFactory*> allfactories = IWizardFactory::allWizardFactories();
    QList<IWizardFactory*> ourFactory;
    auto ourMimeType = Id(Constants::HMI_PROJECT_ID);
    bool found = false;
    for(auto* fac : allfactories) {
        auto supported = fac->supportedProjectTypes();
        if (!(supported.contains(ourMimeType)))
            continue;
        found = true;
        ourFactory << fac;
    }
    if (!found) return;

    ICore::showNewItemDialog(tr("New HMI Project", "New HMI Project"), ourFactory);
}


I am currently using Qt5.9 and the QtCreator version 4.4.1 (unfortunately I am stuck to these versions unless there are some very good reasons for an upgrade, since the last upgrade from QtCreator 4.0 -> 4.4 we did, required a lot of porting work to be done for our QtCreator Plugins).

Any ideas how I could guarantee that the QtCreator window stays behind the Wizard dialog?

Many thanks in advance for replies,

Cheers,
Jakob Lettenbichler


More information about the Development mailing list