Example #1
0
void PathView::zoom(int z, const QPoint &pos)
{
	if (_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
		return;

	QPoint offset = pos - viewport()->rect().center();
	QPointF spos = mapToScene(pos);

	qreal os = mapScale(_zoom);
	_zoom = z;

	rescale(_zoom);

	QRectF sr = contentsSceneRect();
	_scene->setSceneRect(sr);

	if (sr.width() < viewport()->size().width()
	  && sr.height() < viewport()->size().height())
		centerOn(sr.center());
	else
		centerOn((spos * (os/mapScale(_zoom))) - offset);

	_mapScale->setZoom(_zoom);

	resetCachedContent();
}
void WindowServerLuna::slotScreenLockStatusChanged(bool locked)
{
	// in Dock Mode the Dock Mode settings override the Lock Screen settings for the visibility of the window managers
	if(SystemUiController::instance()->isInDockMode())
		return;
	
	if(locked) {
        cacheFocusedItem();
		// Lock screen is visible, so make all window managers under it invisible
		m_cardMgr->setVisible(false);
		m_emergencyModeMgr->setVisible(false);
		m_menuMgr->setVisible(false);
		m_dashboardMgr->setVisible(false);
		m_overlayMgr->setVisible(false);
        restoreCachedFocusItem();
		m_drawWallpaper = false;
	} else {
		// Lock screen is no longer visible, so make all window managers visible
		m_cardMgr->setVisible(true);
		m_emergencyModeMgr->setVisible(true);
		m_menuMgr->setVisible(true);
		m_dashboardMgr->setVisible(true);
		m_overlayMgr->setVisible(true);
		m_drawWallpaper = true;

		//give overlay window manager focus if there is no app maximized
		if (!SystemUiController::instance()->isCardWindowMaximized() && !SystemUiController::instance()->isInDockMode())
		{
			m_overlayMgr->setFlag(QGraphicsItem::ItemIsFocusable, true);
			m_overlayMgr->setFocus();
			g_message("%s: [NOV-115353] overlaywm getting focus",__FUNCTION__);
		}
	}
        resetCachedContent(); // Reset wallpaper cache
}
Example #3
0
File: view.cpp Project: KDE/kpat
void PatienceView::resizeEvent( QResizeEvent * e )
{
    QGraphicsView::resizeEvent( e );
    setRenderSize( e->size() );
    resetCachedContent();
    updateSceneSize();
}
Example #4
0
void View::updateStyle()
{
    // update all affected members
    setBackgroundBrush(QBrush(s_backgroundColor));

    // force a redraw for good measure
    resetCachedContent();
}
Example #5
0
void PathView::setMap(Map *map)
{
	if (_map)
		disconnect(_map, SIGNAL(loaded()), this, SLOT(redraw()));

	_map = map;

	if (_map)
		connect(_map, SIGNAL(loaded()), this, SLOT(redraw()));

	resetCachedContent();
}
void WindowServerLuna::slotWallPaperChanged(const char* filePath)
{
	if (!filePath)
		return;

	if(m_wallpaperFileName == filePath)
		return; // no change

	m_wallpaperFileName = filePath;

        resetCachedContent(); // Reset wallpaper cache
	generateWallpaperImages();

	update();
}
Example #7
0
void PathView::resizeEvent(QResizeEvent *event)
{
	if (_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
		return;

	rescale();

	QRectF sr = contentsSceneRect();

	if (sr.width() < event->size().width()) {
		qreal diff = event->size().width() - sr.width();
		sr.adjust(-diff/2, 0, diff/2, 0);
	}
	if (sr.height() < event->size().height()) {
		qreal diff = event->size().height() - sr.height();
		sr.adjust(0, -diff/2, 0, diff/2);
	}

	_scene->setSceneRect(sr);
	centerOn(sr.center());

	resetCachedContent();
}
Example #8
0
void QGraphVizPIP::updateViewPortRect()
{
    qreal aspectRatio = sceneRect().width() / sceneRect().height();

    int maxWidth = parentWidget()->width() / 2;
    int maxHeight = parentWidget()->height() / 2;

    if(aspectRatio < 2.0 && aspectRatio > -2.0) {
        maxWidth = parentWidget()->width() / 4;
        maxHeight = parentWidget()->height() / 4;
    }

    QSize size;
    if(aspectRatio > 1.0) {
        size.setWidth(maxWidth);
        size.setHeight(maxWidth / aspectRatio);
        if(size.height() > maxHeight) {
            size.setWidth(maxHeight * aspectRatio);
            size.setHeight(maxHeight);
        }
    } else {
        size.setWidth(maxHeight * aspectRatio);
        size.setHeight(maxHeight);
        if(size.width() > maxWidth) {
            size.setWidth(maxWidth);
            size.setHeight(maxWidth / aspectRatio);
        }
    }

    if(this->size() != size) {
        resize(size);
    }

    centerOn(scene()->sceneRect().center());
    fitInView(sceneRect().adjusted(-20,-20,20,20), Qt::KeepAspectRatio);
    resetCachedContent();
}
Example #9
0
void CMyGraphicsView::scrollActionTriggered(int nAction)
{
    Q_UNUSED(nAction);

    resetCachedContent();
}
Example #10
0
void PathView::redraw()
{
	resetCachedContent();
}
Example #11
0
File: view.cpp Project: KDE/kpat
void PatienceView::receivePixmap( const QPixmap & pixmap )
{
    m_background = pixmap;
    resetCachedContent();
}
Example #12
0
void QGobanView::init(int size) {
    _size=size;
    _margin=9*25./_size;
    _spacing=9*50./_size;
    resetCachedContent();
}