void LayoutsConfigWidget::FillModels () { if (auto rc = AvailableModel_->rowCount ()) AvailableModel_->removeRows (0, rc); if (auto rc = EnabledModel_->rowCount ()) EnabledModel_->removeRows (0, rc); auto layouts = KBCtl::Instance ().GetRulesStorage ()->GetLayoutsN2D (); const auto& enabledGroups = KBCtl::Instance ().GetEnabledGroups (); QList<QStringList> enabled; for (auto i = 0; i != enabledGroups.size (); ++i) { const auto& name = enabledGroups.at (i); const QStringList enabledRow { name, layouts.value (name), KBCtl::Instance ().GetGroupVariant (i) }; enabled << enabledRow; } Layouts_ = ToSortedList (layouts); SetList (Layouts_, AvailableModel_); SetList (enabled, EnabledModel_); }
void LayoutsConfigWidget::FillModels () { if (auto rc = AvailableModel_->rowCount ()) AvailableModel_->removeRows (0, rc); if (auto rc = EnabledModel_->rowCount ()) EnabledModel_->removeRows (0, rc); auto layouts = KBCtl::Instance ().GetRulesStorage ()->GetLayoutsN2D (); const auto& enabledGroups = KBCtl::Instance ().GetEnabledGroups (); QList<QStringList> enabled; for (const auto& name : enabledGroups) { const QStringList enabledRow { name, layouts.take (name), KBCtl::Instance ().GetGroupVariant (name) }; enabled << enabledRow; } SetList (ToSortedList (layouts), AvailableModel_); SetList (enabled, EnabledModel_); }