Switcher::Switcher(MWidget *parent, SwitcherModel *model) : MWidgetController(model, parent) { // Get the X11 Atoms for closing and activating a window and for other switcher functionalities Display *display = QX11Info::display(); closeWindowAtom = X11Wrapper::XInternAtom(display, "_NET_CLOSE_WINDOW", False); activeWindowAtom = X11Wrapper::XInternAtom(display, "_NET_ACTIVE_WINDOW", False); clientListAtom = X11Wrapper::XInternAtom(display, "_NET_CLIENT_LIST", False); netWindowNameAtom = X11Wrapper::XInternAtom(display, "_NET_WM_NAME", False); windowNameAtom = X11Wrapper::XInternAtom(display, "WM_NAME", False); // Put the atoms for window types that should be excluded from the switcher into a list excludeAtoms.insert(WindowInfo::DesktopAtom); excludeAtoms.insert(WindowInfo::MenuAtom); excludeAtoms.insert(WindowInfo::DockAtom); excludeAtoms.insert(WindowInfo::DialogAtom); excludeAtoms.insert(WindowInfo::NotificationAtom); excludeAtoms.insert(WindowInfo::SkipTaskbarAtom); excludeAtoms.insert(WindowInfo::InputWindowAtom); // Configure the update buttons timer updateButtonsTimer.setSingleShot(true); updateButtonsTimer.setInterval(UPDATE_DELAY_MS); connect(&updateButtonsTimer, SIGNAL(timeout()), this, SLOT(updateButtons())); connect(HomeWindowMonitor::instance(), SIGNAL(windowStackingOrderChanged(QList<WindowInfo>)), this, SLOT(handleWindowInfoList(QList<WindowInfo>))); // This stuff is necessary to receive touch events setAcceptTouchEvents(true); grabGesture(Qt::PinchGesture); }
MImWordTracker::MImWordTracker(MSceneWindow *parentWindow) : MStylableWidget(), containerWidget(new QGraphicsWidget()), mIdealWidth(0), candidateItem(new MImCorrectionCandidateItem("", this)) { RegionTracker::instance().addRegion(*containerWidget); containerWidget->setObjectName("WordTrackerContainer"); containerWidget->setParentItem(parentWindow); this->setParentItem(containerWidget); // By default multi-touch is disabled setAcceptTouchEvents(MGConfItem(MultitouchSetting).value().toBool()); setObjectName(WordTrackerObjectName); mainLayout = new QGraphicsLinearLayout(Qt::Vertical); mainLayout->setSpacing(0); mainLayout->setContentsMargins(0, 0, 0, 0); setLayout(mainLayout); mainLayout->addItem(candidateItem); mainLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); connect(candidateItem, SIGNAL(clicked()), this, SLOT(select())); connect(candidateItem, SIGNAL(longTapped()), this, SLOT(longTap())); connect(MTheme::instance(), SIGNAL(themeChangeCompleted()), this, SLOT(onThemeChangeCompleted()), Qt::UniqueConnection); setupTimeLine(); containerWidget->hide(); }
void SwipeArea::setFilterTouchEvent(bool arg) { if (d->filterTouchEvent != arg) { d->filterTouchEvent = arg; setAcceptTouchEvents(arg); emit filterTouchEventChanged(arg); } }
QNEConnection::QNEConnection(QGraphicsItem *parent) : QGraphicsPathItem(parent) { setPen(QPen(QColor(QRgb(0x2c3e50)), 3)); setBrush(Qt::NoBrush); setZValue(-1); setAcceptHoverEvents(true); setAcceptTouchEvents(true); }
DefaultTableComponent::DefaultTableComponent(const QRectF &a_rect, LayoutType type, QGraphicsItem *parent) : UIKit::TableViewItem(a_rect, parent), m_priv_ptr(new PrivateTableComponent) { m_priv_ptr->m_current_geometry = a_rect; m_priv_ptr->m_current_item_selection = false; m_priv_ptr->m_current_item_visibility = true; m_priv_ptr->m_current_layout_type = type; m_priv_ptr->m_layout_base = new QGraphicsWidget(this); m_priv_ptr->m_layout_base->setGeometry(a_rect); m_priv_ptr->m_linear_layout = new QGraphicsLinearLayout(m_priv_ptr->m_layout_base); m_priv_ptr->m_image_view_widget = new UIKit::ImageView(m_priv_ptr->m_layout_base); m_priv_ptr->m_image_view_widget->set_pixmap( UIKit::Theme::instance()->drawable("setup-wizard.png", "hdpi")); m_priv_ptr->m_label_widget = new UIKit::Label(m_priv_ptr->m_layout_base); m_priv_ptr->m_option_button = new UIKit::Button(m_priv_ptr->m_layout_base); connect(m_priv_ptr->m_image_view_widget, SIGNAL(clicked()), this, SLOT(onClicked())); connect(m_priv_ptr->m_label_widget, SIGNAL(clicked()), this, SLOT(onClicked())); connect(m_priv_ptr->m_option_button, SIGNAL(clicked()), this, SLOT(onClicked())); if (type == kGridLayout) { m_priv_ptr->m_linear_layout->setOrientation(Qt::Vertical); m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_image_view_widget); m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_label_widget); m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_option_button); m_priv_ptr->m_label_widget->set_size(QSize(64, a_rect.height())); m_priv_ptr->m_option_button->hide(); } else { m_priv_ptr->m_label_widget->set_size(QSize(150, a_rect.height())); // d->m_image_view_widget->setSize(QSizeF(48.0, 48.0)); m_priv_ptr->m_linear_layout->setOrientation(Qt::Horizontal); m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_image_view_widget); m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_label_widget); m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_option_button); } setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); setFlag(QGraphicsItem::ItemIsMovable, false); setFlag(QGraphicsItem::ItemIsFocusable, true); setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); setFiltersChildEvents(false); setAcceptTouchEvents(true); setAcceptHoverEvents(true); }
SwipeArea::SwipeArea(QDeclarativeItem *parent) :QDeclarativeItem(parent) { setAcceptTouchEvents(false); setAcceptedMouseButtons(Qt::LeftButton); d = new PrivateData; d->filterTouchEvent = false; d->filterMouseEvent = true; }
MozQWidget::MozQWidget(nsWindow* aReceiver, QGraphicsItem* aParent) : mReceiver(aReceiver) { setParentItem(aParent); #if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)) setFlag(QGraphicsItem::ItemAcceptsInputMethod); setAcceptTouchEvents(true); #endif setAcceptHoverEvents(true); }
PixButton::PixButton(const QRectF& buttonGeometry) : ThingPaintable(buttonGeometry) , m_trackingTouch(false) , m_touchCount(0) , m_labelVerticalAdjust(0) { setAcceptTouchEvents(true); grabGesture(Qt::TapGesture); }
MyQGraphicsObject::MyQGraphicsObject(QGraphicsItem* parent) : QGraphicsObject(parent) , brush_(Qt::blue) { grabGesture(Qt::PinchGesture); grabGesture(Qt::PanGesture); grabGesture(Qt::SwipeGesture); grabGesture(Qt::TapAndHoldGesture); grabGesture(Qt::TapGesture); setAcceptTouchEvents(true); }
CellItem::CellItem(const QRectF &rect, QGraphicsItem *parent) : PlexyDesk::TableViewItem(rect, parent), d(new PrivateCellItem) { d->mRect = rect; setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); setFlag(QGraphicsItem::ItemIsMovable, false); setFlag(QGraphicsItem::ItemIsFocusable, true); setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); setAcceptTouchEvents(true); setAcceptHoverEvents(true); setGraphicsItem(this); }
MozQWidget::MozQWidget(nsWindow* aReceiver, QGraphicsItem* aParent) : QGraphicsWidget(aParent), mReceiver(aReceiver) { #if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)) setFlag(QGraphicsItem::ItemAcceptsInputMethod); setAcceptTouchEvents(true); grabGesture(Qt::PinchGesture); #endif }
CardHostWindow::CardHostWindow(WindowType::Type type, HostWindowData* data, IpcClientHost* clientHost) : CardWindow(type, data, clientHost) , m_paused(false) , m_pausedDueToDisplayOff(false) , m_penDownInPlayButton(false) , m_penInPlayButton(false) , m_inRotateAnim(false) , m_rotateAngleStart(0) , m_rotateAngleTarget(0) , m_rotateScaleStart(1.0f) , m_rotateScaleTarget(1.0f) , m_rotateTimerStart(0) , m_rotateAnimTimer(HostBase::instance()->masterTimer(), this, &CardHostWindow::rotateTimerTicked) { static QPixmap playButtonPixmap; static QPixmap scrimPixmap; m_prepareAddedToWm = true; // host windows don't get prepared m_touchEventsEnabled = true; setAcceptTouchEvents(true); setAcceptHoverEvents(true); int animationStrength = AS(cardTransitionCurve); m_rotateEquation = AS_EASEOUT(animationStrength); // FIXME: This should be an API m_winProps.setSuppressGestures(true); if (G_UNLIKELY(s_playButtonPixmap == 0)) { std::string filePath = Settings::LunaSettings()->lunaSystemResourcesPath + "/fullscreen-play-button.png"; playButtonPixmap = QPixmap(filePath.c_str()); s_playButtonPixmap = &playButtonPixmap; if (s_playButtonPixmap->isNull()) { g_critical("Failed to load image file: %s", filePath.c_str()); } } if (G_UNLIKELY(s_scrimPixmap == 0)) { std::string filePath = Settings::LunaSettings()->lunaSystemResourcesPath + "/scrim.png"; scrimPixmap = QPixmap(filePath.c_str()); s_scrimPixmap = &scrimPixmap; if (s_scrimPixmap->isNull()) { g_critical("Failed to load image file: %s", filePath.c_str()); } } //Also call onSetAppFixedOrientation() to initialize the rotation locking //It doesn't matter what the arguments are since we don't really use them. onSetAppFixedOrientation(Event::Orientation_Up, false); setVisibleDimensions(data->width(), data->height()); }
DocumentEditor::DocumentEditor() : QDeclarativeItem() , d_ptr(new DocumentEditorPrivate(this)) { setAcceptedMouseButtons( Qt::LeftButton | Qt::RightButton | Qt::MidButton | Qt::MiddleButton ); setFlag(QGraphicsItem::ItemHasNoContents, false); setAcceptHoverEvents(true); setAcceptTouchEvents(true); setEnabled(true); setActive(true); }
NEClassItem::NEClassItem() { setFlags(ItemIsSelectable | ItemIsMovable); setAcceptHoverEvents(true); setCursor(Qt::OpenHandCursor); setAcceptedMouseButtons(Qt::LeftButton); setAcceptDrops(true); setAcceptTouchEvents(true); setTag(classId); itemColor.setNamedColor("#ffff00"); }
Knob::Knob() : QGraphicsEllipseItem(0, 0, 300,300) { setAcceptTouchEvents(true); setBrush(Qt::lightGray); leftItem = new QGraphicsEllipseItem(80, 80, 140, 140, this); leftItem->setPos(0, 0); leftItem->setBrush(Qt::darkGreen); }
Ball::Ball() : QGraphicsEllipseItem(0, 0, BALL_SIZE, BALL_SIZE) { // needed for multitouch events setAcceptTouchEvents(true); // define color this->setBrush(QBrush(Qt::black)); this->setDir(); // set initial speed this->resetSpeed(); }
void StelAppGraphicsWidget::init(QSettings* conf) { stelApp->init(conf); Q_ASSERT(viewportEffect==NULL); setViewportEffect(conf->value("video/viewport_effect", "none").toString()); //previousPaintTime needs to be updated after the time zone is set //in StelLocaleMgr::init(), otherwise this causes an invalid value of //deltaT the first time it is calculated in paintPartial(), which in //turn causes Stellarium to start with a wrong time. previousPaintTime = StelApp::getTotalRunTime(); setAcceptTouchEvents(true); grabGesture(Qt::PinchGesture); }
Knob::Knob() : QGraphicsEllipseItem(-50, -50, 100, 100) { setAcceptTouchEvents(true); setBrush(Qt::lightGray); QGraphicsEllipseItem *leftItem = new QGraphicsEllipseItem(0, 0, 20, 20, this); leftItem->setPos(-40, -10); leftItem->setBrush(Qt::darkGreen); QGraphicsEllipseItem *rightItem = new QGraphicsEllipseItem(0, 0, 20, 20, this); rightItem->setPos(20, -10); rightItem->setBrush(Qt::darkRed); }
ImageCell::ImageCell(const QRectF &rect, ItemLayout type, QGraphicsItem *parent) : UIKit::TableViewItem(rect, parent), d(new PrivateImageCell) { d->mBoundingRect = rect; d->mIsSelected = false; d->mVisibility = true; d->mType = type; setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); setFlag(QGraphicsItem::ItemIsMovable, false); setFlag(QGraphicsItem::ItemIsFocusable, true); setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); setFiltersChildEvents(true); setAcceptTouchEvents(true); setAcceptHoverEvents(true); }
StelSkyItem::StelSkyItem(QGraphicsItem* parent) { Q_UNUSED(parent); setObjectName("SkyItem"); setFlag(QGraphicsItem::ItemHasNoContents, false); setFlag(QGraphicsItem::ItemIsFocusable, true); setAcceptHoverEvents(true); #ifdef Q_OS_WIN setAcceptTouchEvents(true); grabGesture(Qt::PinchGesture); #endif setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton); previousPaintTime = StelApp::getTotalRunTime(); setFocus(); }
QDecTouchArea::QDecTouchArea(QDeclarativeItem *parent) : QDeclarativeItem(parent), m_diffScaleFactor(1.0), m_totalScaleFactor(1.0), m_diffRotationAngle(0.0), m_totalRotationAngle(0.0) { // have to explicitly accept touch events setAcceptTouchEvents(true); // we have 10 possible touch points for(int i=0; i < 10; i++) { QDecTouchPoint * myTouchPt = new QDecTouchPoint; m_listTouchPoints.push_back(myTouchPt); } }
BlackBoardWidget::BlackBoardWidget(Plasma::Applet *parent) : QGraphicsWidget(parent) { m_changed = false; setAcceptTouchEvents(true); m_parentApplet = parent; m_color = QColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); m_oldPoint = QPointF(-1, 0); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(saveImage())); timer->start(600000); QTimer::singleShot(500, this, SLOT(loadImage())); }
QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent) : QQuickItem(parent), _minimumTouchPoints(0), _maximumTouchPoints(INT_MAX), _stealMouse(false), _mouseEnabled(true) { setAcceptedMouseButtons(Qt::LeftButton); setFiltersChildMouseEvents(true); if (qmlVisualTouchDebugging()) { setFlag(QQuickItem::ItemHasContents); } setAcceptTouchEvents(true); #ifdef Q_OS_OSX setAcceptHoverEvents(true); // needed to enable touch events on mouse hover. #endif }
IMEView::IMEView(QGraphicsItem* parent) : QGraphicsObject(parent) , m_imeDataInterface(0) , m_acceptingInput(false) , m_lastTouchBegin(0) { setAcceptTouchEvents(true); grabGesture(Qt::TapGesture); grabGesture(Qt::TapAndHoldGesture); grabGesture(Qt::PinchGesture); grabGesture((Qt::GestureType) SysMgrGestureFlick); grabGesture((Qt::GestureType) SysMgrGestureSingleClick); grabGesture((Qt::GestureType) SysMgrGestureScreenEdgeFlick); setVisible(false); }
PuzzleBoardItem::PuzzleBoardItem(QDeclarativeItem *parent) : QDeclarativeItem(parent) { #if !defined(MEEGO_EDITION_HARMATTAN) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET) setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); #else setAcceptedMouseButtons(Qt::NoButton); #endif setFlag(QGraphicsItem::ItemHasNoContents, false); setAcceptTouchEvents(true); _game = new PuzzleGame(this); _autoRepaintRequests = 0; _autoRepainter = new QTimer(); _autoRepainter->setInterval(20); connect(_autoRepainter, SIGNAL(timeout()), this, SLOT(updateItem())); connect(this, SIGNAL(widthChanged()), this, SLOT(updateGame())); connect(this, SIGNAL(heightChanged()), this, SLOT(updateGame())); connect(_game, SIGNAL(animationStarting()), this, SLOT(enableAutoRepaint())); connect(_game, SIGNAL(animationStopped()), this, SLOT(disableAutoRepaint())); }
KisSketchView::KisSketchView(QDeclarativeItem* parent) : QDeclarativeItem(parent) , d(new Private(this)) { // this is just an interaction overlay, the contents are painted on the sceneview background setFlag(QGraphicsItem::ItemHasNoContents, true); setAcceptTouchEvents(true); setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton); setAcceptHoverEvents(true); grabGesture(Qt::PanGesture); //grabGesture(Qt::PinchGesture); KoZoomMode::setMinimumZoom(0.1); KoZoomMode::setMaximumZoom(16.0); d->timer = new QTimer(this); d->timer->setSingleShot(true); connect(d->timer, SIGNAL(timeout()), this, SLOT(resetDocumentPosition())); d->loadedTimer = new QTimer(this); d->loadedTimer->setSingleShot(true); d->loadedTimer->setInterval(100); connect(d->loadedTimer, SIGNAL(timeout()), SIGNAL(loadingFinished())); d->savedTimer = new QTimer(this); d->savedTimer->setSingleShot(true); d->savedTimer->setInterval(100); connect(d->savedTimer, SIGNAL(timeout()), SIGNAL(savingFinished())); connect(DocumentManager::instance(), SIGNAL(aboutToDeleteDocument()), SLOT(documentAboutToBeDeleted())); connect(DocumentManager::instance(), SIGNAL(documentChanged()), SLOT(documentChanged())); connect(DocumentManager::instance()->progressProxy(), SIGNAL(valueChanged(int)), SIGNAL(progress(int))); connect(DocumentManager::instance(), SIGNAL(documentSaved()), d->savedTimer, SLOT(start())); if (DocumentManager::instance()->document()) documentChanged(); }
StatusBarItemGroup::StatusBarItemGroup(int height, bool hasArrow, bool showSeparator, Alignment align) : StatusBarItem(align) , m_height(height) , m_hasArrow(hasArrow) , m_arrowAnimProg(0.0) , m_active(false) , m_actionable(false) , m_mouseDown(false) , m_activeBkgPix(0) // , m_pressedBkgPix(0) , m_arrowPix(0) , m_separatorPix(0) , m_opacityAnimPtr(0) , m_overlayAnimPtr(0) , m_overlayOpacity(0.0) , m_menuObj(0) { Settings* settings = Settings::LunaSettings(); std::string statusBarImagesPath = settings->lunaSystemResourcesPath + "/statusBar/"; if(m_hasArrow) { std::string filePath = statusBarImagesPath + "menu-arrow.png"; m_arrowPix = new QPixmap(filePath.c_str()); } else { m_arrowAnimProg = 1.0; } if(showSeparator && (align != StatusBarItem::AlignCenter)) { std::string filePath = statusBarImagesPath + "status-bar-separator.png"; m_separatorPix = new QPixmap(filePath.c_str()); } layout(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) setAcceptTouchEvents(true); #endif }
/*! \internal \class QDeclarativeGestureArea \brief The QDeclarativeGestureArea class provides simple gesture handling. */ QDeclarativeGestureArea::QDeclarativeGestureArea(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeGestureAreaPrivate), parent) { setAcceptedMouseButtons(Qt::LeftButton); setAcceptTouchEvents(true); }
AndroidRotationControl::AndroidRotationControl(Shuttle *shuttle) : m_shuttle(shuttle), width(200), height(200) { setFlag(QGraphicsItem::ItemIsFocusable); setAcceptTouchEvents(true); }
DashboardWindowContainer::DashboardWindowContainer(DashboardWindowManager* wm, int width, int height) : GraphicsItemContainer(width, height, GraphicsItemContainer::SolidRectBackground) , m_wm(wm) , m_trackingMouseDirection(false) , m_vertLockedMovement(true) , m_isViewPortAnimationInProgress(false) , m_isWindowBeingDeleted(false) , m_animateVisibleViewportHeight(false) , m_IndexOfDeletedItem(-1) , m_FlickDirection(Ignore) , m_contentsHeight(0) , m_viewportHeight(0) , m_scrollBottom(0) , m_itemsDeleted(0) , m_verticalMouseMoveInProgress(0) , m_menuSeparatorHeight(0) , m_maskDisplayStatus(ShowNoMasks) , m_tabletTopMask(NULL) , m_tabletbottomMask(NULL) , m_tabletBackground(NULL) , m_tabletArrowUp(NULL) , m_tabletArrowDown(NULL) , m_menuSwipeBkg(NULL) , m_menuSwipeHighlight(NULL) , m_itemSeparator(NULL) , m_heightAnimation(this, &DashboardWindowContainer::heightAnimationValueChanged) , m_dashboardManualDrag(false) { setObjectName("DashboardWindowContainer"); m_isMenu = m_wm->isOverlay(); grabGesture(Qt::TapGesture); grabGesture((Qt::GestureType) SysMgrGestureFlick); connect(&m_anim, SIGNAL(finished()), SLOT(slotProcessAnimationComplete())); connect(&m_deleteAnim, SIGNAL(finished()), SLOT(slotDeleteAnimationFinished())); // Initialize the pixmaps for use. initPixmaps(); // Determine where to apply the padding depending on where we are running. if(m_isMenu) { m_FlickDirection = Ignore; m_maskDisplayStatus = ShowNoMasks; m_DashboardTopPadding = 0; m_operation = Invalid; m_BottomMaskHeightCorrection = 7; setAcceptTouchEvents(true); } else { m_BottomMaskHeightCorrection = 10; m_DashboardTopPadding = 10; SystemUiController* suc = SystemUiController::instance(); connect(suc, SIGNAL(signalNegativeSpaceAboutToChange(const QRect&, bool, bool)), SLOT(slotNegativeSpaceAboutToChange(const QRect&, bool, bool))); connect(suc, SIGNAL(signalNegativeSpaceChanged(const QRect&)), SLOT(slotNegativeSpaceChanged(const QRect&))); connect(suc, SIGNAL(signalNegativeSpaceChangeFinished(const QRect&)), SLOT(slotNegativeSpaceChangeFinished(const QRect&))); } if(m_isMenu) { m_heightAnimation.setEasingCurve(AS_CURVE(dashboardSnapCurve)); m_heightAnimation.setDuration(AS(dashboardSnapDuration)); connect(&m_heightAnimation, SIGNAL(finished()), SIGNAL(signalContainerSizeChanged())); } }