当前位置: 首页>>代码示例>>C++>>正文


C++ QScreen::logicalDotsPerInchX方法代码示例

本文整理汇总了C++中QScreen::logicalDotsPerInchX方法的典型用法代码示例。如果您正苦于以下问题:C++ QScreen::logicalDotsPerInchX方法的具体用法?C++ QScreen::logicalDotsPerInchX怎么用?C++ QScreen::logicalDotsPerInchX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QScreen的用法示例。


在下文中一共展示了QScreen::logicalDotsPerInchX方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QGraphicsScene

KReportDesignerSectionScene::KReportDesignerSectionScene(qreal w, qreal h, KReportDesigner *rd)
        : QGraphicsScene(0, 0, w, h, rd)
{
    m_rd = rd;
    m_minorSteps = 0;

    QScreen *srn = QApplication::screens().at(0);

    m_dpiX = srn->logicalDotsPerInchX();
    m_dpiY = srn->logicalDotsPerInchY();

    if (m_unit.type() != m_rd->pageUnit().type()) {
        m_unit = m_rd->pageUnit();
        if (m_unit.type() == KReportUnit::Cicero ||
            m_unit.type() == KReportUnit::Pica ||
            m_unit.type() == KReportUnit::Millimeter) {
            m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX;
            m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY;
        } else if (m_unit.type() == KReportUnit::Point) {
            m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX;
            m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY;
        } else {
            m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX;
            m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY;
        }
    }
}
开发者ID:nimxor,项目名称:kreport,代码行数:27,代码来源:KReportDesignerSectionScene.cpp

示例2: toScene

QPointF KReportPosition::toScene() const
{
    QScreen *srn = QApplication::screens().at(0);

    const qreal x = POINT_TO_INCH(m_pointPos.x()) * srn->logicalDotsPerInchX();
    const qreal y = POINT_TO_INCH(m_pointPos.y()) * srn->logicalDotsPerInchY();

    return QPointF(x, y);
}
开发者ID:nimxor,项目名称:kreport,代码行数:9,代码来源:KReportPosition.cpp

示例3: metric

int QWidget::metric(PaintDeviceMetric m) const
{
    Q_D(const QWidget);

    QScreen *screen = 0;
    if (QWidget *topLevel = window())
        if (QWindow *topLevelWindow = topLevel->windowHandle()) {
            QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(topLevelWindow);
            if (platformScreen)
                screen = platformScreen->screen();
        }
    if (!screen && QGuiApplication::primaryScreen())
        screen = QGuiApplication::primaryScreen();

    if (!screen) {
        if (m == PdmDpiX || m == PdmDpiY)
              return 72;
        return QPaintDevice::metric(m);
    }
    int val;
    if (m == PdmWidth) {
        val = data->crect.width();
    } else if (m == PdmWidthMM) {
        val = data->crect.width() * screen->physicalSize().width() / screen->geometry().width();
    } else if (m == PdmHeight) {
        val = data->crect.height();
    } else if (m == PdmHeightMM) {
        val = data->crect.height() * screen->physicalSize().height() / screen->geometry().height();
    } else if (m == PdmDepth) {
        return screen->depth();
    } else if (m == PdmDpiX) {
        if (d->extra && d->extra->customDpiX)
            return d->extra->customDpiX;
        else if (d->parent)
            return static_cast<QWidget *>(d->parent)->metric(m);
        return qRound(screen->logicalDotsPerInchX());
    } else if (m == PdmDpiY) {
        if (d->extra && d->extra->customDpiY)
            return d->extra->customDpiY;
        else if (d->parent)
            return static_cast<QWidget *>(d->parent)->metric(m);
        return qRound(screen->logicalDotsPerInchY());
    } else if (m == PdmPhysicalDpiX) {
        return qRound(screen->physicalDotsPerInchX());
    } else if (m == PdmPhysicalDpiY) {
        return qRound(screen->physicalDotsPerInchY());
    } else if (m == PdmDevicePixelRatio) {
        return screen->devicePixelRatio();
    } else {
        val = QPaintDevice::metric(m);// XXX
    }
    return val;
}
开发者ID:cedrus,项目名称:qt,代码行数:53,代码来源:qwidget_qpa.cpp

示例4: setScenePos

void KReportPosition::setScenePos(const QPointF& pos, UpdatePropertyFlag update)
{
    QScreen *srn = QApplication::screens().at(0);

    const qreal x = INCH_TO_POINT(pos.x() / srn->logicalDotsPerInchX());
    const qreal y = INCH_TO_POINT(pos.y() / srn->logicalDotsPerInchY());

    m_pointPos.setX(x);
    m_pointPos.setY(y);

    if (update == UpdateProperty)
        m_property->setValue(toUnit());
}
开发者ID:nimxor,项目名称:kreport,代码行数:13,代码来源:KReportPosition.cpp

示例5: metric

/*!
  \internal
 */
int QPaintDeviceWindow::metric(PaintDeviceMetric metric) const
{
    QScreen *screen = this->screen();
    if (!screen && QGuiApplication::primaryScreen())
        screen = QGuiApplication::primaryScreen();

    switch (metric) {
    case PdmWidth:
        return width();
    case PdmWidthMM:
        if (screen)
            return width() * screen->physicalSize().width() / screen->geometry().width();
        break;
    case PdmHeight:
        return height();
    case PdmHeightMM:
        if (screen)
            return height() * screen->physicalSize().height() / screen->geometry().height();
        break;
    case PdmDpiX:
        if (screen)
            return qRound(screen->logicalDotsPerInchX());
        break;
    case PdmDpiY:
        if (screen)
            return qRound(screen->logicalDotsPerInchY());
        break;
    case PdmPhysicalDpiX:
        if (screen)
            return qRound(screen->physicalDotsPerInchX());
        break;
    case PdmPhysicalDpiY:
        if (screen)
            return qRound(screen->physicalDotsPerInchY());
        break;
    case PdmDevicePixelRatio:
        if (screen)
            return screen->devicePixelRatio();
        break;
    default:
        break;
    }

    return QPaintDevice::metric(metric);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:48,代码来源:qpaintdevicewindow.cpp

示例6: setFlag

Node::Node()
{
    setFlag(ItemIsMovable);
    setFlag(ItemIsSelectable);
    setFlag(ItemSendsGeometryChanges);
    setFlag(QGraphicsItem::ItemClipsChildrenToShape);
    setZValue(2);
    nodeID = -1;
    choose = 0;		// What type of pen style to use when drawing outline.
    lSize = 12;		// Default font size, in points.  CURRENTLY UNUSED.
    nodeDiameter = 1;
    edgeWeight = 1;     // UNUSED IN V 1.1.
    rotation = 0;
    text = new Label(this);
    setHandlesChildEvents(true);
    select = false;
    QScreen * screen = QGuiApplication::primaryScreen();
    logicalDotsPerInchX = screen->logicalDotsPerInchX();
    logicalDotsPerInchY = screen->logicalDotsPerInchY();
}
开发者ID:Razmataz88,项目名称:Graphic,代码行数:20,代码来源:node.cpp


注:本文中的QScreen::logicalDotsPerInchX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。