Exemplo n.º 1
0
void Applet::setInteractive(bool interactive)
{
	m_interactive = interactive;

	if(m_interactive)
	{
		setAcceptsHoverEvents(true);
		setAcceptedMouseButtons(Qt::RightButton | Qt::LeftButton);
	}
	else
	{
		setAcceptsHoverEvents(false);
		setAcceptedMouseButtons(Qt::RightButton);
	}
}
Exemplo n.º 2
0
Stripbit::Stripbit(const QPainterPath & path, ConnectorItem * connectorItem, int x, int y, QGraphicsItem * parent = 0) 
	: QGraphicsPathItem(path, parent)
{
	
	if (SpotFaceCutterCursor == NULL) {
		QBitmap bitmap(":resources/images/cursor/spot_face_cutter.bmp");
		QBitmap bitmapm(":resources/images/cursor/spot_face_cutter_mask.bmp");
		SpotFaceCutterCursor = new QCursor(bitmap, bitmapm, 0, 0);
	}

	if (MagicWandCursor == NULL) {
		QBitmap bitmap(":resources/images/cursor/magic_wand.bmp");
		QBitmap bitmapm(":resources/images/cursor/magic_wand_mask.bmp");
		MagicWandCursor = new QCursor(bitmap, bitmapm, 0, 0);
	}

	setZValue(-999);			// beneath connectorItems

	setPen(Qt::NoPen);
	// TODO: don't hardcode this color
	setBrush(QColor(0xbc, 0x94, 0x51));							// QColor(0xc4, 0x9c, 0x59)


	m_right = NULL;
	m_x = x;
	m_y = y;
	m_connectorItem = connectorItem;
	m_inHover = m_removed = false;

	setAcceptsHoverEvents(true);
	setAcceptedMouseButtons(Qt::LeftButton);
	setFlag(QGraphicsItem::ItemIsMovable, true);
	setFlag(QGraphicsItem::ItemIsSelectable, false);

}
Exemplo n.º 3
0
STStatusUserNameView::STStatusUserNameView(QGraphicsItem *parent) :
    QGraphicsObject(parent)
{
    setCacheMode(DeviceCoordinateCache);
    setAcceptsHoverEvents(true);

}
Exemplo n.º 4
0
TextLayer::TextLayer(const int layer_id , QGraphicsItem *parent , QGraphicsScene *scene )
    : QGraphicsItem(parent,scene),evesum(0),modus(Show),border(1.),currentprintrender(false),
    hi(Metric("30px")),wi(Metric("110px")),bgcolor(QColor(Qt::white)),SwapLockBreak(false),
    bordercolor(QColor(Qt::red)),Rotate(0),check_view_area_time(0),ActionHover(false),
    format(DIV_ABSOLUTE),mount(new TextController)
{
    mount->q = this;
    setAcceptsHoverEvents(true);
    wisub_border = wi + border;
    history.clear();
    id = layer_id;
    setAcceptDrops(true);
    setFlag(QGraphicsItem::ItemIsSelectable,true);
    setFlag(QGraphicsItem::ItemIsFocusable,true);
    setFlag(QGraphicsItem::ItemIsMovable,false);
    setSelected(false);
    _doc = new QTextDocument();  
    _doc->setHtml(tr("<p>Write your text<p>"));
        QTextFrame  *Tframe = _doc->rootFrame();
        QTextFrameFormat rootformats = Tframe->frameFormat();
        rootformats.setWidth(wi);
        rootformats.setBorder(0);
        Tframe->setFrameFormat(rootformats);
        _doc->setPageSize(QSizeF(wi,hi)); 
        DLayout = _doc->documentLayout();
    setDocument(_doc);
    mount->txtControl()->document()->toHtml().size();  /* connect all */
    setZValue(1.99999);
    RestoreMoveAction();
    init();
}
Exemplo n.º 5
0
Guide::Guide(CustomTrackView *view, GenTime pos, QString label, double height) :
        QGraphicsLineItem(),
        m_position(pos),
        m_label(label),
        m_view(view),
        m_pen(QPen())
{
    setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIgnoresTransformations);
#if QT_VERSION >= 0x040600
    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
