示例#1
0
PileZone::PileZone(Player *_p, const QString &_name, bool _isShufflable, bool _contentsKnown, QGraphicsItem *parent)
    : CardZone(_p, _name, false, _isShufflable, _contentsKnown, parent)
{
    setCacheMode(DeviceCoordinateCache); // Do not move this line to the parent constructor!
#if QT_VERSION < 0x050000
    setAcceptsHoverEvents(true);
#else
    setAcceptHoverEvents(true);
#endif
    setCursor(Qt::OpenHandCursor);
    
    setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(90).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
}
示例#2
0
AniPreviewView::AniPreviewView(AniPreviewWnd* pParent) : QGraphicsView(pParent), m_pWnd(pParent)
{
	AniPreviewScene *scene = new AniPreviewScene(this);
	setScene(scene);
	scene->setSceneRect(-2000, -2000, 4000, 4000);
	
	setRenderHint(QPainter::Antialiasing);
	setCacheMode(CacheBackground);
	setViewportUpdateMode(BoundingRectViewportUpdate);
	setRenderHint(QPainter::Antialiasing);
	setTransformationAnchor(AnchorUnderMouse);
	centerOn(QPoint(0, 0));
}
示例#3
0
void DesktopWidget::spin()
{
    d->angle += 18;
    setCacheMode(ItemCoordinateCache);
    QPointF center = boundingRect().center();
    QTransform mat = QTransform();
    mat.translate(center.x() ,  center.y());
    mat.rotate(d->angle, Qt::YAxis);
    mat.translate(- center.x() ,  - center.y());
    setTransform(mat);
    if (d->angle >= 180) {
        if (state() == BACKSIDE) {
            setState(NORMALSIDE);
        } else {
            setState(BACKSIDE);
        }
        d->spintimer->stop();
        resetMatrix();
        setCacheMode(DeviceCoordinateCache);
        d->angle = 0;
    }
}
示例#4
0
RoundRectItem::RoundRectItem(const QRectF &bounds,
                             const QColor &color,
                             QGraphicsItem *parent)
    : QGraphicsObject(parent),
      m_bounds(bounds)
{
    setCacheMode(ItemCoordinateCache);

    m_gradient.setStart(bounds.topLeft());
    m_gradient.setFinalStop(bounds.bottomRight());
    m_gradient.setColorAt(0, color);
    m_gradient.setColorAt(1, color.dark(200));
}
示例#5
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
tAbstractSideBar::~tAbstractSideBar()
{
    if (m_pAnimationTimer != 0)
    {
        m_pAnimationTimer->stop();
    }

#ifdef TICONITEM_USE_CACHE
    // need to set the cache mode to NoCache to ensure the the QPixmapCache is flushed
    // not doing this can result in new tIconItems residing at the same address getting a false cache hit
    setCacheMode( QGraphicsItem::NoCache );
#endif
}
示例#6
0
canvas_flag::canvas_flag(canvas_view *i_oGraphWidget, canvas_item *i_oFrom)
	: QGraphicsRectItem(), m_oGraph(i_oGraphWidget)
{
	setFlags(NULL);
	m_oItem = i_oFrom;
	setRect(0, 0, 19, 19);

	/* set the z value to 51 */
	setZValue(51);

	i_oGraphWidget->scene()->addItem(this);
	setParentItem(m_oItem);
	setCacheMode(QGraphicsItem::DeviceCoordinateCache);
}
// +-----------------------------------------------------------
ft::FaceFeatureNode::FaceFeatureNode(int iID, FaceWidget *pFaceWidget)
{
	m_pFaceWidget = pFaceWidget;

    setFlag(ItemIsMovable);
    setFlag(ItemSendsGeometryChanges);
	setFlag(ItemIsSelectable);
    setCacheMode(DeviceCoordinateCache);

	setSelected(false);
	setAcceptHoverEvents(true);

	m_iID = iID;
}
示例#8
0
TraceGraphPoint::TraceGraphPoint(TraceGraphItem* i_parent,
				 TraceGraphPoint::PointPosition i_position)
  : QGraphicsItem(i_parent),
    m_positionOnTrace(i_position),
    m_isBeingMoved(false),
    m_startPointAtMouseDown(QPointF(0.0,0.0)) {
  setFlag(QGraphicsItem::ItemIsSelectable, true);
  setFlag(QGraphicsItem::ItemIsMovable);
  setFlag(QGraphicsItem::ItemSendsGeometryChanges);
  setCacheMode(QGraphicsItem::DeviceCoordinateCache);
  setCursor(Qt::CrossCursor);
  LOG_DEBUG("Constructing a TraceGraphPoint");
  updatePositionOnScene(i_parent->getTracePointer().lock());
}
/*!
    \brief The constructor initializes everything needed for the 3D animation.
 */
