bool StelSkyItem::event(QEvent * e) { switch (e->type()){ case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: { QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e); QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); if (touchPoints.count() == 1) setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton); return true; break; } case QEvent::Gesture: setAcceptedMouseButtons(0); return gestureEvent(static_cast<QGestureEvent*>(e)); break; default: return QGraphicsWidget::event(e); } }
//! //! Enables or disables the graphics item. //! //! \param enabled The new enabled state for the item. //! void ConnectionGraphicsItem::setEnabled ( bool enabled ) { QGraphicsLineItem::setEnabled(enabled); setAcceptHoverEvents(enabled); if (enabled) setAcceptedMouseButtons(Qt::LeftButton | Qt::MidButton | Qt::RightButton | Qt::XButton1 | Qt::XButton2); else setAcceptedMouseButtons(0); }
void Pin::setActivity(const bool& b) { mEnabled = b; if (mEnabled) { setAcceptedMouseButtons(Qt::LeftButton); setCursor(Qt::PointingHandCursor); } else { setAcceptedMouseButtons(Qt::NoButton); setCursor(Qt::ArrowCursor); } }
void Applet::setInteractive(bool interactive) { m_interactive = interactive; if(m_interactive) { setAcceptsHoverEvents(true); setAcceptedMouseButtons(Qt::RightButton | Qt::LeftButton); } else { setAcceptsHoverEvents(false); setAcceptedMouseButtons(Qt::RightButton); } }
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); }
QmlProfilerCanvas::QmlProfilerCanvas() : m_context2d(new Context2D(this)) { setFlag(QGraphicsItem::ItemHasNoContents, false); setAcceptedMouseButtons(Qt::LeftButton); setCacheMode(QGraphicsItem::DeviceCoordinateCache); }
QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent) : QQuickItem(parent), m_plugin(0), m_serviceProvider(0), m_mappingManager(0), m_center(51.5073,-0.1277), //London city center m_activeMapType(0), m_gestureArea(new QQuickGeoMapGestureArea(this)), m_map(0), m_error(QGeoServiceProvider::NoError), m_zoomLevel(8.0), m_componentCompleted(false), m_mappingManagerInitialized(false), m_color(QColor::fromRgbF(0.9, 0.9, 0.9)), m_pendingFitViewport(false), m_validRegion(false) { setAcceptHoverEvents(false); setAcceptedMouseButtons(Qt::LeftButton); setFlags(QQuickItem::ItemHasContents | QQuickItem::ItemClipsChildrenToShape); setFiltersChildMouseEvents(true); connect(this, SIGNAL(childrenChanged()), this, SLOT(onMapChildrenChanged()), Qt::QueuedConnection); m_activeMapType = new QDeclarativeGeoMapType(QGeoMapType(QGeoMapType::NoMap, tr("No Map"), tr("No Map"), false, false, 0), this); }
SelectedItem::SelectedItem(Item* selectedItem, const StyleType* style) : Item(nullptr, style), selectedItem_(selectedItem) { setFlags(0); setAcceptedMouseButtons(0); setZValue(LAYER_SELECTION_Z); }
void QDeclarativeWebView::init() { d = new QDeclarativeWebViewPrivate(this); if (QWebSettings::iconDatabasePath().isNull() && QWebSettings::globalSettings()->localStoragePath().isNull() && QWebSettings::offlineStoragePath().isNull() && QWebSettings::offlineWebApplicationCachePath().isNull()) QWebSettings::enablePersistentStorage(); setAcceptedMouseButtons(Qt::LeftButton); setFlag(QGraphicsItem::ItemHasNoContents, true); setFlag(QGraphicsItem::ItemIsFocusScope, true); setClip(true); d->view = new GraphicsWebView(this); d->view->setResizesToContents(true); d->view->setFocus(); QWebPage* wp = new QDeclarativeWebPage(this); setPage(wp); if (!preferredWidth()) setPreferredWidth(d->view->preferredWidth()); if (!preferredHeight()) setPreferredHeight(d->view->preferredHeight()); connect(d->view, SIGNAL(geometryChanged()), this, SLOT(updateDeclarativeWebViewSize())); connect(d->view, SIGNAL(doubleClick(int,int)), this, SIGNAL(doubleClick(int,int))); connect(d->view, SIGNAL(scaleChanged()), this, SIGNAL(contentsScaleChanged())); }
QmlWebViewWidget::QmlWebViewWidget(QQuickItem *parent) : QQuickPaintedItem(parent) { setOpaquePainting(true); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::AllButtons); setFlag(QQuickItem::ItemAcceptsDrops, true); setFlag(QQuickItem::ItemHasContents, true); m_widget = new QmlWebViewInternalWidget(this); connect(m_widget, SIGNAL(urlChanged(QUrl)), this, SIGNAL(urlChanged(QUrl)) ); connect(m_widget, SIGNAL(loadStarted()), this, SIGNAL(loadStarted())); connect(m_widget, SIGNAL(loadFinished(bool)), this, SIGNAL(loadFinished(bool))); connect(m_widget, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); QObject::connect(this, &QQuickPaintedItem::widthChanged, this, [this]{ QQuickWindow *w = this->window(); if(w){ QObject::connect(w, &QQuickWindow::xChanged, this, &QmlWebViewWidget::updateGeometry, (Qt::ConnectionType)(Qt::AutoConnection|Qt::UniqueConnection)); } }); }
GraphicObservationPointItem::GraphicObservationPointItem(ObservationPoint * _obsPoint,qreal _posx,qreal _posy,qreal _width,QDateTime _startdate,QDateTime _obsdate,QGraphicsItem * _parent) :QGraphicsItem(_parent) { this->setParentItem(_parent); this->width=_width; this->parent=_parent; this->obsPoint=_obsPoint; this->setPos(_posx,0); this->posx=_posx; this->posy=_posy; setFlag(QGraphicsItem::ItemIsMovable, true); setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemIsFocusable, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setAcceptDrops(true); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); qreal parent_h=static_cast<GraphicStoryItem*>(this->parent)->get_rect().height(); qreal parent_y=static_cast<GraphicStoryItem*>(this->parent)->get_rect().y(); this->setAcceptHoverEvents(false); QPointF point2=QPointF(posx,parent_y+parent_h/2); this->rect=QRectF(point2-QPointF(10,10),point2+QPointF(10,10)); if (static_cast<GraphicStoryItem*>(parent)->get_isStorySplit()){ this->obsPoint->set_timepoint(_obsdate); this->setToolTip(translate_second_in_DD_HH_MM_SS(get_seconds_from_date(_startdate,this->obsPoint->get_timepoint()))); } else{ this->obsPoint->set_timepoint(_obsdate); this->setToolTip(translate_second_in_DD_HH_MM_SS(get_seconds_from_date(_startdate,this->obsPoint->get_timepoint()))); } }
TimeDisplay::TimeDisplay(QGraphicsItem* parent) : QGraphicsTextItem(parent) { setAcceptedMouseButtons(Qt::NoButton); setAcceptHoverEvents(false); mFont = QFont("Arial", 18, QFont::Normal, false); mFont.setStyleHint(QFont::SansSerif); mFont.setPixelSize(24); setFont(mFont); setDefaultTextColor(QColor("#d7d8da")); mShowTenth = true; mSs = mLastSs = ""; mHs = ""; mInterval = 50; mPaused = false; mStopped = true; mGameTime = 0; mTime = 0; mTimer = new GameTimer(this); connect(mTimer, SIGNAL(TimeOutSignal(int)), this, SLOT(DisplayTime(int))); mTimer->Start(); setTextWidth(440); setTransform(QTransform::fromScale(0.5, 0.5), true); //scale(0.5, 0.5); }
Window::Window(const QString &title, const QSizeF &size, const QString &path/* = QString()*/, bool isModal/* = false*/, bool isShowTitle/* = true*/) : size(size), keep_when_disappear(false), m_isModal(isModal) { setFlags(ItemIsMovable); setAcceptedMouseButtons(Qt::LeftButton); setData(0, title); if (!path.isEmpty()) { outimg = new QImage(path); } else { outimg = size.width() > size.height() ? new QImage("image/system/tip.png") : new QImage("image/system/about.png"); } scaleTransform = new QGraphicsScale(this); scaleTransform->setXScale(1.05); scaleTransform->setYScale(0.95); scaleTransform->setOrigin(QVector3D(boundingRect().width() / 2, boundingRect().height() / 2, 0)); QList<QGraphicsTransform *> transforms; transforms << scaleTransform; setTransformations(transforms); setOpacity(0.0); if (isShowTitle) { titleItem = new QGraphicsTextItem(this); setTitle(title); } }
QmlMapControl::QmlMapControl (QQuickItem *parent) : QQuickPaintedItem(parent) { setOpaquePainting(true); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::AllButtons); layermanager = new LayerManager(this, size); screen_middle = QPoint(size.width()/2, size.height()/2); mousepressed = false; scaleVisible = true; crosshairsVisible = true; mymousemode = Panning; mouse_wheel_events = true; connect(ImageManager::instance(), SIGNAL(imageReceived()), this, SLOT(updateRequestNew())); connect(ImageManager::instance(), SIGNAL(loadingFinished()), this, SLOT(loadingFinished())); setWidth(size.width()+1); setHeight(size.height()+1); connect( this, SIGNAL(widthChanged()) , SLOT(sizeChanged()) ); connect( this, SIGNAL(heightChanged()), SLOT(sizeChanged()) ); }
Square::Square(const QPointF & top_left, const unsigned int square, const square_t type, QGraphicsItem * parent) : QGraphicsRectItem(top_left.x(), top_left.y(), SQUARE_SIZE, SQUARE_SIZE, parent), square_(square), type_(type), highlighted_(false) { setAcceptedMouseButtons(0); }
Peg::Peg(QColor c) : color{c} { setToolTip(QString("QColor(%1, %2, %3)\n%4") .arg(color.red()).arg(color.green()).arg(color.blue()) .arg("Click and drag this color onto the board!")); setCursor(Qt::OpenHandCursor); setAcceptedMouseButtons(Qt::LeftButton); }
// class ChatWidget --> ChatWidget::ChatWidget():base_pixmap("image/system/chatface/base.png") { setFlags(ItemIsFocusable); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); base = new QGraphicsRectItem(QRectF(base_pixmap.rect()), this); QPushButton *returnButton, *chatfaceButton, *easytextButton; returnButton=addButton("returnBt",-1); chatfaceButton=addButton("chatfaceBt",24); easytextButton=addButton("easytextBt",48+1); chat_face_board = new MyPixmapItem(QPixmap("image/system/chatface/faceboard.png"),this); chat_face_board->setSize(160,180); chat_face_board->setPos(-160 + 74,-180-1);// 24+24+24+2=74 chat_face_board->setZValue(1); chat_face_board->setVisible(false); chat_face_board->itemName="faceboard"; easy_text_board=new MyPixmapItem(QPixmap("image/system/chatface/easytextboard.png"),this); easy_text_board->setSize(180,222); easy_text_board->setPos(-180 + 74,-222-1); easy_text_board->setZValue(1); easy_text_board->setVisible(false); easy_text_board->itemName="easytextboard"; connect (chat_face_board,SIGNAL(my_pixmap_item_msg(QString)),this,SIGNAL(chat_widget_msg(QString))); connect (easy_text_board,SIGNAL(my_pixmap_item_msg(QString)),this,SIGNAL(chat_widget_msg(QString))); connect(chatfaceButton, SIGNAL(clicked()), this, SLOT(showFaceBoard())); connect(easytextButton, SIGNAL(clicked()), this, SLOT(showEasyTextBoard())); connect(returnButton, SIGNAL(clicked()), this, SLOT(sendText())); }
Applet::Applet(PanelWindow* panelWindow) : m_panelWindow(panelWindow), m_highlightIntensity(0.0), m_interactive(false) { setZValue(-1.0); setAcceptedMouseButtons(Qt::RightButton); setParentItem(m_panelWindow->panelItem()); }
BaseWidget::BaseWidget(QQuickItem *parent) : QQuickPaintedItem(parent) { setWidth(200); setHeight(200); setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MidButton); }
void KMaskImageItem::setMaskMouse( bool bMask ) { Q_D(KMaskImageItem); d->m_bMaskMose = bMask; setAcceptHoverEvents(d->m_bMaskMose); setAcceptedMouseButtons(bMask ? (Qt::LeftButton|Qt::RightButton) : 0); }
void QDeclarative1MouseArea::setAcceptedButtons(Qt::MouseButtons buttons) { if (buttons != acceptedMouseButtons()) { setAcceptedMouseButtons(buttons); emit acceptedButtonsChanged(); } }
DilatedRect::DilatedRect(QGraphicsItem * parent, double da) : QGraphicsItem(parent) { setAcceptedMouseButtons(Qt::NoButton); d = da; setZValue(parent->zValue() + 0.1); }
ArrangeItem::ArrangeItem(QGraphicsItem * related, DesktopWidgetPlugin * plugin, const QString & text, const QRectF & rect, bool editable, QGraphicsItem * parent) : QGraphicsObject(parent), m_related(related), m_plugin(plugin), m_mode(C_C), m_rect(rect), m_text(text), m_editable(editable) { setPos(rect.x(), rect.y()); m_timer = new QTimer(this); if (m_editable) { m_timer->setInterval(500); connect(m_timer, SIGNAL(timeout()), this, SLOT(setCursorByTimer())); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); setFlag(QGraphicsItem::ItemIsMovable); setZValue(2); } else setZValue(1); }
PieSliceItem::PieSliceItem(QGraphicsItem* parent) :QGraphicsObject(parent) { setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::MouseButtonMask); setZValue(ChartPresenter::PieSeriesZValue); }
QmlMitkSliderLevelWindowItem::QmlMitkSliderLevelWindowItem( QQuickPaintedItem * parent ) : QQuickPaintedItem(parent) { m_Manager = mitk::LevelWindowManager::New(); m_Manager->SetDataStorage(QmlMitkSliderLevelWindowItem::storage); itk::ReceptorMemberCommand<QmlMitkSliderLevelWindowItem>::Pointer command = itk::ReceptorMemberCommand<QmlMitkSliderLevelWindowItem>::New(); command->SetCallbackFunction(this, &QmlMitkSliderLevelWindowItem::OnPropertyModified); m_ObserverTag = m_Manager->AddObserver(itk::ModifiedEvent(), command); m_IsObserverTagSet = true; setAcceptedMouseButtons(Qt::AllButtons); setAcceptHoverEvents(true); setAntialiasing(true); m_Resize = false; m_Bottom = false; m_CtrlPressed = false; m_MouseDown = false; m_ScaleVisible = true; this->setEnabled(false); update(); }
/** Constructeur @param editor L'editeur d'element concerne @param parent Le QGraphicsItem parent de cette ellipse @param scene La scene sur laquelle figure cette ellipse */ PartEllipse::PartEllipse(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsEllipseItem(parent, scene), CustomElementGraphicPart(editor) { setFlags(QGraphicsItem::ItemIsSelectable); #if QT_VERSION >= 0x040600 setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); #endif setAcceptedMouseButtons(Qt::LeftButton); }
void QQuickMouseArea::setAcceptedButtons(Qt::MouseButtons buttons) { if (buttons != acceptedMouseButtons()) { setAcceptedMouseButtons(buttons); emit acceptedButtonsChanged(); } }
CursorShapeItem::CursorShapeItem(const StyleType* style) : Item(nullptr, style), useCenter_(false) { setFlags(0); setAcceptedMouseButtons(0); setZValue(LAYER_CURSOR_Z); }
MapWidget::MapWidget(QQuickItem* parent) : QQuickPaintedItem(parent), center(0.0,0.0), angle(0.0), magnification(64), requestNewMap(true) { setOpaquePainting(true); setAcceptedMouseButtons(Qt::LeftButton); DBThread *dbThread=DBThread::GetInstance(); //setFocusPolicy(Qt::StrongFocus); connect(dbThread,SIGNAL(InitialisationFinished(DatabaseLoadedResponse)), this,SLOT(initialisationFinished(DatabaseLoadedResponse))); connect(this,SIGNAL(TriggerMapRenderingSignal()), dbThread,SLOT(TriggerMapRendering())); connect(dbThread,SIGNAL(HandleMapRenderingResult()), this,SLOT(redraw())); connect(dbThread,SIGNAL(Redraw()), this,SLOT(redraw())); }
TiledCanvas::TiledCanvas() : m_context2d(new Context2D(this)), m_canvasSize(-1, -1), m_tileSize(100, 100) { setFlag(QGraphicsItem::ItemHasNoContents, false); setAcceptedMouseButtons(Qt::LeftButton); setCacheMode(QGraphicsItem::DeviceCoordinateCache); }