"Clone and append to chaser" button in Scene Editor

The issues found when using the Function Manager panel
Post Reply
mdmayfield
Posts: 71
Joined: Wed Jun 15, 2016 8:51 am
Real Name: Matt Mayfield

The QComboBox dropdown menu where you can choose a chaser mysteriously alternates between two different chasers - or one chaser and None - rather than retaining the original selection.

Tested in latest Git version and in QLC+ 4.10.5b on Mac OS X 10.11.6, and in latest Git version on Ubuntu MATE 16.04 LTS.

To reproduce:

1. Start a new project (no fixtures needed)
2. Create several new Scenes (they can be blank)
3. Create several new Chasers (they can be empty)
4. Select a Scene
5. In the dropdown menu (QComboBox), choose one of the Chasers
6. Select a different Scene
- Expected behavior: the same Chaser selected in step 5 remains in the dropdown menu
- Actual behavior: the dropdown menu switches to None
7. Select another different Scene
- Expected behavior: ???
- Actual behavior: the dropdown menu switches back to the Chaser selected in step 5
8. Select a third Scene
- Expected behavior: the same Chaser selected in step 5 remains in the dropdown menu
- Actual behavior: the dropdown menu switches to None
9. In the dropdown menu (QComboBox) that currently says None, choose a different Chaser
10. Select various Scenes, one at a time
- Expected behavior: the dropdown menu stays consistently on one selected Chaser
- Actual behavior: the dropdown menu alternates, per Scene selection, between the Chaser selected in step 5 and the Chaser selected in step 9
mdmayfield
Posts: 71
Joined: Wed Jun 15, 2016 8:51 am
Real Name: Matt Mayfield

It also seems that if, in Step 6 above, one selects something other than a Scene (such as a folder or different type of function), then the next time one selects a Scene, the Chaser selection "sticks" and is maintained throughout later Scene selections.
mdmayfield
Posts: 71
Joined: Wed Jun 15, 2016 8:51 am
Real Name: Matt Mayfield

I added some debug code to sceneeditor.cpp:

Code: Select all

SceneEditor::~SceneEditor()
{
    qDebug() << Q_FUNC_INFO;

    delete m_source;

    QSettings settings;

    quint32 id = m_chaserCombo->itemData(m_chaserCombo->currentIndex()).toUInt();

    qDebug() << "current SETTINGS_CHASER: " << settings.value(SETTINGS_CHASER);
    qDebug() << "id from m_chaserCombo: " << id;

    settings.setValue(SETTINGS_CHASER, id);
}
This suggests that maybe the QSettings are not being set properly when changing between scenes:

Code: Select all

virtual SceneEditor::~SceneEditor()
current SETTINGS_CHASER:  QVariant(qlonglong, -1)
id from m_chaserCombo:  5
SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 1
virtual SceneEditor::~SceneEditor()
current SETTINGS_CHASER:  QVariant(qlonglong, 5)
id from m_chaserCombo:  4294967295
SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 1
virtual SceneEditor::~SceneEditor()
current SETTINGS_CHASER:  QVariant(qlonglong, -1)
id from m_chaserCombo:  5
SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 1
virtual SceneEditor::~SceneEditor()
current SETTINGS_CHASER:  QVariant(qlonglong, 5)
id from m_chaserCombo:  4294967295
SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 1
virtual SceneEditor::~SceneEditor()
current SETTINGS_CHASER:  QVariant(qlonglong, -1)
id from m_chaserCombo:  5
SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 1
After clicking on a category to close the Scene Editor, and then going back to switching between Scenes, the chaser "sticks":

Code: Select all

SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 0
SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 1
virtual SceneEditor::~SceneEditor()
current SETTINGS_CHASER:  QVariant(qlonglong, 5)
id from m_chaserCombo:  5
SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 1
virtual SceneEditor::~SceneEditor()
current SETTINGS_CHASER:  QVariant(qlonglong, 5)
id from m_chaserCombo:  5
SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 1
virtual SceneEditor::~SceneEditor()
current SETTINGS_CHASER:  QVariant(qlonglong, 5)
id from m_chaserCombo:  5
SceneEditor::SceneEditor(QWidget *, Scene *, Doc *, bool)
DMX source with priority 0 registered at pos 1
virtual SceneEditor::~SceneEditor()
current SETTINGS_CHASER:  QVariant(qlonglong, 5)
id from m_chaserCombo:  5
mdmayfield
Posts: 71
Joined: Wed Jun 15, 2016 8:51 am
Real Name: Matt Mayfield

Adding a QSettings change within the slotChaserComboActivated method seems to fix this:

Code: Select all

void SceneEditor::slotChaserComboActivated(int index)
{
    quint32 id = m_chaserCombo->itemData(index).toUInt();
    QSettings settings;
    settings.setValue(SETTINGS_CHASER, id); // Avoids alternating chaser when selecting different Scenes
    if (id == Function::invalidId())
    {
        qDebug() << "m_chaserCombo has invalid function ID. Disabling Record button";
        m_recordAction->setEnabled(false);
    }
    else
    {
        qDebug() << "m_chaserCombo has valid function ID. Enabling Record button";
        m_recordAction->setEnabled(true);
    }
}
But I'm not familiar enough with QT or the QLC+ codebase to know whether this is the optimal approach.
Post Reply