refactored reload function in protolocolsModel
This commit is contained in:
parent
bbb5a19700
commit
254e23be48
2 changed files with 15 additions and 15 deletions
|
|
@ -71,9 +71,23 @@ QVariant ProtocolsModel::data(const QModelIndex &index, int role) const
|
||||||
void ProtocolsModel::reload()
|
void ProtocolsModel::reload()
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
endResetModel();
|
|
||||||
|
QJsonObject config = getConfig();
|
||||||
|
|
||||||
|
QStringList keys = m_content.keys();
|
||||||
|
if (keys.size() == 1) {
|
||||||
|
QString protocolKey = keys.first();
|
||||||
|
|
||||||
|
if (config.contains(protocolKey)) {
|
||||||
|
QJsonObject protocolConfig = config.value(protocolKey).toObject();
|
||||||
|
protocolConfig.remove(config_key::last_config);
|
||||||
|
config[protocolKey] = protocolConfig;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateModel(config);
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
void ProtocolsModel::updateModel(const QJsonObject &content)
|
void ProtocolsModel::updateModel(const QJsonObject &content)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,20 +24,6 @@ PageType {
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: header
|
id: header
|
||||||
|
|
||||||
/*Connections {
|
|
||||||
target: InstallController
|
|
||||||
function onCachedProfileCleared(message) {
|
|
||||||
console.log("СИГНАЛ cachedProfileCleared СРАБОТАЛ:", message)
|
|
||||||
//ProtocolsModel.updateModel(ProtocolsModel.getConfig())
|
|
||||||
ProtocolsModel.clear()
|
|
||||||
console.log("isClientProtocolExists =", ProtocolsModel.get(0).isClientProtocolExists)
|
|
||||||
/*PageController.goToPage(PageEnum.PageMainSettings)
|
|
||||||
Qt.callLater(function() {
|
|
||||||
PageController.goToPage(PageEnum.PageSettingsServerProtocol)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue