使用带有X重定向的QGraphicsview时如何节省带宽

时间:2014-03-12 15:50:29

标签: c++ qt x11 bandwidth x11-forwarding

我想要显示一个大的QGraphicsScene,目前由QGraphicsView完成。 在本地使用时一切都很好,但是一旦我使用带有ssh -X的应用程序,它就非常慢。当然,总是必须传输一些数据,但是如果没有任何变化,如何只保存图像时如何保存带宽呢?

这是我的QGraphicsView:

#include "graphicsview.h"
#include <QGraphicsPixmapItem>
#include <QPixmap>
#include <QDebug>
#include <QMouseEvent>
#include <QWheelEvent>
#include <cmath>
#include <QPixmapCache>

GraphicsView::GraphicsView(QWidget *parent) :
    QGraphicsView(parent)
{
    QPixmapCache::setCacheLimit(16777216); //did not do the trick either
    this->setMouseTracking(true);
    setTransformationAnchor(AnchorUnderMouse);
    this->setDragMode(QGraphicsView::ScrollHandDrag);
    scene = new QGraphicsScene(this);
    setScene(scene);
    background = QPixmap(8000,8000);
    qDebug() << background.rect();
    scene->setSceneRect(background.rect());
    scene->setBackgroundBrush(QBrush(background));
    show();
}

void GraphicsView::wheelEvent(QWheelEvent* event) {
    scale(pow(2,event->delta()/240.0), pow(2,event->delta()/240.0));
}

0 个答案:

没有答案