Ok i understood the problem. Basically i was missing
```
RunWorkerFactory nimbleRunWorkerFactory {
        RunWorkerFactory::make<SimpleTargetRunner>(),
        {ProjectExplorer::Constants::NORMAL_RUN_MODE},
        {nimbleRunConfigFactory.id()}
    };
```
Now i've another problem but please correct me if the behaviour i want to
achieve is wrong.
Like CMake, Nimble has can build multiple executables. Supposing the
current execute
is deleted what is the correct behaviour? in an ideal world (and seeing
what cmake plugin does)
the current run configuration remains active and is simply disabled.
Correct?

I thought that adding the following code would have been enough. i was wrong
```
bool NimbleRunConfiguration::isBuildTargetValid() const
{
    return Utils::anyOf(target()->applicationTargets(), [this](const
BuildTargetInfo &bti) {
        return bti.buildKey == buildKey();
    });
}

QString NimbleRunConfiguration::disabledReason() const
{
    if (!isBuildTargetValid())
        return tr("The project no longer builds the target associated with
this run configuration.");
    return RunConfiguration::disabledReason();
}

void NimbleRunConfiguration::updateEnabledState()
{
    if (!isBuildTargetValid())
        setEnabled(false);
    else
        RunConfiguration::updateEnabledState();
}
```

What happen is that a queued connection triggered the following slot `void
Target::updateDefaultRunConfigurations()`
This in turn near the end sets a new active run configuration from the
configured ones
```
// Make sure a configured RC will be active after we delete the RCs:
if (active && (removalList.contains(active) || !active->isEnabled())) {
......
}
```
What am i missing? an hint would be usefull


Il giorno ven 4 ott 2019 alle ore 10:54 Filippo Cucchetto <
filippocucche...@gmail.com> ha scritto:

> Hi Tobias,
> i don't enable them explicitly. I meant that by debugging i've seen that
> the runconfigurations are enabled. Still the run button is disabled :(
>
> Il giorno ven 4 ott 2019 alle ore 09:12 Tobias Hunger <
> tobias.hun...@gmail.com> ha scritto:
>
>> Hi Filippo,
>>
>> On Fri, Oct 4, 2019 at 12:15 AM Filippo Cucchetto
>> <filippocucche...@gmail.com> wrote:
>> > Now i'm facing another issue: i've all my run configuration with both
>> executable and working directory setup
>> > but the Run button is disabled and i cannot run them. The
>> runconfigurations are enabled (by breaking inside
>> > the setEnabled function). Any idea?
>>
>> IIRC there is no need to enable/disable RCs explicitly. Try removing
>> that code:-)
>>
>
>
> --
> Filippo Cucchetto
>


-- 
Filippo Cucchetto
_______________________________________________
Qt-creator mailing list
Qt-creator@qt-project.org
https://lists.qt-project.org/listinfo/qt-creator

Reply via email to