[Qt-creator] [Development] Problem withQtCreator Plugin, ICore::showNewItemDialog

Jakob Lettenbichler jakob.lettenbichler at artech.at
Fri Oct 18 13:38:47 CEST 2019


Hiho,

many thanks for the  suggestion, I will try that!

Cheers,
Jakob

-----Ursprüngliche Nachricht-----
Von: Eike Ziller [mailto:Eike.Ziller at qt.io] 
Gesendet: Mittwoch, 16. Oktober 2019 14:56
An: Jakob Lettenbichler
Cc: Christian Stenger; qt-creator at qt-project.org
Betreff: Re: [Qt-creator] [Development] Problem withQtCreator Plugin, ICore::showNewItemDialog

Hi,

you should probably delay that call to showNewItemDialog until the main Qt Creator window is shown.
Something like

connect(ICore::instance(), &ICore::coreOpened, this, [ourFactory] { ICore::showNewItemDialog(......., ourFactory); });

should do the job.
Br, Eike

> On 10. Oct 2019, at 11:19, Jakob Lettenbichler <jakob.lettenbichler at artech.at> wrote:
> 
> Hiho,
> 
> many thanks for forwarding it!
> Sorry for not mentioning it before: This happens on Windows7 (not tested on Win10 yet).
> 
> Cheers,
> Jakob Lettenbichler
> 
> -----Ursprüngliche Nachricht-----
> Von: Christian Stenger [mailto:Christian.Stenger at qt.io] 
> Gesendet: Mittwoch, 09. Oktober 2019 06:50
> An: Jakob Lettenbichler; qt-creator at qt-project.org
> Betreff: Re: [Development] Problem withQtCreator Plugin, ICore::showNewItemDialog
> 
> Hi,
> 
> Moved to the right mailing list and if this is a macOS only issue this should have been fixed ( QTCREATORBUG-22906 )
> 
> Best regards,
> Christian
> 
> 
> ________________________________________
> From: Development <development-bounces at qt-project.org> on behalf of Jakob Lettenbichler <jakob.lettenbichler at artech.at>
> Sent: Tuesday, October 8, 2019 5:55 PM
> To: development at qt-project.org
> Subject: [Development] Problem withQtCreator Plugin, ICore::showNewItemDialog
> 
> 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
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> https://lists.qt-project.org/listinfo/qt-creator

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Erich-Thilo-Straße 10
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list