int Inventory2::getHoveredItem(Common::Point *point) { int selId = getSelectedItemId(); if (point->y <= 20 && !_isInventoryOut && !_isLocked) slideOut(); if (!selId && point->y >= 55) { if (!_isInventoryOut) return 0; if (!_isLocked) slideIn(); } if (!_isInventoryOut) return 0; for (uint i = 0; i < _inventoryIcons.size(); i++) { InventoryIcon *icn = _inventoryIcons[i]; if (selId || point->x < icn->x1 || point->x > icn->x2 || point->y < _topOffset + icn->y1 || point->y > _topOffset + icn->y2) { icn->isMouseHover = false; } else { icn->isMouseHover = true; return icn->inventoryItemId; } } return 0; }
bool FullScreenBar::eventFilter(QObject* object, QEvent* event) { if (event->type() == QEvent::MouseMove) { QApplication::restoreOverrideCursor(); d->mAutoHideCursorTimer->start(); if (y() == 0) { if (d->shouldHide()) { slideOut(); } } else { QMouseEvent* mouseEvent = static_cast<QMouseEvent *>(event); if (mouseEvent->buttons() == 0 && d->slideInTriggerRect().contains(QCursor::pos())) { slideIn(); } } return false; } if (event->type() == QEvent::MouseButtonRelease) { // This can happen if user released the mouse after using a scrollbar // in the content (the bar does not hide while a button is down) if (y() == 0 && d->shouldHide()) { slideOut(); } return false; } // Filtering message on tooltip text for CJK to remove accelerators. // Quoting ktoolbar.cpp: // """ // CJK languages use more verbose accelerator marker: they add a Latin // letter in parenthesis, and put accelerator on that. Hence, the default // removal of ampersand only may not be enough there, instead the whole // parenthesis construct should be removed. Use KLocale's method to do this. // """ if (event->type() == QEvent::Show || event->type() == QEvent::Paint) { QToolButton* button = qobject_cast<QToolButton*>(object); if (button && !button->actions().isEmpty()) { QAction* action = button->actions().first(); QString toolTip = KGlobal::locale()->removeAcceleratorMarker(action->toolTip()); // Filtering message requested by translators (scripting). button->setToolTip(i18nc("@info:tooltip of custom toolbar button", "%1", toolTip)); } } return false; }
Notification::Notification(QWidget *parent) : QWidget(parent), ui(new Ui::Notification) { ui->setupUi(this); QRect screen = getScreenGeometry(); this->setGeometry(screen.width(), 30, this->width(), this->height()); this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::ToolTip); this->setAttribute(Qt::WA_ShowWithoutActivating); timer = new QTimer(); connect(timer, SIGNAL(timeout()), this, SLOT(slideOut())); notificationId = notificationNumber++; std::cout << "Creating notification " << notificationId << std::endl; //QGraphicsBlurEffect *blur = new QGraphicsBlurEffect(this); //setGraphicsEffect(blur); }
FullScreenBar::FullScreenBar(QWidget* parent) : QFrame(parent) , d(new FullScreenBarPrivate) { d->q = this; d->mAutoHidingEnabled = true; setObjectName(QLatin1String("fullScreenBar")); d->mTimeLine = new QTimeLine(SLIDE_DURATION, this); connect(d->mTimeLine, SIGNAL(valueChanged(qreal)), SLOT(moveBar(qreal))); d->mAutoHideCursorTimer = new QTimer(this); d->mAutoHideCursorTimer->setInterval(AUTO_HIDE_CURSOR_TIMEOUT); d->mAutoHideCursorTimer->setSingleShot(true); connect(d->mAutoHideCursorTimer, SIGNAL(timeout()), SLOT(slotAutoHideCursorTimeout())); d->mInitialHideTimer = new QTimer(this); d->mInitialHideTimer->setInterval(INITIAL_HIDE_TIMEOUT); d->mInitialHideTimer->setSingleShot(true); connect(d->mInitialHideTimer, SIGNAL(timeout()), SLOT(slideOut())); hide(); }
bool doTask(int task) { switch (task) { case GO_FORWARD: return goForward(false); case GO_BACKWARD: return goBackward(); case CALC_NEXT_LINE: return calcNextLine(); case GO_FORWARD_AND_COUNT: return goForwardAndCount(); case TURN_LEFT: return turn90(LEFT); case TURN_RIGHT: return turn90(RIGHT); case TURN_90: // turn this based on the side return true; case TURN_180: return turn180(); case TO_VERTICAL: return craneToVer(); case TO_HORIZONTAL: return craneToHor(); case SLIDE_OUT: return slideOut(); case SLIDE_IN: return slideIn(); case OPEN_GRIPPER: return openGripper(); case CLOSE_GRIPPER: return closeGripper(); case SWITCH_SIDE: return switchSide(); default: return true; } }