Patrick
Patrick

Reputation: 23619

QPrintDialog and setting up the printer

I am working on an application that uses the Qt library on Windows.

I want the user to be able to configure the printer where the application should print. So my main menu will contain the following entries:

In other, non-Qt, applications I used the Windows function PrintDlg with the flag PD_PRINTSETUP. This showed the following dialog, which is exactly what I want: enter image description here

However, the Qt function QPrintDialog uses the more recent PrintDlgEx function, which looks like this: enter image description here

This dialog seems to be intended for actual printing. Not for setting and configuring the printer.

The QPageSetupDialog isn't really useful in my case either. It looks like this: enter image description here So this only makes it useful for setting the page size, the orientation and the margins.

Is there a clean way in Qt to get a decent printer configuration dialog?

If I can't find a clean way, I need to revert to the native Windows PrintDlg function, which means patching or duplicating the code in the Qt source qprintdialog_win.cpp.

Upvotes: 1

Views: 4686

Answers (1)

Roger Attrill
Roger Attrill

Reputation: 396

I'm afraid you'll need to revert to the native Windows PrintDlg function as Qt4 correctly uses the PageSetupDlg function for page setup.

In Windows, although the PrintDlg can use the PD_PRINTSETUP to make the dialog act as Print Setup Dialog box, that functionality is not reccomended for new applications.

Quoting from MS: "new applications should not use PrintDlg for this purpose. The Print Setup dialog box has been superseded by the Page Setup dialog box created by the PageSetupDlg function."

Upvotes: 2

Related Questions