Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不确定如何将设置更改立即投射到我的应用程序上。一种方法是QEvent使用eventFilter.
QEvent
eventFilter
这是一个选择吗?有没有这样的事件?如果监听事件是个坏主意,那么正确的解决方案是什么?
QSettings发生变化时不会通知您。如果要在实际更改设置时处理事件,则应QFileSystemWatcher为QSettings::fileName()文件设置一个。
QSettings
QFileSystemWatcher
QSettings::fileName()
另一个(可能更干净)的解决方案是创建一个包装类,该类定义一个适当的信号,并在您通过它更新设置时发出它。