QVariant(QSettings课堂所需)支持创作QMap<QString, QVariant>
但试图初始化这样的事情:
QMap<QString, QVariant(QMap<QString, QVariant>)> i;
Run Code Online (Sandbox Code Playgroud)
给出错误:
函数返回一个函数.
那么我尝试了QMap<QString, QVariant>重载QVariant()并得到了
错误:没有匹配的函数用于调用
QVariant::QVariant(QMap<QString, QMap<QString, int> >&)
现在我尝试了一个类型转换:
QMap<QString, (QVariant)QMap<QString, QVariant> > i;
Run Code Online (Sandbox Code Playgroud)
得到了
模板参数2
在';'标记之前的声明中是无效的无效类型
那么将嵌套转换QMap为QVariant对象所需的巫术是什么?
这是有问题的代码:
private void FormAccounting_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.FormAccountingLocation = this.Location;
Properties.Settings.Default.Save();
if (IsEditing)
{
MessageBox.Show("Please save or cancel open transactions before closing the accounting window.", "Open Transactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
e.Cancel = true;
}
}
Run Code Online (Sandbox Code Playgroud)
我在线上添加了断点以e.Cancel = true;确保它被执行.
单击"确定"后,表单立即关闭.
这是调用FormAccounting的代码:
private void buttonAccounts_Click(object sender, EventArgs e)
{
FormAccounting NewFormAccounting = new FormAccounting();
NewFormAccounting.Show();
}
Run Code Online (Sandbox Code Playgroud)