File indexing completed on 2024-12-08 04:34:23
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #include "rolescombobox.h" 0007 #include "model/rolesmodel.h" 0008 #include "roles/roleinfo.h" 0009 0010 RolesComboBox::RolesComboBox(QWidget *parent) 0011 : QComboBox(parent) 0012 , mRolesModel(new RolesModel(this)) 0013 { 0014 setModel(mRolesModel); 0015 } 0016 0017 RolesComboBox::~RolesComboBox() = default; 0018 0019 void RolesComboBox::setRolesInfo(const QVector<RoleInfo> &roleInfo) 0020 { 0021 mRolesModel->setRoles(roleInfo); 0022 } 0023 0024 void RolesComboBox::setRoles(const QStringList &lst) 0025 { 0026 mRolesModel->setRolesSelected(lst); 0027 setSizeAdjustPolicy(QComboBox::AdjustToContents); 0028 } 0029 0030 QStringList RolesComboBox::roles() const 0031 { 0032 return mRolesModel->rolesSelected(); 0033 } 0034 0035 #include "moc_rolescombobox.cpp"