0
A
回答
5
當你說的圖表,我認爲這是某種形式的矢量圖形或類似的。我通常使用QPrinter將它們導出爲PDF,然後在我的文檔(LaTeX,Keynote,...)中使用它們。 這是一個可能有幫助的代碼片段。未經檢驗的,因爲我移植在我的頭上用Python回到C++:
QPrinter *printer = new QPrinter();
printer->setOrientation(QPrinter::Landscape);
QPrintDialog *dialog = new QPrintDialog(printer);
dialog->setWindowTitle("Print Plots");
if (dialog.exec() != QDialog::Accepted)
return;
QPainter *painter = new QPainter();
painter->begin(printer);
ui->someQwtPlot->print(painter, printer->pageRect());
painter->end();
delete(dialog);
delete(painter);
delete(printer);
我假設這裏要創建一個使用QwtPlot情節,但任何QWidget的或對象支持渲染到了QPainter會做。有關詳細信息,請參閱QWidget::render()。上面的代碼實際上允許您甚至打印到一臺真實的打印機。但我通常只是在打印機對話框中設置「打印到PDF」。如果您不需要打印機對話框,可以跳過它並使用QPrinter::setOutputFilename直接設置PDF文件名。
相關問題
- 1. 如何將圖像保存爲圖像
- 2. 如何將base64字符串保存爲Qt中的png圖像?
- 3. 如何將tkinter表保存爲圖像
- 4. 將圖保存爲rCharts中的圖像
- 5. 如何將圖像保存爲流?
- 6. 如何將畫布保存爲圖像?
- 7. 如何將此圖像保存爲HD?
- 8. 如何將ImageView保存爲圖像?
- 9. 如何將圖像保存爲RelativeLayout
- 10. 如何將圖像保存爲DICOM
- 11. 如何將Extjs4圖表圖像保存爲PDF報告?
- 12. 如何將圖表從Excel保存爲圖像/ PDF?
- 13. 如何將圖形對象保存爲C#中的圖像?
- 14. 如何將繪圖圖保存爲C#格式的JPEG圖像
- 15. 將Qwtplot保存爲圖像
- 16. 將圖像保存爲Tiff
- 17. 將流保存爲圖像
- 18. 將HTML表格保存爲圖像
- 19. 在Matlab中將位圖圖像保存爲位圖圖像
- 20. 如何在python中將二維列表保存爲圖像?
- 21. 將httppostedfilebase保存爲SQL中的圖像
- 22. 如何將圖像保存爲圖像/ pdf?
- 23. 如何保存圖庫中的圖像?
- 24. 如何將表單保存爲文件的圖像?
- 25. 將jqPlot圖保存爲圖像文件
- 26. 將phpgraphlib圖保存爲圖像
- 27. 將flot圖保存爲圖像
- 28. 將Xamarin.Forms.VisualElement保存爲位圖圖像
- 29. 無法圖表保存爲圖像
- 30. 如何將原始方向的位圖保存爲JPG圖像?