AboutDialogGraphicsView::AboutDialogGraphicsView(AboutDialog *aboutDialog, QWidget *parentWindow) : QGraphicsView(parentWindow)
	, _aboutDialog(NULL)
	, _graphicsProxyWidget(NULL)
	, _parentWindow(NULL)
	, _timeLine(NULL)
	, _aboutDialogAsSplashScreen(NULL)
{
    _parentWindow = parentWindow;
    setWindowFlags(Qt::SplashScreen);

#ifdef Q_OS_LINUX
    QRect availableGeometry = QApplication::desktop()->availableGeometry();
    QRect newGeometry = QRect( availableGeometry.x(), availableGeometry.y(), availableGeometry.width(), availableGeometry.height() );
#else
    QRect newGeometry = QRect( -1,-1, QApplication::desktop()->rect().width()+2, QApplication::desktop()->rect().height()+2 );
#endif
    setGeometry( newGeometry );

    _aboutDialog = aboutDialog;

    _windowTitleBarWidth = 0;
    _windowPosOffset = 0;

    QGraphicsScene *scene = new QGraphicsScene(this);
    setSceneRect( newGeometry );
    _aboutDialogAsSplashScreen = new QSplashScreen(this);
    _graphicsProxyWidget = scene->addWidget(_aboutDialogAsSplashScreen);
    _graphicsProxyWidget->setWindowFlags( Qt::ToolTip );

    setScene( scene );
    setRenderHint(QPainter::Antialiasing);

    setCacheMode(QGraphicsView::CacheBackground);
    setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);

    connect(_aboutDialog, SIGNAL(finished(int)), this, SLOT(hide()));

    //setWindowOpacity(0.9);

    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setStyleSheet("AboutDialogGraphicsView { border: 0px; }");

    _timeLine = new QTimeLine(1000, this);
    _timeLine->setFrameRange(270, 0);
    //_timeLine->setUpdateInterval(10);
    //_timeLine->setCurveShape(QTimeLine::EaseInCurve);
    connect(_timeLine, SIGNAL(frameChanged(int)), this, SLOT(updateStep(int)));
}
示例#10
0
Node::Node(GraphWidget *graphWidget, QColor qtColor)
    : graph(graphWidget)
{
    setFlag(ItemIsMovable);
    setFlag(ItemSendsGeometryChanges);
    setCacheMode(DeviceCoordinateCache);
    setZValue(-1);
    //setOpacity(0.10);
    nodeOpacity = false;
    bckColor = qtColor;
     //connect(this, SIGNAL(choixStation(QString)), graph, SLOT(clickinfo(QString)));
    connect(this, &Node::choixStation, graph, &GraphWidget::clickinfo );
    connect(this, &Node::nodeA, graph, &GraphWidget::stDebut );
    connect(this, &Node::nodeB, graph, &GraphWidget::stFin );
}
示例#11
0
文件: node.cpp 项目: Isaac96/eepe
Node::Node(QSpinBox *sb)
{
    setFlag(ItemIsMovable);
    setFlag(ItemSendsGeometryChanges);
    setCacheMode(DeviceCoordinateCache);
    setZValue(-1);

    qsb = sb;
    bPressed  = false;
    centerX   = true;
    centerY   = true;
    fixedX    = false;
    fixedY    = false;
    ballSize = DEFAULT_BALL_SIZE;
}
示例#12
0
View::View(QWidget *parent)
    : QGraphicsView(parent)
    , m_zoomFactor(1.0)
{
    setBackgroundBrush(QBrush(s_backgroundColor));
    setCacheMode(QGraphicsView::CacheBackground);
    setRenderHints(QPainter::Antialiasing);
    setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
    setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
    setDragMode(QGraphicsView::RubberBandDrag);

    setAttribute(Qt::WA_AcceptTouchEvents);
    grabGesture(Qt::PanGesture);
    grabGesture(Qt::PinchGesture);
}
示例#13
0
文件: PathItem.cpp 项目: KDE/tikzkit
PathItem::PathItem(tikz::core::Path * path, QGraphicsItem * parent)
    : TikzItem(parent)
    , d(new PathPrivate())
{
    d->path = path;

    // setPos needed?
    setPos(0, 0);

    setFlag(QGraphicsItem::ItemIsSelectable, true);
    setCacheMode(QGraphicsItem::DeviceCoordinateCache);

    // forward changed() signal
    connect(d->path, SIGNAL(changed()), this, SIGNAL(changed()));
}
StoryLineWidget::StoryLineWidget(){
	QGraphicsScene *scene = new QGraphicsScene(this);
	scene->setItemIndexMethod(QGraphicsScene::NoIndex);
	scene->setSceneRect(QRectF(0, 0, 3200, 300));
	setScene(scene);
	setCacheMode(CacheBackground);
	setViewportUpdateMode(BoundingRectViewportUpdate);
	setRenderHint(QPainter::Antialiasing);
	setTransformationAnchor(AnchorUnderMouse);

	this->setAlignment(Qt::AlignLeft);

	story_stamp_vec_.clear();
	result_value_map_ = NULL;
}
示例#15
0
void Clock::clockConfigAccepted()
{
    KConfigGroup cg = config();
    m_showTimezoneString = ui.showTimezoneStringCheckBox->isChecked();
    m_showingTimezone = m_showTimezoneString || shouldDisplayTimezone();
    m_showSecondHand = ui.showSecondHandCheckBox->isChecked();

    if (m_showSecondHand) {
        //We don't need to cache the applet if it update every seconds
        setCacheMode(QGraphicsItem::NoCache);
    } else {
        setCacheMode(QGraphicsItem::DeviceCoordinateCache);
    }

    cg.writeEntry("showSecondHand", m_showSecondHand);
    cg.writeEntry("showTimezoneString", m_showTimezoneString);
    update();

    dataEngine("time")->disconnectSource(currentTimezone(), this);
    connectToEngine();

    constraintsEvent(Plasma::AllConstraints);
    emit configNeedsSaving();
}
示例#16
0
void GraphicsView::init(GraphicsScene* scene)
{
	mIsPressed = false;
	setRenderHint(QPainter::Antialiasing, false);
	connect(this, SIGNAL(sizeChange(int, int)), scene, SLOT(changeSceneRect(int, int)));
	connect(this, SIGNAL(zoom(int, QPointF)), scene, SLOT(zoom(int, QPointF)));
	connect(this, SIGNAL(move(QPointF)), scene, SLOT(move(QPointF)));
	//setOptimizationFlag(QGraphicsView::DontSavePainterState);
	setViewportUpdateMode(FullViewportUpdate);
	setCursor(Qt::OpenHandCursor);
	setDragMode(QGraphicsView::ScrollHandDrag);
	setCacheMode(CacheBackground);
	setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));

}
示例#17
0
文件: node.cpp 项目: Iownnoname/qt
Node::Node( GraphicsWidget* gw, int num, int size, 
			QString col, QString shape, bool numIn, 
			int ldist, int ndist, QPointF p 
			) : graphicsWidget (gw) 
{
	Q_UNUSED(p);
	graphicsWidget->scene()->addItem(this); //Without this nodes don't appear on the screen...

//ItemSendsGeometryChanges  introduced in Qt 4.6...
#if QT_VERSION >= 0x040600
	setFlags(ItemSendsGeometryChanges | ItemIsSelectable | ItemIsMovable);
    setCacheMode(QGraphicsItem::ItemCoordinateCache); //QT < 4.6 if a cache mode is set, nodes do not respond to hover events
//DeviceCoordinateCache
#else
	setFlags(ItemIsSelectable | ItemIsMovable ); //Without this, the node cannot move nor be selected ...
	setCacheMode(QGraphicsItem::NoCache); //QT < 4.6 if a cache mode is set, nodes do not respond to hover events
#endif
    setAcceptHoverEvents(true);

	m_num=num;
	m_size=size;
	m_hasLabel=false;
	m_hasNumber=false;
	m_isNumberInside = numIn;
	m_shape=shape;
	m_col_str=col;
	m_col=QColor(col);
	m_nd=ndist;
	m_ld=ldist;
	m_poly_t=new QPolygon(3);
	m_poly_d=new QPolygon(4);
	qDebug()<< "Node: constructor: initial position at: "
			<< this->x()<<", "<<this->y()
			<< " Will move at: "<< p.x()<<", "<<p.y();;

} 
CodeViewInteractiveRect::CodeViewInteractiveRect(CodeMiniMap *minimap)
    : m_codeminimap(minimap)
{
	setFlags(ItemIsMovable);
	this->setAcceptHoverEvents(true);
	this->setAcceptedMouseButtons(Qt::LeftButton);
    setFlag(ItemSendsGeometryChanges);
    setCacheMode(DeviceCoordinateCache);
    setZValue(-1);

	rect_active = false;

	//rect_height = 0.0;
	//rect_width = 0.0;
}
示例#19
0
QTextPanel::QTextPanel(QWidget * parent)
		: QGraphicsView(parent),
        onPrintRender(false),BASE_TEXT(new QTextPanelLayerControl(0))
{
    /* BASE_TEXT must start at first to play the QRect from scene*/
	QApplication::restoreOverrideCursor();
	QPalette p = palette();
	p.setColor(QPalette::Window,Qt::lightGray);
	p.setColor(QPalette::Base,Qt::lightGray);
	setPalette(p);
	scene = new GraphicsScene(rectToScene(),this);    /* QRect from page tot BASE_TEXT */
	setCacheMode(CacheBackground);
	setScene(scene);
    pageClear();  /* clear all item and reinit */
}
示例#20
0
QGraphicViewDm::QGraphicViewDm(QWidget *parent) :
    QGraphicsView(parent)
{
    int iWidth , iHeight ;
//    iWidth = width( );
//    iHeight = height( );

    iWidth = 600 ;
    iHeight = 230 ;

    QGraphicsScene *scene = new QGraphicsScene(this);
    scene->setSceneRect(-iWidth/2,-iHeight/2,iWidth,iHeight);
    setScene(scene);
    setCacheMode(CacheBackground);

    //加一个矩形
    QRectF r = QRectF(-iWidth/2,-iHeight/2,iWidth,iHeight);
//    qDebug( ) <<  r.topLeft() << r.bottomRight() ;

    QRectF r1  = r.adjusted( 20, 20, -20, -20 );
//    qDebug( ) <<  r1.topLeft() << r1.bottomRight() ;

    QGraphicsRectItem * pRect = scene->addRect( r1 );  //创建用的是对象座标
    pRect->setPos( 0, 0 );    //给的是场景座标

    pItemDm = new ItemDm ;

    // 4/5 的宽度  2/3的高度
    float  fAdjust1, fAdjust2 ;

    fAdjust1 = 1.0 / 10.0 * iWidth  ;
    fAdjust2 = 1.0 / 6.0 * iHeight  ;

//    qDebug( ) << fAdjust1 << fAdjust2 << r.adjusted( fAdjust1 , fAdjust2, -1*fAdjust1, -1*fAdjust2 ) ;
    pItemDm->init( r.adjusted( fAdjust1 , fAdjust2, -1*fAdjust1, -1*fAdjust2 ) );
    pItemDm->setWater( 1250.00 );

    scene->addItem( pItemDm );
    pItemDm->setPos( 0, 0 );

    //制作
    QRectF  rectFish( 0, 0, 15, 5 );
    pFish = scene->addEllipse( rectFish );
    pFish->setPos( 0, 0 );
    //pFish->setBrush( QBrush(Qt::red) );
    pFish->setBrush( QBrush(Qt::green) );

}
ProcessorStatusGraphicsItem::ProcessorStatusGraphicsItem(QGraphicsRectItem* parent,
                                                         Processor* processor)
    : EditorGraphicsItem(parent)
    , processor_(processor)
    , size_(10.0f)
    , lineWidth_(3.0f)
    , state_(State::Invalid)
    , current_(State::Invalid) {
    setRect(-0.5f * size_ - lineWidth_, -0.5f * size_ - lineWidth_, size_ + 2.0 * lineWidth_,
            size_ + 2.0 * lineWidth_);

    setCacheMode(QGraphicsItem::DeviceCoordinateCache);
    setPos(QPointF(64.0f, -15.0f));

    processor->ProcessorObservable::addObserver(this);
}
示例#22
0
//! [0]
Node::Node(GraphWidget *graphWidget, QPixmap* pixmap, int id, int l)
    : graph(graphWidget), pixmap_(pixmap), id_(id), level_(l)
{
    setFlag(ItemIsMovable);
    setFlag(ItemSendsGeometryChanges);
    setCacheMode(DeviceCoordinateCache);
    setZValue(-1);

	w = pixmap_->width();
	h = pixmap_->height();

	is_fixed_pos_ = false;
	is_only_pull_ = false;
	is_fixed_y_pos_ = false;
	is_selected_ = false;
}
示例#23
0
文件: GNode.cpp 项目: MIPT-ILab/ICDV
GNode::GNode(QMainWindow * graphWidget, bool dummy,
             int m_id,
             const QString * source)
{
    m_graphWidget = graphWidget;
    is_dummy = dummy;
    clicked = false;
    setFlag(ItemIsMovable);
    setFlag(ItemSendsGeometryChanges);
    setCacheMode(DeviceCoordinateCache);
    setZValue(-1);
    id = m_id;
    m_source.clear();
    if (source)
        m_source += (*source);
}
示例#24
0
TableLens::TableLens() {
    this->setFocusPolicy(Qt::StrongFocus);
	this->setAlignment(Qt::AlignHCenter | Qt::AlignTop);

    scene_ = new QGraphicsScene(this);
	scene_->setItemIndexMethod(QGraphicsScene::NoIndex);
	setScene(scene_);

	setCacheMode(CacheBackground);
	setViewportUpdateMode(BoundingRectViewportUpdate);
	setRenderHint(QPainter::Antialiasing);
	setTransformationAnchor(AnchorUnderMouse);

	this->setBackgroundBrush(Qt::color0);
	this->autoFillBackground();
}
ProcessorPortGraphicsItem::ProcessorPortGraphicsItem(ProcessorGraphicsItem* parent,
                                                     const QPointF& pos, bool up, Port* port)
    : EditorGraphicsItem(parent)
    , processor_(parent)
    , port_(port)
    , size_(9.0f)
    , lineWidth_(1.0f)
    , up_(up) {
    

    setCacheMode(QGraphicsItem::DeviceCoordinateCache);
    setRect(-0.5f * size_ - lineWidth_, -0.5f * size_ - lineWidth_, size_ + 2.0 * lineWidth_,
            size_ + 2.0 * lineWidth_);
    setPos(pos);
    setFlags(ItemSendsScenePositionChanges);
}
示例#26
0
ArmWidget::ArmWidget(QWidget *parent)
    : QGraphicsView(parent), timerId(0)
{

    QGraphicsScene *scene = new QGraphicsScene(this);
    scene->setItemIndexMethod(QGraphicsScene::NoIndex);
    scene->setSceneRect(0, 00, 210, 110);

	shoulder = true;
	elbow = true;
    setScene(scene);
    setCacheMode(CacheBackground);
    setViewportUpdateMode(BoundingRectViewportUpdate);
    setRenderHint(QPainter::Antialiasing);
    setTransformationAnchor(AnchorUnderMouse);
    scale(qreal(1), qreal(1));
    setMinimumSize(210, 110);
    setWindowTitle(tr("Elastic Nodes"));

    joint *joint1 = new joint(this);
    joint *joint2 = new joint(this);
    joint *joint3 = new joint(this);


    scene->addItem(joint1);
    scene->addItem(joint2);
    scene->addItem(joint3);

    joint3->setFlag(joint3->ItemIsMovable);

    double x = armShoulderSegmentMeters;
    double y = armElbowSegmentMeters;

    joint1->setPos(this->sceneRect().left()+ARM_SHOULDER_X+5, this->sceneRect().bottom()-ARM_Y+ARM_BODY_TOP+5);
    joint2->setPos(this->sceneRect().left()+ARM_SHOULDER_X+5, -MetersToPixels(y)-ARM_Y+ARM_BODY_TOP+5+this->sceneRect().bottom());


    joint3->setPos(MetersToPixels(x)+this->sceneRect().left()+ARM_SHOULDER_X+5,
                   -MetersToPixels(y)-ARM_Y+ARM_BODY_TOP+5+this->sceneRect().bottom());
    end_effector = QPointF(0,0);

    QGraphicsLineItem *line = new QGraphicsLineItem(joint1->pos().x()-5,joint1->pos().y()-5,joint2->pos().x()-5,joint2->pos().y()-5);
    scene->addItem(line);
    QGraphicsLineItem *line2 = new QGraphicsLineItem(joint2->pos().x()-5,joint2->pos().y()-5,joint3->pos().x()-5,joint3->pos().y()-5);
    scene->addItem(line2);

 }
