我正在查看 Qt 项目代码库,它足够大,我无法找到以下内容的来源。
QFSFileEngine::open: No file name specified
到目前为止我尝试了两种方法:
QFile::open()
附近放置一个断点,但这并没有让我更接近地找到问题。
我以干净的输出跳过所有断点,然后在得到几个断点后的某个地方:QFSFileEngine::open: No file name specified
QFSFileEngine::open: No file name specified
QFSFileEngine::open: No file name specified
QFSFileEngine::open: No file name specified
QFile
的实例替换为 MyFile
(在 main.cpp
中的其他任何内容之前执行此操作): class MyFile : public QFile
{
int i = 0;
public:
MyFile(const QString &name, QObject *parent)
{
qDebug() << "a";
}
MyFile(QObject *parent)
{
qDebug() << "b";
}
MyFile()
{
qDebug() << "b";
}
MyFile(const QString& filename)
{
qDebug() << "d" << filename.size() << filename;
}
bool open(QIODevice::OpenMode flags)
{
qDebug() << i++ << flags;
return true;
}
};
#define QFile MyFile
有了这个,我期望打破代码逻辑作为副作用,但至少停止:
QFSFileEngine::open: No file name specified
但是我还是明白了。
我可以得出结论吗
QFSFileEngine::open: No file name specified
不是来自我的项目而是来自
来自我的项目加载的第 3 方库?
对我应该尝试的其他方法有什么建议吗?
https://doc.qt.io/qt-6/qfiledialog.html 如果用户通过按对话框中的“取消”选择没有文件名,则返回该消息。