Document data in QPrintDialog
-
Hello,
how do I create a QPrintDialog that has the relevant information to print the document? My code at the moment is:/*! * send stuff to printer */ void MainWin::print() { QPrinter printer; QPrintDialog prSettings(&printer, this); prSettings.setWindowTitle(tr("Print")); if(QDialog::Accepted == prSettings.exec()) { QPainter painter(&printer); m_ui.graphicsview->render(&painter); } }
The final print output is as expected. But: I do not get any information about the print page count. Also the printer Properties window has a preview. The content of that is complete nonsense. It seems I have to connect the QGraphicsView somehow to the QPrintDialog before displaying it. How do I do this? None of the examples I have seen did it. Setting m_ui.graphicsview instead of this in the initialization does not change anything.
Where I need that data is shown in that image:
-
Hi
Im not sure you can get to print in that preview window as it seems native.
One can use
http://doc.qt.io/qt-5/qprintpreviewdialog.html#details
and its
http://doc.qt.io/qt-5/qprintpreviewdialog.html#paintRequested
signal to do the preview printing.
To have Print Preview. -
Hi
Im not sure you can get to print in that preview window as it seems native.
One can use
http://doc.qt.io/qt-5/qprintpreviewdialog.html#details
and its
http://doc.qt.io/qt-5/qprintpreviewdialog.html#paintRequested
signal to do the preview printing.
To have Print Preview. -
Hi and welcome to devnet,
Although I can understand you may not be satisfied, you have to understand that this is a community driven user forum.
That said, you should provide more information:
- What version of Qt are you using ?
- What OS are you running ?
- If Linux, what distribution ?
-
Hi and welcome to devnet,
Although I can understand you may not be satisfied, you have to understand that this is a community driven user forum.
That said, you should provide more information:
- What version of Qt are you using ?
- What OS are you running ?
- If Linux, what distribution ?
@SGaist said in Document data in QPrintDialog:
Although I can understand you may not be satisfied, you have to understand that this is a community driven user forum.
I completely understand and meant no offence to @mrjj. I'm sorry if mrjj took it that way.
That said, you should provide more information:
- What version of Qt are you using ?
- What OS are you running ?
- If Linux, what distribution ?
Qt Version is 5.5.1
OS is Linux Mint 18.3 with Xfce.It seems none of the installed programs use that exact print dialog. So it might be better to not use QPrintDialog at all and create a custom print dialog?
-
@SGaist said in Document data in QPrintDialog:
Although I can understand you may not be satisfied, you have to understand that this is a community driven user forum.
I completely understand and meant no offence to @mrjj. I'm sorry if mrjj took it that way.
That said, you should provide more information:
- What version of Qt are you using ?
- What OS are you running ?
- If Linux, what distribution ?
Qt Version is 5.5.1
OS is Linux Mint 18.3 with Xfce.It seems none of the installed programs use that exact print dialog. So it might be better to not use QPrintDialog at all and create a custom print dialog?
@HansBr
Oh, no offence taken. I was checking my mint linux if any app would actually render custom content in that mini preview.
However, all print dialog i could find looked different and
i assume you are using other desktop and im using XFCE so
that is maybe why. but seems we have very similar setup except mine being mint 18.1
Also as you noticed the other apps have different print dialogs
so starting to wonder if the dialogs are native or 100% Qt made. -
I found an application that uses this print window. The document viewer Okular. That is a KDE application.
That means, for some reason Qt wants to use the KDE libraries even though XFCE is the active window manager.
That preview widget in Okular looks exactly the same as in my example which leads me to believe that this print window is just broken. So I really don't know if I should use it or not.And then I still need to figure out the total page count.