示例#27
0
WristWidget::WristWidget(QWidget *parent)
    : QGraphicsView(parent), timerId(0)
{

    QGraphicsScene *scene = new QGraphicsScene(this);
    scene->setItemIndexMethod(QGraphicsScene::NoIndex);
    scene->setSceneRect(0, 0, 50, 50);


    setScene(scene);
    setCacheMode(CacheBackground);
    setViewportUpdateMode(BoundingRectViewportUpdate);
    setRenderHint(QPainter::Antialiasing);
    setTransformationAnchor(AnchorUnderMouse);
    scale(qreal(1), qreal(1));
    setMinimumSize(50, 50);
    setWindowTitle(tr("Elastic Nodes"));


    wristAngle = 0;


    int x = WRIST_WIDTH / 2 * cos(wristAngle);
    int y = WRIST_WIDTH / 2 * sin(wristAngle);
    Line *line = new Line(
                    WRIST_CENTER_X - x, WRIST_CENTER_Y + y,
                    WRIST_CENTER_X + x, WRIST_CENTER_Y - y);

    line->setTransformOriginPoint(WRIST_CENTER_X,WRIST_CENTER_Y);
    x = WRIST_HEIGHT * cos(wristAngle + M_PI / 2);
    y = WRIST_HEIGHT * sin(wristAngle + M_PI / 2);
    QGraphicsLineItem *line2 = new QGraphicsLineItem(
                    WRIST_CENTER_X, WRIST_CENTER_Y,
                    WRIST_CENTER_X + x, WRIST_CENTER_Y - y);

    line->setPen(QPen(Qt::red,WRIST_LINE_WIDTH));
    line2->setPen(QPen(Qt::red,WRIST_LINE_WIDTH));

    // make the line be able to rotate around the origin point given as parameters
    line->setFlag(line->ItemIsMovable);
    line->setTransformOriginPoint(WRIST_CENTER_X, WRIST_CENTER_Y);
    scene->addItem(line);
    scene->addItem(line2);

    timerId = startTimer(1000 / 25);

 }