#endif
    setToolTip(label);
    setLine(0, 0, 0, height);
    if (m_position < GenTime()) m_position = GenTime();
    setPos(m_position.frames(m_view->fps()), 0);
    m_pen.setWidthF(0);
    m_pen.setColor(QColor(0, 0, 200, 180));
    //m_pen.setCosmetic(true);
    setPen(m_pen);
    setZValue(999);
    setAcceptsHoverEvents(true);
    const QFontMetrics metric = m_view->fontMetrics();
    m_width = metric.width(' ' + m_label + ' ') + 2;
    prepareGeometryChange();
}
Exemplo n.º 6
0
/*
********************************************************************************
*                                                                              *
*    StreamGraphicItem                                                         *
*      -> with image                                                           *
*                                                                              *
********************************************************************************
*/
StreamGraphicItem::StreamGraphicItem()
{
#if QT_VERSION < 0x050000
    setAcceptsHoverEvents(true);
#else
    setAcceptHoverEvents(true);
#endif
    setAcceptDrops(false);
    setFlag(QGraphicsItem::ItemIsSelectable, true);
    setFlag(QGraphicsItem::ItemIsMovable, false);
    setFlag(QGraphicsItem::ItemIgnoresTransformations, true);

    //! option configuration
    opt.widget = 0;
    opt.palette = QApplication::palette();
    opt.font = QApplication::font();
    opt.font.setStyleStrategy(QFont::PreferAntialias);
    opt.fontMetrics = QFontMetrics(opt.font);

    opt.showDecorationSelected = true;
    opt.decorationPosition  = QStyleOptionViewItem::Left;
    opt.decorationAlignment = Qt::AlignCenter;
    opt.displayAlignment    = Qt::AlignLeft|Qt::AlignVCenter;

    opt.locale.setNumberOptions(QLocale::OmitGroupSeparator);
    opt.state |= QStyle::State_Active;
    opt.state |= QStyle::State_Enabled;
    opt.state &= ~QStyle::State_Selected;

    opt.rect = boundingRect().toRect();
}
Exemplo n.º 7
0
ItemAttribute::ItemAttribute( int erModelID, int sx, int sy, QString attributeText ) : ItemNode( erModelID, sx, sy, PARAMETER_ATTRIBUTE, attributeText )
{
	setPath();
	setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
	setAcceptsHoverEvents(true);
	_isPrimaryKey = false;
}
Exemplo n.º 8
0
/*
********************************************************************************
*                                                                              *
*    DirectoryGraphicItem                                                      *
*                                                                              *
********************************************************************************
*/
DirectoryGraphicItem::DirectoryGraphicItem()
{
#if QT_VERSION < 0x050000
    setAcceptsHoverEvents(true);
#else
    setAcceptHoverEvents(true);
#endif 
    setAcceptDrops(false);
    setFlag(QGraphicsItem::ItemIsSelectable, true);
    setFlag(QGraphicsItem::ItemIsMovable, false);
    setFlag(QGraphicsItem::ItemIgnoresTransformations, true);

    //! option configuration
    opt.widget = 0;
    opt.palette = QApplication::palette();
    opt.font = QApplication::font();
    opt.fontMetrics = QFontMetrics(opt.font);

    opt.showDecorationSelected = true;
    opt.decorationPosition = QStyleOptionViewItem::Top;
    opt.displayAlignment = Qt::AlignCenter;

    opt.locale.setNumberOptions(QLocale::OmitGroupSeparator);
    opt.state |= QStyle::State_Active;
    opt.state |= QStyle::State_Enabled;
    opt.state &= ~QStyle::State_Selected;
    
    isSymbLink = false;
}
Exemplo n.º 9
0
Cell::Cell(ChunkScene *scene, int row, int col, int x, int y, int w, int h, const QString &note_name, QColor bg)
    :QGraphicsRectItem(x,y,w,h), _scene(scene), _row(row), _col(col), _note_name(note_name), _bg(bg)
{
    setPen(QPen(QColor(210,210,210)));
    setBrush(QBrush(_bg));
    setAcceptsHoverEvents(true);
}
Exemplo n.º 10
0
QgsComposerItem::QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition, bool manageZValue )
    : QObject( 0 )
    , QGraphicsRectItem( 0, 0, width, height, 0 )
    , mComposition( composition )
    , mBoundingResizeRectangle( 0 )
    , mFrame( true )
    , mItemPositionLocked( false )
    , mLastValidViewScaleFactor( -1 )
    , mRotation( 0 )
{
    setFlag( QGraphicsItem::ItemIsSelectable, true );
    setAcceptsHoverEvents( true );

    QTransform t;
    t.translate( x, y );
    setTransform( t );

    //set default pen and brush
    setBrush( QBrush( QColor( 255, 255, 255, 255 ) ) );
    QPen defaultPen( QColor( 0, 0, 0 ) );
    defaultPen.setWidthF( 0.3 );
    setPen( defaultPen );

//let z-Value be managed by composition
    if ( mComposition && manageZValue )
    {
        mComposition->addItemToZList( this );
    }
}
Exemplo n.º 11
0
AbstractCounter::AbstractCounter(Player *_player, int _id, const QString &_name, bool _shownInCounterArea, int _value, QGraphicsItem *parent)
    : QGraphicsItem(parent), player(_player), id(_id), name(_name), value(_value), hovered(false), aDec(0), aInc(0), dialogSemaphore(false), deleteAfterDialog(false), shownInCounterArea(_shownInCounterArea)
{
#if QT_VERSION < 0x050000
    setAcceptsHoverEvents(true);
#else
    setAcceptHoverEvents(true);
#endif

    if (player->getLocal()) {
        menu = new QMenu(name);
        aSet = new QAction(this);
        connect(aSet, SIGNAL(triggered()), this, SLOT(setCounter()));
        menu->addAction(aSet);
        menu->addSeparator();
        for (int i = -10; i <= 10; ++i)
            if (i == 0)
                menu->addSeparator();
            else {
                QAction *aIncrement = new QAction(QString(i < 0 ? "%1" : "+%1").arg(i), this);
                if (i == -1)
                    aDec = aIncrement;
                else if (i == 1)
                    aInc = aIncrement;
                aIncrement->setData(i);
                connect(aIncrement, SIGNAL(triggered()), this, SLOT(incrementCounter()));
                menu->addAction(aIncrement);
            }
    } else
        menu = 0;
    
    retranslateUi();
}
Exemplo n.º 12
0
BarText::BarText (BlockInfo & bi, QColor const & color, int x, int y, int w, int h, int tid, int tid_offs)
	: m_block(bi) 
	, m_x(x), m_y(y), m_w(w), m_h(h), m_color(color)
	, m_tid(tid), m_tid_offs(tid_offs)
{
	setZValue((x + y) % 2);
	setAcceptsHoverEvents(true);
}
Exemplo n.º 13
0
// ============================================================================
// Constructor
EditorPoint::EditorPoint(QGraphicsItem* parent)
		: QGraphicsItem(parent)
{
	setFlags( QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIgnoresTransformations );
	setAcceptsHoverEvents( true );
	_hover = false;
	setZValue( 10.0 ); // some hgih value
}
Exemplo n.º 14
0
QSanButton::QSanButton(QGraphicsItem *parent): QGraphicsObject(parent)
{
    _m_state = S_STATE_UP;
    _m_style = S_STYLE_PUSH;
    _m_mouseEntered = false;
    setSize(QSize(0, 0));
    setAcceptsHoverEvents(true);
    setAcceptedMouseButtons(Qt::LeftButton);
}
Exemplo n.º 15
0
EObject::EObject(qreal w,qreal h,qreal m, QGraphicsItem *parent)
	:width(w),height(h),margin(m), QGraphicsItem(parent)
{
	setAcceptDrops(true);
    setAcceptsHoverEvents(true);
	setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);

	createResizeFocus();
}
Exemplo n.º 16
0
void InternalToolBox::init()
{
    if (m_containment) {
        connect(m_containment, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)),
                this, SLOT(immutabilityChanged(Plasma::ImmutabilityType)));
    }

    setAcceptsHoverEvents(true);
}
Exemplo n.º 17
0
STClearButtonView::STClearButtonView(QGraphicsItem *parent) :
    QGraphicsObject(parent),m_size(0,0),
    m_drag(false),m_hover(false)
{
    setFlag(ItemHasNoContents);
    setAcceptsHoverEvents(true);

    m_item=new QGraphicsPixmapItem(this);
}
Exemplo n.º 18
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!
    setAcceptsHoverEvents(true);
    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));
}
Exemplo n.º 19
0
DeckViewCard::DeckViewCard(const QString &_name, const QString &_originZone, QGraphicsItem *parent)
    : AbstractCardItem(_name, 0, -1, parent), originZone(_originZone), dragItem(0)
{
#if QT_VERSION < 0x050000
    setAcceptsHoverEvents(true);
#else
    setAcceptHoverEvents(true);
#endif
}
Exemplo n.º 20
0
Chip::Chip(const QColor &color, int x, int y)
{
    this->x = x;
    this->y = y;
    this->color = color;
    setZValue((x + y) % 2);

    setFlags(ItemIsSelectable | ItemIsMovable);
    setAcceptsHoverEvents(true);
}
Exemplo n.º 21
0
BusyWidget::BusyWidget(Plasma::PopupApplet* parent)
 : Plasma::BusyWidget(parent),
   m_svg(new Plasma::Svg(this))
{
    setAcceptsHoverEvents(true);
    m_svg->setImagePath("icons/notification");
    m_svg->setContainsMultipleImages(true);
    setRunning(false);

}
Exemplo n.º 22
0
Bar::Bar (BlockInfo & bi, QColor const & color, int x, int y, int w, int h, int tid, int tid_offs)
	: m_block(bi) 
	, m_x(x), m_y(y), m_w(w), m_h(h), m_color(color)
	, m_tid(tid), m_tid_offs(tid_offs)
{
	setZValue((x + y) % 2);
	//setFlags(ItemIsSelectable | ItemIsMovable);
	setFlags(ItemIsSelectable);
	setAcceptsHoverEvents(true);
}
Exemplo n.º 23
0
CornerItem::CornerItem(Qt::Corner corner, bool rotateOnly, AbstractContent * parent)
    : QGraphicsItem(parent)
    , m_content(parent)
    , m_corner(corner)
    , m_opMask(rotateOnly ? Rotate | FixRotate : AllowAll)
    , m_side(8)
    , m_operation(Off)
{
    setAcceptsHoverEvents(true);
}
Exemplo n.º 24
0
STNewAccountAuthorizeView::STNewAccountAuthorizeView(KQOAuthManager *manager, QString token,QGraphicsItem *parent) :
    QGraphicsObject(parent),m_size(0,0),m_manager(manager),m_temporaryTokenString(token)
{
    setCacheMode(DeviceCoordinateCache);
    //setFlag(ItemDoesntPropagateOpacityToChildren);
    setAcceptsHoverEvents(true);
    setFlag(ItemIsFocusable);


    QImage pix;
    pix.load(":/stella/res/AuthorizeWindow.png");

    // draw title bar and so on
    QString title=tr("Login");
    STFont *font=STFont::defaultBoldFont();

    font->drawString(pix, QPointF(14, 18-1), QColor(0,0,0,96), title);
    font->drawString(pix, QPointF(14, 18), QColor(230,230,230), title);

    m_window=new QGraphicsPixmapItem(QPixmap::fromImage(pix), this);
    m_window->setOffset(-pix.width()/2,-pix.height()/2);

    m_cancelButton=new STAuthorizeCancelButton();
    m_cancelButtonProxy=new QGraphicsProxyWidget(m_window);
    m_cancelButtonProxy->setWidget(m_cancelButton);
    m_cancelButtonProxy->setPos(QPointF(239,11)+m_window->offset());

    m_animView=new STStripeAnimationView(m_window);
    m_animView->setVisible(false);
    m_animView->setPos(10+m_window->offset().x(), 36+413-20+m_window->offset().y());
    m_animView->setSize(QSize(320, 20));

    connect(m_cancelButton, SIGNAL(clicked()),
            this, SLOT(cancelled()));
    //m_cancelButtonProxy->setCacheMode(DeviceCoordinateCache);

    m_authView=NULL;
    m_request=NULL;

    m_fadeAnimation=new STSimpleAnimator(this);
    m_cancelAnimation=new STSimpleAnimator(this);
    connect(m_fadeAnimation, SIGNAL(valueChanged(float)),
            this, SLOT(fadeAnimated(float)));
    connect(m_cancelAnimation, SIGNAL(valueChanged(float)),
            this, SLOT(fadeAnimated(float)));
    m_cancelAnimation->setValue(1.f);
    m_fadeAnimation->setValue(0);

    connect(m_manager, SIGNAL(authorizationReceived(QString,QString)),
            this, SLOT(authorizationReceived(QString,QString)));
    connect(m_manager, SIGNAL(accessTokenReceived(QString,QString)),
            this, SLOT(accessTokenReceived(QString,QString)));


}
Exemplo n.º 25
0
ReportRectEntity::ReportRectEntity(ReportDesigner *r)
        : QGraphicsRectItem(), ReportEntity(r)
{
    m_dpiX = KoGlobal::dpiX();
    m_dpiY = KoGlobal::dpiY();

    m_ppos = 0;
    m_psize = 0;

    setAcceptsHoverEvents(true);
}
LinkDialogArrowGraphicsItem::LinkDialogArrowGraphicsItem(LinkDialogPropertyGraphicsItem* source, LinkDialogPropertyGraphicsItem* destination, bool bidirectional)
    : ArrowGraphicsItem(source, destination)
    , bidirectional_(bidirectional)
{
    tgtAssert(source, "passed null pointer");

    setFlag(ItemIsSelectable);
    setAcceptsHoverEvents(true);

    if (destination)
        setDestinationItem(destination);
}
Exemplo n.º 27
0
void QDeclarativeGeoMapMouseArea::setHoverEnabled(bool hoverEnabled)
{
    if (hoverEnabled == hoverEnabled_)
        return;

    hoverEnabled_ = hoverEnabled;
    setAcceptsHoverEvents(hoverEnabled_);
    setAcceptHoverEvents(hoverEnabled_);
    setAcceptedMouseButtons(Qt::LeftButton);
    emit hoverEnabledChanged(hoverEnabled_);
    // TODO update hovered property
}
Exemplo n.º 28
0
Fidelity::GUI::ANodeItem::ANodeItem(ANode* node, QGraphicsItem* parent) : QGraphicsEllipseItem(parent)
{
	m_Node = node;
	
	// Prepare node properties
	setAcceptsHoverEvents(true);
	setCursor(Qt::CrossCursor);
	setRect(0, 0, NodeSize, NodeSize);
	
	// Make sure node is on top of things
	setZValue(1);
	
	// Move the node to it's predefined position and resize it to NodeSize
	switch(m_Node->Position()) {
		case Left:
			setPos(-NodeSize, (parent->boundingRect().height() - NodeSize) / 2);
			break;
		case UpperLeft:
			setPos(-NodeSize, 0);
			break;
		case LowerLeft:
			setPos(-NodeSize, parent->boundingRect().height() - NodeSize);
			break;
		case Right:
			setPos(parent->boundingRect().width(), (parent->boundingRect().height() - NodeSize) / 2);
			break;
		case UpperRight:
			setPos(parent->boundingRect().width(), 0);
			break;
		case LowerRight:
			setPos(parent->boundingRect().width(), parent->boundingRect().height() - NodeSize);
			break;
		case Top:
			setPos((parent->boundingRect().width() - NodeSize) / 2, -NodeSize);
			break;
		case TopLeft:
			setPos(0, -NodeSize);
			break;
		case TopRight:
			setPos(parent->boundingRect().width() - NodeSize, -NodeSize);
			break;
		case Bottom:
			setPos((parent->boundingRect().width() - NodeSize) / 2, parent->boundingRect().height());
			break;
		case BottomLeft:
			setPos(0, parent->boundingRect().height());
			break;
		case BottomRight:
			setPos(parent->boundingRect().width() - NodeSize, parent->boundingRect().height());
			break;
	}
}
Exemplo n.º 29
0
 ImageItem::ImageItem(int id, const QPixmap &pixmap, QGraphicsItem *parent,
                      QGraphicsScene *scene)
     : QGraphicsPixmapItem(pixmap, parent, scene)
 {
     recordId = id;
     setAcceptsHoverEvents(true);
     image = pixmap;
     timeLine.setDuration(300);
     timeLine.setFrameRange(0, 300);
     connect(&timeLine, SIGNAL(frameChanged(int)), this, SLOT(setFrame(int)));
     connect(&timeLine, SIGNAL(finished()), this, SLOT(updateItemPosition()));
     adjust();
 }
Exemplo n.º 30
0
DivePictureItem::DivePictureItem(int row, QObject *parent): DivePixmapItem(parent)
{
	setFlag(ItemIgnoresTransformations);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
	setAcceptsHoverEvents(true);
#else
	setAcceptHoverEvents(true);
#endif
	rowOnModel = row;
	setScale(0.2);
	connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
	setVisible(prefs.show_pictures_in_profile);
}