Skip to content

Commit

Permalink
Add: automatic selection of the search bar when adding a new fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
yestalgia committed Jun 9, 2024
1 parent 9702cb0 commit 559a3a0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ui/src/addfixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ AddFixture::AddFixture(QWidget* parent, const Doc* doc, const Fixture* fxi)
this, SLOT(slotSelectionChanged()));
connect(m_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
this, SLOT(slotTreeDoubleClicked(QTreeWidgetItem*)));
connect(m_modeCombo, SIGNAL(activated(int)),
this, SLOT(slotModeActivated(int)));
connect(m_modeCombo, SIGNAL(activated(const QString&)),
this, SLOT(slotModeActivated(const QString&)));
connect(m_universeCombo, SIGNAL(activated(int)),
this, SLOT(slotUniverseActivated(int)));
connect(m_addressSpin, SIGNAL(valueChanged(int)),
Expand Down Expand Up @@ -130,7 +130,7 @@ AddFixture::AddFixture(QWidget* parent, const Doc* doc, const Fixture* fxi)
{
m_channelsSpin->setValue(fxi->channels());
m_modeCombo->setCurrentIndex(index);
slotModeActivated(index);
slotModeActivated(m_modeCombo->itemText(index));
}
}
else
Expand All @@ -146,6 +146,9 @@ AddFixture::AddFixture(QWidget* parent, const Doc* doc, const Fixture* fxi)
if (var.isValid() == true)
restoreGeometry(var.toByteArray());
AppUtil::ensureWidgetIsVisible(this);

// Set focus on the search bar
m_searchEdit->setFocus();
}

AddFixture::~AddFixture()
Expand Down Expand Up @@ -347,7 +350,7 @@ void AddFixture::fillModeCombo(const QString& text)

/* Select the first mode by default */
m_modeCombo->setCurrentIndex(0);
slotModeActivated(0);
slotModeActivated(m_modeCombo->currentText());
}
}

Expand Down Expand Up @@ -445,12 +448,12 @@ bool AddFixture::checkAddressAvailability(int value, int channels)
* Slots
*****************************************************************************/

void AddFixture::slotModeActivated(int modeIndex)
void AddFixture::slotModeActivated(const QString& modeName)
{
if (m_fixtureDef == NULL)
return;

m_mode = m_fixtureDef->modes().at(modeIndex);
m_mode = m_fixtureDef->mode(modeName);
if (m_mode == NULL)
{
/* Generic dimmers don't have modes, so bail out */
Expand Down

0 comments on commit 559a3a0

Please sign in to comment.