Nominate our 2022 Qt Champions!

how to get MFC MM_HIMETRIC map mode in QGraphicsView?

  • Hello,

    I'm trying to map a scene in a QGraphicsView using the same map mode MM_HIMETRIC of MFC.
    the himetric map has a unit of 0.01mm and the y is negative from up to down.
    How to achieve this?

    I'm trying this way:

    QGraphicsView* pView = new QGraphicsView();
    QGraphicsScene* pScene = new QGraphicsScene(pView);
    pScene->setSceneRect(0,0,21000,29700); //A4 dimension in 0,01mm unit
    qDebug() << (double)pView->physicalDpiX();
    qDebug() << (double)pView->logicalDpiX();
    double scaleX = ((double)pView->physicalDpiX())/2540.0;
    double scaleY = ((double)pView->physicalDpiY())/2540.0;

    this solution works good in a pc using windows 8 with physical DPI of 102 and logical DPI 120, but in another pc (same hardware and screen ) with win7, with physical DPI of 72 and logical DPI 96, the object are smaller than they should appear.
    How can I resolve this?

    How to get the y negative goin down along the screen?

    thank you

Log in to reply