示例#28
0
//------------------------------------------------------------------------------
QNodeViewPort::QNodeViewPort(int parameterType, size_t idx, QGraphicsItem* parent)
    : QGraphicsPathItem(parent), _idx(idx), _radius(5), _margin(2), _parameterType(parameterType), _state(State::None)
{
  setCacheMode(DeviceCoordinateCache);

  setFlag(QGraphicsItem::ItemSendsScenePositionChanges);

  _label = new QGraphicsTextItem(this);
  _label->setCacheMode(DeviceCoordinateCache);

  QPainterPath path;
  path.addEllipse(-_radius, -_radius, _radius * 2, _radius * 2);
  setPath(path);

  setPen(QPen(QColor(100, 100, 100))); // GW-TODO: Expose to QStyle
  setBrush(QColor(155, 155, 155));     // GW-TODO: Expose to QStyle
}
NetworkEditorView::NetworkEditorView(NetworkEditor* networkEditor, InviwoMainWindow* parent)
    : QGraphicsView(parent)
    , NetworkEditorObserver()
    , mainwindow_(parent)
    , networkEditor_(networkEditor) {

    NetworkEditorObserver::addObservation(networkEditor_);
    QGraphicsView::setScene(networkEditor_);
    
    setRenderHint(QPainter::Antialiasing, true);
    setMouseTracking(true);
    setDragMode(QGraphicsView::RubberBandDrag);
    setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    setCacheMode(QGraphicsView::CacheBackground);

    setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
}
示例#30
0
SelectItem::SelectItem(QGraphicsItem *parent) :
    QGraphicsObject(parent),
    courses_(this),
    selectArrow_(this),
    song_(0),
    isChoosed_(false)
{
    barLeftPixmap_ = PixmapManager::get(Ts::resSelectBarLeft);
    barMidPixmap_ = PixmapManager::get(Ts::resSelectBarMid);
    barRightPixmap_ = PixmapManager::get(Ts::resSelectBarRight);

    resetBoundingRect();

    setCacheMode(DeviceCoordinateCache);

    selectArrow_.hide();
}