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


C++ QScreen类代码示例

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


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

示例1: requestedRegion

/*!
    Returns a pointer to the beginning of the display memory.

    Note that it is the application's responsibility to limit itself
    to modifying only the reserved region.

    Do not use this pointer if the current screen has subscreens,
    query the screen driver instead: A pointer to the current screen
    driver can always be retrieved using the static
    QScreen::instance() function. Then use QScreen's \l
    {QScreen::}{subScreenIndexAt()} and \l {QScreen::}{subScreens()}
    functions to access the correct subscreen, and the subscreen's \l
    {QScreen::}{base()} function to retrieve a pointer to the
    framebuffer.

    \sa requestedRegion(), allocatedRegion(), linestep()
*/
uchar* QDirectPainter::frameBuffer()
{
    QScreen *screen = getPrimaryScreen();
    if (!screen)
        return 0;
    return screen->base();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:24,代码来源:qdirectpainter_qws.cpp

示例2:

/*!
    Destroys the screen.
 */
QScreen::~QScreen()
{
    if (!qApp)
        return;

    // Allow clients to manage windows that are affected by the screen going
    // away, before we fall back to moving them to the primary screen.
    emit qApp->screenRemoved(this);

    if (QGuiApplication::closingDown())
        return;

    QScreen *primaryScreen = QGuiApplication::primaryScreen();
    if (this == primaryScreen)
        return;

    bool movingFromVirtualSibling = primaryScreen && primaryScreen->handle()->virtualSiblings().contains(handle());

    // Move any leftover windows to the primary screen
    const auto allWindows = QGuiApplication::allWindows();
    for (QWindow *window : allWindows) {
        if (!window->isTopLevel() || window->screen() != this)
            continue;

        const bool wasVisible = window->isVisible();
        window->setScreen(primaryScreen);

        // Re-show window if moved from a virtual sibling screen. Otherwise
        // leave it up to the application developer to show the window.
        if (movingFromVirtualSibling)
            window->setVisible(wasVisible);
    }
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例3: screenHeight

/*!
    Returns the width of the display in pixels.

    \sa screenHeight(), screenDepth()
*/
int QDirectPainter::screenWidth()
{
    QScreen *screen = getPrimaryScreen();
    if (!screen)
        return 0;
    return screen->deviceWidth();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:12,代码来源:qdirectpainter_qws.cpp

示例4: switch

bool ReticleHandler::eventFilter(QObject *, QEvent *event)
{
	static bool show = true;
	switch (event->type()) {
	case QEvent::TouchBegin:
		show = true;
		break;
	case QEvent::TouchUpdate:
		show = false;
		break;
	case QEvent::TouchCancel:
		show = false;
		break;
	case QEvent::TouchEnd:
		{
			if (show) {
				QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event);
				const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().first();
				QPointF fpoint = touchPoint.pos();
				int x = static_cast<int>(fpoint.x());
				int y = static_cast<int>(fpoint.y());

				QScreen *primaryScreen = QGuiApplication::primaryScreen();
				QTransform lOrientationTranform = primaryScreen->transformBetween(primaryScreen->orientation(), primaryScreen->primaryOrientation(), primaryScreen->geometry()).inverted();

				emit reticleEvent(lOrientationTranform.map(QPoint(x,y)));
			};
			show = false;
		}
		break;
	}
	return false;
}
开发者ID:Andolamin,项目名称:luna-next,代码行数:33,代码来源:reticlehandler.cpp

示例5: Init

void OBSProjector::Init(int monitor, bool window, QString title)
{
	QScreen *screen = QGuiApplication::screens()[monitor];

	if (!window)
		setGeometry(screen->geometry());

	bool alwaysOnTop = config_get_bool(GetGlobalConfig(),
			"BasicWindow", "ProjectorAlwaysOnTop");
	if (alwaysOnTop && !window)
		SetAlwaysOnTop(this, true);

	if (window)
		setWindowTitle(title);

	show();

	if (source)
		obs_source_inc_showing(source);

	if (!window) {
		QAction *action = new QAction(this);
		action->setShortcut(Qt::Key_Escape);
		addAction(action);
		connect(action, SIGNAL(triggered()), this,
				SLOT(EscapeTriggered()));
	}

	savedMonitor = monitor;
	isWindow = window;
}
开发者ID:LiminWang,项目名称:obs-studio,代码行数:31,代码来源:window-projector.cpp

示例6: QPlatformWindow

UIWindow::UIWindow(QWindow *window) :
	QPlatformWindow(window),
	position_includes_frame(false),
	visible(false),
	pending_geometry_change_on_show(true),
	z_level(0.0),
	opacity_level(1.0)
{
	PROFILE_FUNCTION

	QRect geom(window->geometry());
	QScreen *screen = window->screen();
	QRect screenGeom(screen->availableGeometry());
	int x = screenGeom.x() + screenGeom.width()/2. - geom.width()/2.;
	int y = screenGeom.y() + screenGeom.height()/2. - geom.height()/2.;
	geom.setX(x);
	geom.setY(y);
	
	setGeometry(geom);
	setWindowFlags(window->flags());
	setWindowState(window->windowState());

	QWindowSystemInterface::flushWindowSystemEvents();

	static WId counter = 0;
	win_id = ++counter;

	raise();
	mIsDecorationUpdateNeeded = true;
	checkDecorations();
}
开发者ID:Kvalme,项目名称:qglgui,代码行数:31,代码来源:uiwindow.cpp

示例7: length

/*!
    Returns the length (in bytes) of each scanline of the framebuffer.

    \sa frameBuffer()
*/
int QDirectPainter::linestep()
{
    QScreen *screen = getPrimaryScreen();
    if (!screen)
        return 0;
    return screen->linestep();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:12,代码来源:qdirectpainter_qws.cpp

示例8: database

DBThread::DBThread()
 : database(new osmscout::Database(databaseParameter)),
/*
DBThread::DBThread(const SettingsRef& settings)
 : settings(settings),
   painter(NULL),
   database(new osmscout::Database(databaseParameter)),
*/
   locationService(new osmscout::LocationService(database)),
   mapService(new osmscout::MapService(database)),
   painter(NULL),
   iconDirectory(),
   currentImage(NULL),
   currentLat(0.0),
   currentLon(0.0),
   currentAngle(0.0),
   currentMagnification(0),
   finishedImage(NULL),
   finishedLat(0.0),
   finishedLon(0.0),
   finishedMagnification(0),
   currentRenderRequest(),
   doRender(false),
   renderBreaker(new QBreaker()),
   renderBreakerRef(renderBreaker)
{
    QScreen *srn = QApplication::screens().at(0);

    dpi = (double)srn->physicalDotsPerInch();
}
开发者ID:kolosov,项目名称:libosmscout,代码行数:30,代码来源:DBThread.cpp

示例9: printf

//TODO - learn about DPI and point sizes and others; now is purely written by trial and error
int Utils::estimateQToolButtonSize() {
    const int MIN_SIZE = 15; //under 15 pixel should be an error
    const int PIXEL_FROM_FONT_SCALE = 2;
    const float POINT_FROM_FONT_SCALE = 3;
    const float SCREEN_RATIO_SCALE = 0.4;
    const int DEFAULT_SIZE = 35;
    QFont font;
    float defaultFontSize = font.pixelSize() * PIXEL_FROM_FONT_SCALE;
    //increasingly desperate computations:
    if (defaultFontSize <= MIN_SIZE) {
        defaultFontSize = font.pointSize() * POINT_FROM_FONT_SCALE;
        printf("%s - warning, trying QFont.pointSize():%f\n", __func__, defaultFontSize);
    }
    if (defaultFontSize <= MIN_SIZE) {
        QScreen* screen = QGuiApplication::primaryScreen();
        float auxFontSize = SCREEN_RATIO_SCALE * screen->geometry().width();
        defaultFontSize = auxFontSize;
        printf("%s - warning, screen geometry:%f\n", __func__, defaultFontSize);
    }
    if (defaultFontSize <= MIN_SIZE) {
        defaultFontSize = DEFAULT_SIZE;
        printf("%s - warning, will assume dumb size:%f\n", __func__, defaultFontSize);
    }

    return defaultFontSize;
}
开发者ID:alecs1,项目名称:home,代码行数:27,代码来源:Utils.cpp

示例10: Q_Q

void QQuickWebEngineViewPrivate::setDevicePixelRatio(qreal devicePixelRatio)
{
    Q_Q(QQuickWebEngineView);
    this->devicePixelRatio = devicePixelRatio;
    QScreen *screen = q->window() ? q->window()->screen() : QGuiApplication::primaryScreen();
    m_dpiScale = devicePixelRatio / screen->devicePixelRatio();
}
开发者ID:Sagaragrawal,项目名称:2gisqt5android,代码行数:7,代码来源:qquickwebengineview.cpp

示例11: run

void run()
{
    TMPROF_BLOCK();

    int argc = 1;
    char* argv[] = { "" };
    QGuiApplication app(argc, argv);

    QScreen *screen = QGuiApplication::primaryScreen();
    QRect screenGeometry = screen->availableGeometry();
    QPoint center = QPoint(screenGeometry.center().x(), screenGeometry.top() + 80);
    QSize windowSize(400, 320);
    int delta = 40;

    QList<QWindow *> windows;
    xqtgl::window *windowA = new xqtgl::window(&init,&step,&draw,&fini);
    windowA->setGeometry(QRect(center, windowSize).translated(-windowSize.width() - delta / 2, 0));
    windowA->setTitle(QStringLiteral("Window"));
    windowA->setVisible(true);
    windows.prepend(windowA);

    app.exec();

    qDeleteAll(windows);

}
开发者ID:trtikm,项目名称:E2,代码行数:26,代码来源:run.cpp

示例12: QObject

WormEngine::WormEngine(QObject *parent) :
    QObject(parent)
{
    QScreen* screen = QGuiApplication::primaryScreen();
    m_pagewidth = screen->size().width();
    m_pageheight = screen->size().height();

    m_isPaused = true;
    m_gameOver = false;
    m_finish = false;
    m_theend = false;
    m_pauseMenu = false;
    bodyr = m_pagewidth/13.5;

    for (int i = 0; i < 6; i++) {
        WormBody *wormBody = new WormBody((m_pagewidth/3.375)+i*(m_pagewidth/10.8), m_pageheight/2.4);
        m_wormBody.append(wormBody);
    }

    m_updater.setInterval(50);
    connect(&m_updater, SIGNAL(timeout()), this, SLOT(update()));
    m_updater.start();
    lowPx = m_pagewidth/20;
    highPx = m_pagewidth/1.04;
    lowPy = m_pageheight/48;
    highPy = m_pageheight/1.3;
    m_apples = 0;
    distCounter = 0;
    newFoodPos();
}
开发者ID:mikkom79,项目名称:harbour-sailworm,代码行数:30,代码来源:wormengine.cpp

示例13: GetDPI

qreal Theme::GetDPI() const
{
    QScreen *srn = QApplication::screens().at(0);
    qreal dotsPerInch = (qreal)srn->physicalDotsPerInch();

    return dotsPerInch;
}
开发者ID:Dushistov,项目名称:libosmscout,代码行数:7,代码来源:Theme.cpp

示例14: 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

示例15: Q_D

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

    int val;
    if (m == PdmWidth) {
        val = data->crect.width();
    } else if (m == PdmWidthMM) {
        const QScreen *screen = d->getScreen();
        val = data->crect.width() * screen->physicalWidth() / screen->width();
    } else if (m == PdmHeight) {
        val = data->crect.height();
    } else if (m == PdmHeightMM) {
        const QScreen *screen = d->getScreen();
        val = data->crect.height() * screen->physicalHeight() / screen->height();
    } else if (m == PdmDepth) {
        return qwsDisplay()->depth();
    } else if (m == PdmDpiX || m == PdmPhysicalDpiX) {
        if (d->extra && d->extra->customDpiX)
            return d->extra->customDpiX;
        else if (d->parent)
            return static_cast<QWidget *>(d->parent)->metric(m);
        const QScreen *screen = d->getScreen();
        return qRound(screen->width() / double(screen->physicalWidth() / 25.4));
    } else if (m == PdmDpiY || m == PdmPhysicalDpiY) {
        if (d->extra && d->extra->customDpiY)
            return d->extra->customDpiY;
        else if (d->parent)
            return static_cast<QWidget *>(d->parent)->metric(m);
        const QScreen *screen = d->getScreen();
        return qRound(screen->height() / double(screen->physicalHeight() / 25.4));
    } else if (m == PdmNumColors) {
        QScreen *screen = d->getScreen();
        int ret = screen->colorCount();
        if (!ret) {
            const int depth = qwsDisplay()->depth();
            switch (depth) {
            case 1:
                ret = 2;
                break;
            case 8:
                ret = 256;
                break;
            case 16:
                ret = 65536;
                break;
            case 24:
                ret = 16777216;
                break;
            case 32:
                ret = 2147483647;
                break;
            }
        }
        return ret;
    } else {
        val = QPaintDevice::metric(m);// XXX
    }
    return val;
}
开发者ID:Afreeca,项目名称:qt,代码行数:60,代码来源:qwidget_qws.cpp


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