Results 1 to 4 of 4

Thread: Disable Windows DPI Awareness only for printing

  1. #1
    Join Date
    Jul 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Disable Windows DPI Awareness only for printing

    Hi,

    I am working on GUI application under Windows 7 using Qt 5.5. The basic purpose of the application is to visualize and print some data (both, text and simple graphics).

    During testing, I realized that the printout (and also the visualization in a simple form using Qt scene and GraphicsView) doesn't look good in case DPI scaling is set to e.g. 150 %. The text seems a lot larger (1.5 times larger), however the graphics remain same in size as working with 100 % DPI scaling.

    I set the dpiawareness of my application to 0 (via qt.conf file). By doing that, the printout looks pretty well, independent of DPI scaling setting. However the app itself looks a little blurry (e.g. Open File Dialog, etc. ...).

    Is there a way to leave the application's dpiawareness on the default value while ensuring that the printout looks always the same, independent of DPI scaling setting?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Disable Windows DPI Awareness only for printing

    How do you print?

    By passing a QPrinter to QGraphicsScene::render()?

    Cheers,
    _

  3. #3
    Join Date
    Jul 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Disable Windows DPI Awareness only for printing

    Yes. Pretty much like this:
    Qt Code:
    1. QPrinter printer( QPrinterInfo::defaultPrinter() );
    2. QPainter painter( &printer );
    3. m_pScene->render( &painter, ... );
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Disable Windows DPI Awareness only for printing

    Hmm.

    In Qt 5.6 you could have tried switching to Qt::AA_DisableHighDpiScaling during printing, but I didn't find any indication is something like that is also possible in 5.5 during runtime.

    Cheers,
    _

Similar Threads

  1. Replies: 11
    Last Post: 20th August 2015, 10:48
  2. Disable ICU, Windows
    By WoldemarShiPa in forum Qt Programming
    Replies: 1
    Last Post: 17th January 2014, 01:04
  3. problem - printing in windows and linux
    By newplayer in forum Qt Programming
    Replies: 2
    Last Post: 8th July 2008, 21:22
  4. Printing problem in windows
    By joseph in forum Qt Programming
    Replies: 6
    Last Post: 12th July 2007, 09:04
  5. Printing from Linux and Windows
    By ocascante in forum Qt Programming
    Replies: 3
    Last Post: 30th April 2007, 16:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.