问题描述
这是我的问题的最小可重现示例:
#include <QCoreApplication>
#include <QtPrintSupport/QPrinter>
#include <QPainter>
#include <QDebug>
int main(int argc,char *argv[])
{
QCoreApplication a(argc,argv);
QPrinter printer;
QPainter painter;
// this will open a file dialog to save a pdf file
if (!painter.begin(&printer)) {
qDebug() << "how to get the difference between 'Dialog Canceled' and 'File in use' here?";
}
else {
//do the painting stuf...
}
return a.exec();
}
我的问题是 - 正如代码中已经提到的 - 我如何知道对话框是否被用户取消或 pdf 文件正在使用中(例如在 Adobe Reader 中打开)?
我已经尝试检查 printer.outputFormat()
和 printer.docName()
,但它们都是空的。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)