Fix bug in Add increment tool button.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-03-13 10:23:44 +02:00
parent 1393be669b
commit 1f25b81f88

View File

@ -750,14 +750,20 @@ void DialogIncrements::AddNewIncrement(IncrementType type)
{
qCDebug(vDialog, "Add new increment");
auto *action = qobject_cast<QAction *>(sender());
if (action == nullptr)
bool incrementMode = true;
if (auto *action = qobject_cast<QAction *>(sender()))
{
incrementMode = action->data().toBool();
}
else if (auto *button = qobject_cast<QToolButton *>(sender()))
{
incrementMode = button == ui->toolButtonAdd;
}
else
{
return;
}
const bool incrementMode = action->data().toBool();
QTableWidget *table = incrementMode ? ui->tableWidgetIncrement : ui->tableWidgetPC;
const QString name = GetCustomName();