开发者

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:

  • Printer Setup...: should show a dialog where the user can select and configure the printer
  • Print...: perform the actual print

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:

QPrintDialog and setting up the printer

However, the Qt function QPrintDialog uses the more recent PrintDlgEx function, which looks like this:

QPrintDialog and setting up the printer

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

  • It shows a Print button instead of simply OK.
  • It contains a 'Page Range' group box, which isn't really useful when setting up the printer configuration.

The QPageSetupDialog isn't really useful in my case either. It looks like this:

QPrintDialog and setting up the printer

So this only makes it useful for setting the page size, the orientation and the margins.

Is there a clean way in Qt to开发者_StackOverflow中文版 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.


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."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