Using C++ as the language in Qt Creator I created a notepad (same as the simple text-editor for Microsoft Windows which is a basic text-editing program) but I could not find the exact code for its printing option to save as an image or pdf file and print what writes in the created notepad. Written code gives an error saying
...\NotePad\mainwindow.cpp:5: error: QPrinter: No such file or directory
#include <QPrinter>
code written
#include <QPrinter>
void MainWindow::on_actionPrint_triggered()
{
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFileName("print.ps");
painter.end();
}