Exemplo n.º 1
0
//VOXOX CHANGE by Rolando - 2009.07.07 - sends a signal to know that mouse had left the frame
void VoxOxFrame::leaveEvent ( QEvent * event ){
	setCursor(QCursor(Qt::ArrowCursor));//VOXOX CHANGE by Rolando - 2009.07.07 
	mouseLeave();//VOXOX CHANGE by Rolando - 2009.07.07 
	QFrame::leaveEvent(event);	
}
Exemplo n.º 2
0
  const SUCCESS Events::handleEvent(const SDL_Event * const Event)
  {
    switch(Event->type)
    {  //newline brackets implemented since this is a lot of nesting
    case SDL_WINDOWEVENT: ///Some sort of input or output gained or lost
      {
        const Uint8 &winID = Event->window.windowID;
        switch(Event->window.event) 
        {
        case SDL_WINDOWEVENT_ENTER:   ///Mouse message handling gained or lost
          return mouseEnter(winID);
          
        case SDL_WINDOWEVENT_LEAVE:   ///General input message handling gained or lost
          return mouseLeave(winID);

        case SDL_WINDOWEVENT_MINIMIZED:   ///Output to the screen at all gained or lost
          return minimized(winID);
          
        case SDL_WINDOWEVENT_RESTORED:
          return restored(winID);
          
        case SDL_WINDOWEVENT_MAXIMIZED:
          return maximized(winID);
          
        case SDL_WINDOWEVENT_SHOWN:
          return shown(winID);
          
        case SDL_WINDOWEVENT_HIDDEN:
          return hidden(winID);
          
        case SDL_WINDOWEVENT_EXPOSED:
          return exposed(winID);
          
        case SDL_WINDOWEVENT_FOCUS_GAINED:
          return keyboardFocusGain(winID);
          
        case SDL_WINDOWEVENT_FOCUS_LOST:
          return keyboardFocusLost(winID);
          
        case SDL_WINDOWEVENT_SIZE_CHANGED:
            return changeSize(winID);
            
        case SDL_WINDOWEVENT_RESIZED:
          return resized(winID, Dimensions<int>(Event->window.data1, Event->window.data2));
          
        case SDL_WINDOWEVENT_MOVED:
          return moved(winID, Point<int>(Event->window.data1, Event->window.data2));
          
        case SDL_WINDOWEVENT_CLOSE:
          return windowExited(winID);
          
        default:   ///For some reason there is an unknown window event
          return FAILED;
        }
        break;
      }
    case SDL_KEYDOWN:
      {
        if(Event->key.repeat)
        {
          return keyHeld(Event->key.windowID, Event->key.keysym);
        }
        else
        {
          return keyPressed(Event->key.windowID, Event->key.keysym);
        }
        break;
      }
    case SDL_KEYUP:
        return keyReleased(Event->key.windowID, Event->key.keysym);
        
    case SDL_TEXTINPUT:
        return textInput(Event->text.windowID, Event->text.text);
        
    case SDL_TEXTEDITING:
        return textEdit(Event->edit.windowID, Event->edit.text, Event->edit.start, Event->edit.length);
        
    case SDL_MOUSEMOTION:
      return mouseMove(Event->motion.windowID, Event->motion.which,
                       Delta<Point<int> >(Point<int>(Event->motion.xrel, Event->motion.yrel), 
                                          Point<int>(Event->motion.x, Event->motion.y)),
                       bitset<N_MOUSE_BUTTONS>(Event->motion.state));
                       
    case SDL_MOUSEBUTTONDOWN:
      return mouseButtonPressed(Event->button.windowID, Event->button.which, Event->button.button, Event->button.clicks,
                                Point<int>(Event->button.x, Event->button.y));
      
    case SDL_MOUSEBUTTONUP:
        return mouseButtonReleased(Event->button.windowID, Event->button.which, Event->button.button, Event->button.clicks,
                                  Point<int>(Event->button.x, Event->button.y));
     
    case SDL_MOUSEWHEEL:
        return mouseWheel(Event->wheel.windowID, Event->wheel.which, Point<int>(Event->wheel.x, Event->wheel.y));
        
    case SDL_JOYAXISMOTION:
      return joyAxis(Event->jaxis.which, Event->jaxis.axis, Event->jaxis.value);
    
    case SDL_JOYBUTTONDOWN:
      return joyButtonPressed(Event->jbutton.which, Event->jbutton.button);
      
    case SDL_JOYBUTTONUP:
      return joyButtonReleased(Event->jbutton.which, Event->jbutton.button);
      
    case SDL_JOYHATMOTION:
      return joyHatChange(Event->jhat.which, Event->jhat.hat, Event->jhat.value);
        
    case SDL_JOYBALLMOTION:
      return joyBallMove(Event->jball.which, Event->jball.ball, Point<int>(Event->jball.xrel, Event->jball.yrel));
      
    case SDL_DROPFILE:
    {
      const SUCCESS ret = droppedFile(Event->drop.file);
      SDL_free(Event->drop.file);
      return ret;
    }
      
    case SDL_SYSWMEVENT:
      return unhandledSystemEvent(Event->syswm.msg);
     
    case SDL_QUIT:
      return appExited();
        
    case SDL_USEREVENT:
    default:
      {
        return userEvent(Event->user.windowID, Event->user.code, Event->user.data1, Event->user.data2);
      }
    }

    return FAILED;
  }
Exemplo n.º 3
0
void FLineEdit::leaveEvent(QEvent * event) {
	QLineEdit::leaveEvent(event);
	if (m_readOnly) {
		emit mouseLeave();
	}
}
Exemplo n.º 4
0
void DArrowButton::leaveEvent(QEvent *)
{
    emit mouseLeave();
}
Exemplo n.º 5
0
void ViewSelectorButton::hoverLeaveEvent(QGraphicsSceneHoverEvent* e)
{
    Q_UNUSED(e);
    emit(mouseLeave());
}
Exemplo n.º 6
0
void VOIPChatWidgetHolder::addAudioData(const RsPeerId &peer_id, QByteArray* array)
{
    if (!audioCaptureToggleButton->isChecked()) {
        //launch an animation. Don't launch it if already animating
        if (!audioCaptureToggleButton->graphicsEffect() ||
            (audioCaptureToggleButton->graphicsEffect()->inherits("QGraphicsOpacityEffect") &&
                ((QGraphicsOpacityEffect*)audioCaptureToggleButton->graphicsEffect())->opacity() == 1)
            ) {
            QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(audioListenToggleButton);
            audioCaptureToggleButton->setGraphicsEffect(effect);
            QPropertyAnimation *anim = new QPropertyAnimation(effect, "opacity", effect);
            anim->setStartValue(1);
            anim->setKeyValueAt(0.5,0);
            anim->setEndValue(1);
            anim->setDuration(400);
            anim->start();
        }
        
        if (mChatWidget) {
        QString buttonName = QString::fromUtf8(rsPeers->getPeerName(peer_id).c_str());
        if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId
        button_map::iterator it = buttonMapTakeVideo.find(buttonName);
        if (it == buttonMapTakeVideo.end()){
				mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
				                        , tr("%1 inviting you to start a audio conversation. do you want Accept or Decline the invitation?").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM);
				RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Accept Call"));
				button->setToolTip(tr("Activate audio"));
				button->setStyleSheet(QString("border: 1px solid #199909;")
				                      .append("font-size: 12pt;  color: white;")
				                      .append("min-width: 128px; min-height: 24px;")
				                      .append("border-radius: 6px;")
				                      .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, "
                                        "stop: 0 #22c70d, stop: 1 #116a06);")

				                      );
                                       

				button->updateImage();

				connect(button,SIGNAL(clicked()),this,SLOT(startAudioCapture()));
				connect(button,SIGNAL(mouseEnter()),this,SLOT(botMouseEnter()));
				connect(button,SIGNAL(mouseLeave()),this,SLOT(botMouseLeave()));

				buttonMapTakeVideo.insert(buttonName, button);
        }
        }

        audioCaptureToggleButton->setToolTip(tr("Answer"));

        //TODO make a sound for the incoming call
//        soundManager->play(VOIP_SOUND_INCOMING_CALL);
        if (mVOIPNotify) mVOIPNotify->notifyReceivedVoipAudioCall(peer_id);

        return;
    }

    if (!outputAudioDevice) {
        outputAudioDevice = AudioDeviceHelper::getDefaultOutputDevice();
    }

    if (!outputAudioProcessor) {
        //start output audio device
        outputAudioProcessor = new QtSpeex::SpeexOutputProcessor();
        if (inputAudioProcessor) {
            connect(outputAudioProcessor, SIGNAL(playingFrame(QByteArray*)), inputAudioProcessor, SLOT(addEchoFrame(QByteArray*)));
        }
        outputAudioProcessor->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
        outputAudioDevice->start(outputAudioProcessor);
    }

    if (outputAudioDevice && outputAudioDevice->error() != QAudio::NoError) {
        std::cerr << "Restarting output device. Error before reset " << outputAudioDevice->error() << " buffer size : " << outputAudioDevice->bufferSize() << std::endl;
        outputAudioDevice->stop();
        outputAudioDevice->reset();
        if (outputAudioDevice->error() == QAudio::UnderrunError)
            outputAudioDevice->setBufferSize(20);
        outputAudioDevice->start(outputAudioProcessor);
    }
    outputAudioProcessor->putNetworkPacket(QString::fromStdString(peer_id.toStdString()), *array);

    //check the input device for errors
    if (inputAudioDevice && inputAudioDevice->error() != QAudio::NoError) {
        std::cerr << "Restarting input device. Error before reset " << inputAudioDevice->error() << std::endl;
        inputAudioDevice->stop();
        inputAudioDevice->reset();
        inputAudioDevice->start(inputAudioProcessor);
    }
}
Exemplo n.º 7
0
void EventfulVidgetVideo::leaveEvent( QEvent * ) { emit mouseLeave(); }
void LayoutButton::leaveEvent(QEvent *event) {
    emit mouseLeave(m_text);
    Q_UNUSED(event);
//    qDebug() << "leaveEvent;";
     updateStyleSelf();
}
Exemplo n.º 9
0
bool RSButtonOnText::eventFilter(QObject *obj, QEvent *event)
{
    // comment electron:
    // the guard is here, because someone deletes this object in callbacks(slots) called from here
    // the QPointer can detect this
    // but this is bad practice, because it hides the root cause for the problem,
    // which is the deletion of objects in their own signals
    // TODO: better use the Qt function deleteLater
	QPointer<QAbstractButton> guard(this);
	QPoint point;
	if (isEventForThis(obj, event, point)) {
		if (event->type() == QEvent::ToolTip)	{
			QToolTip::showText(point, this->toolTip());
			event->ignore();//For other don't clear this one
			return true;
		}
		if (event->type() == QEvent::MouseButtonPress)	{
			QMouseEvent* mouseEvent = new QMouseEvent(QEvent::MouseButtonPress
			                                          ,QPoint(1,1),Qt::LeftButton,Qt::LeftButton,0);
			QPushButton::mousePressEvent(mouseEvent);
			delete mouseEvent;
            if (guard) _pressed = true;
			//if (guard) emit pressed();
			if (guard) updateImage();
		}
		if (event->type() == QEvent::MouseButtonRelease)	{
			QMouseEvent* mouseEvent = new QMouseEvent(QEvent::MouseButtonPress
			                                          ,QPoint(1,1),Qt::LeftButton,Qt::LeftButton,0);
			QPushButton::mouseReleaseEvent(mouseEvent);
			delete mouseEvent;
            if (guard) _pressed = false;
			//if (guard) emit released();
			//if (guard) emit clicked();
			//if (guard) if (isCheckable()) emit clicked(QPushButton::isChecked());
			//if (guard) if (isCheckable()) emit toggled(QPushButton::isChecked());
			if (guard) updateImage();
		}
		if (event->type() == QEvent::MouseMove)	{
			if (!_mouseOver){
				//QMouseEvent* mouseEvent = new QMouseEvent(QEvent::MouseButtonPress
				//                                          ,QPoint(1,1),Qt::LeftButton,Qt::LeftButton,0);
				//QPushButton::enterEvent(mouseEvent);//Do nothing
				//delete mouseEvent;
				//QPushButton::setDown(true);
				if (guard) emit mouseEnter();
			}
            if (guard) _mouseOver = true;
			if (guard) updateImage();
		}
	} else {
		if (event->type() == QEvent::MouseMove)	{
			if (_mouseOver) {
				//QMouseEvent* mouseEvent = new QMouseEvent(QEvent::MouseButtonPress
				//                                          ,QPoint(1,1),Qt::LeftButton,Qt::LeftButton,0);
				//QPushButton::leaveEvent(mouseEvent);//Do nothing
				//delete mouseEvent;
				//QPushButton::setDown(false);
				_mouseOver = false;
				if (guard) emit mouseLeave();
				if (guard) updateImage();
			}
			if (_pressed){
				QMouseEvent* mouseEvent = new QMouseEvent(QEvent::MouseButtonPress
				                                          ,QPoint(1,1),Qt::LeftButton,Qt::LeftButton,0);
				QPushButton::mouseReleaseEvent(mouseEvent);
				delete mouseEvent;
				//if (guard) emit released();
				if (guard) updateImage();
			}
		}
	}

	if (!guard)
		std::cerr << "BIG FAT WARNING from RSButtonOnText::eventFilter(): i was deleted in my own event handler. This is bad practice. Please make a patch and use deleteLater to delay deletion." << std::endl ;

	// pass the event on to the parent class
	return QWidget::eventFilter(obj, event);
}
Exemplo n.º 10
0
void MusicItemWidget::leaveEvent(QEvent *event)
{
    emit mouseLeave(m_item);
    QWidget::leaveEvent(event);
}
Exemplo n.º 11
0
//---------------------------------------------------------
void Terrain::leaveEvent (QEvent * e) {
//printf("leave\n");
	emit mouseLeave (e);
    setCursor(enterCursor);
}
Exemplo n.º 12
0
HtmlInfoView::HtmlInfoView(QWidget * parent) : QScrollArea(parent) 
{
    this->setWidgetResizable(true);
	this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    QFrame * mainFrame = new QFrame(this);
	mainFrame->setObjectName("infoViewMainFrame");

	m_lastTitleItemBase = NULL;
	m_lastTagsModelPart = NULL;
	m_lastConnectorItem = NULL;
	m_lastIconItemBase = NULL;
	m_lastPropsModelPart = NULL;
	m_lastPropsItemBase = NULL;

	m_partTitle = NULL;
	m_partUrl = NULL;
	m_partVersion = NULL;
	m_lockCheckbox = NULL;
	m_stickyCheckbox = NULL;
	m_connDescr = NULL;
	m_tagsTextLabel = NULL;
	m_lastSwappingEnabled = false;
	m_lastItemBase = NULL;
	m_infoGraphicsView = NULL;
	m_setContentTimer.setSingleShot(true);
	m_setContentTimer.setInterval(10);
	connect(&m_setContentTimer, SIGNAL(timeout()), this, SLOT(setContent()));
	QVBoxLayout *vlo = new QVBoxLayout(mainFrame);
	vlo->setSpacing(0);
	vlo->setContentsMargins(0, 0, 0, 0);
	vlo->setSizeConstraint( QLayout::SetMinAndMaxSize );

        /* Part Title */

	m_titleEdit = new FLineEdit(mainFrame);
	m_titleEdit->setObjectName("instanceTitleEditor");
	m_titleEdit->setToolTip(tr("Change the part label here"));
	m_titleEdit->setAlignment(Qt::AlignLeft);

	connect(m_titleEdit, SIGNAL(editingFinished()), this, SLOT(setInstanceTitle()));
	connect(m_titleEdit, SIGNAL(mouseEnter()), this, SLOT(instanceTitleEnter()));
	connect(m_titleEdit, SIGNAL(mouseLeave()), this, SLOT(instanceTitleLeave()));
	connect(m_titleEdit, SIGNAL(editable(bool)), this, SLOT(instanceTitleEditable(bool)));

	setInstanceTitleColors(m_titleEdit, QColor(0xaf, 0xaf, 0xb4), QColor(0x00, 0x00, 0x00)); //b3b3b3, 575757
	m_titleEdit->setAutoFillBackground(true);
	vlo->addWidget(m_titleEdit);

        /* Part Icons */

	if (NoIcon == NULL) {
		NoIcon = new QPixmap(":/resources/images/icons/noicon.png");
	}

	QFrame * iconFrame = new QFrame(mainFrame);
	iconFrame->setObjectName("iconFrame");

	QHBoxLayout * hboxLayout = new QHBoxLayout();
	hboxLayout->setContentsMargins(0, 0, 0, 0);
	hboxLayout->addSpacing(IconSpace);
	m_icon1 = addLabel(hboxLayout, NoIcon);
	m_icon1->setToolTip(tr("Part breadboard view image"));
	m_icon2 = addLabel(hboxLayout, NoIcon);
	m_icon2->setToolTip(tr("Part schematic view image"));
	m_icon3 = addLabel(hboxLayout, NoIcon);
	m_icon3->setToolTip(tr("Part pcb view image"));

	QVBoxLayout * versionLayout = new QVBoxLayout();

	QHBoxLayout * subVersionLayout = new QHBoxLayout();
	m_partVersion = new QLabel();
	m_partVersion->setObjectName("infoViewPartVersion");
	m_partVersion->setToolTip(tr("Part version number"));
    m_partVersion->setOpenExternalLinks(false);
    m_partVersion->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    connect(m_partVersion, SIGNAL(linkActivated(const QString &)), this, SLOT(clickObsolete(const QString &)));
	subVersionLayout->addWidget(m_partVersion, 0, Qt::AlignLeft);
	subVersionLayout->addStretch(1);
	versionLayout->addLayout(subVersionLayout);

    QHBoxLayout * cbLayout = new QHBoxLayout();
	
	m_lockCheckbox = new QCheckBox(tr("Locked"));
	m_lockCheckbox->setObjectName("infoViewLockCheckbox");
	m_lockCheckbox->setToolTip(tr("Change the locked state of the part in this view. A locked part can't be moved."));
	connect(m_lockCheckbox, SIGNAL(clicked(bool)), this, SLOT(changeLock(bool)));
	cbLayout->addWidget(m_lockCheckbox);

	m_stickyCheckbox = new QCheckBox(tr("Sticky"));
	m_stickyCheckbox->setObjectName("infoViewLockCheckbox");
	m_stickyCheckbox->setToolTip(tr("Change the \"sticky\" state of the part in this view. When a sticky part is moved, objects on top of it also move."));
	connect(m_stickyCheckbox, SIGNAL(clicked(bool)), this, SLOT(changeSticky(bool)));
	cbLayout->addWidget(m_stickyCheckbox);

    versionLayout->addLayout(cbLayout);

	hboxLayout->addLayout(versionLayout);
	
	hboxLayout->addSpacerItem(new QSpacerItem(IconSpace, 1, QSizePolicy::Expanding));
	iconFrame->setLayout(hboxLayout);
	vlo->addWidget(iconFrame);

	m_partUrl = new TagLabel(this);
	m_partUrl->setWordWrap(false);
	m_partUrl->setObjectName("infoViewPartUrl");
	m_partUrl->setOpenExternalLinks(true);
	vlo->addWidget(m_partUrl);

	m_partTitle = new TagLabel(this);
	m_partTitle->setWordWrap(true);
	m_partTitle->setObjectName("infoViewPartTitle");
	m_partTitle->setOpenExternalLinks(true);
	vlo->addWidget(m_partTitle);

	m_proplabel = new QLabel(tr("Properties"), NULL);
	m_proplabel->setObjectName("expandableViewLabel");
	vlo->addWidget(m_proplabel);

	m_propFrame = new QFrame(this);
	m_propFrame->setObjectName("infoViewPropertyFrame");
	m_propLayout = new QGridLayout(m_propFrame);
	m_propLayout->setSpacing(0);
	m_propLayout->setContentsMargins(0, 0, 0, 0);
	m_propFrame->setLayout(m_propLayout);
	vlo->addWidget(m_propFrame);

	m_taglabel = new QLabel(tr("Tags"), NULL);
	m_taglabel->setObjectName("expandableViewLabel");
	vlo->addWidget(m_taglabel);

	m_tagsTextLabel = new TagLabel(this);
	m_tagsTextLabel->setWordWrap(true);
	m_tagsTextLabel->setObjectName("tagsValue");
	vlo->addWidget(m_tagsTextLabel);

	m_connLabel = new QLabel(tr("Connections"), NULL);
	m_connLabel->setObjectName("expandableViewLabel");
	vlo->addWidget(m_connLabel);

	m_connFrame = new QFrame(this);
	m_connFrame->setObjectName("connectionsFrame");

    QGridLayout * connLayout = new QGridLayout(m_connFrame);
	connLayout->setSpacing(0);
	connLayout->setContentsMargins(0, 0, 0, 0);
	m_connFrame->setLayout(connLayout);

	QLabel * descrLabel = new QLabel(tr("conn."), this);
	descrLabel->setObjectName("connectionsLabel");
	m_connDescr = new QLabel(this);
	m_connDescr->setObjectName("connectionsValue");
    connLayout->addWidget(descrLabel, 0, 0);
    connLayout->addWidget(m_connDescr, 0, 1);

	QLabel * nameLabel = new QLabel(tr("name"), this);
	nameLabel->setObjectName("connectionsLabel");
	m_connName = new QLabel(this);
	m_connName->setObjectName("connectionsValue");
    connLayout->addWidget(nameLabel, 1, 0);
    connLayout->addWidget(m_connName, 1, 1);

	QLabel * typeLabel = new QLabel(tr("type"), this);
	typeLabel->setObjectName("connectionsLabel");
	m_connType = new QLabel(this);
	m_connType->setObjectName("connectionsValue");
	connLayout->addWidget(typeLabel, 2, 0);
    connLayout->addWidget(m_connType, 2, 1);

	vlo->addWidget(m_connFrame);

	vlo->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding));

	mainFrame->setLayout(vlo);

	this->setWidget(mainFrame);

	m_currentItem = NULL;
	m_currentSwappingEnabled = false;

}
Exemplo n.º 13
0
void ChannelWidget::leaveEvent(QEvent *) {
    emit mouseLeave();
}
Exemplo n.º 14
0
void MediaInfoInteractivePage::leaveEvent(QEvent* )
{
    //QWidget::enterEvent();
    emit mouseLeave();
}
Exemplo n.º 15
0
void form::handleMouseMove(SDL_Event &e){
		if(within(left,top,width,height,e.motion.x,e.motion.y)){
			this->mouseEnter(&e);
		}else{
			this->mouseLeave(&e);
			//return;
		}
		if(_DEGUGG) cout<<name<<"\t"<<"Before: "<<e.motion.x<<","<<e.motion.y<<" After: ";
		//MOTION. trickkky.--------------------------------------------
		int state = SDL_GetMouseState(NULL,NULL);
		//this part handles the case of pointers dragging into the window. In which, ignore.
		if((state&SDL_BUTTON_LMASK)&&leftBindedControl==-2) return;
		if((state&SDL_BUTTON_MMASK)&&middleBindedControl==-2) return;
		if((state&SDL_BUTTON_RMASK)&&rightBindedControl==-2) return;

		//this part handles the case of pointers leaving, releasing and then entering.
		SDL_Event sim;
		sim.type = SDL_MOUSEBUTTONUP;
		sim.button.state = SDL_RELEASED;
		sim.button.type = SDL_MOUSEBUTTONUP;
		sim.button.x = e.motion.x;
		sim.button.y = e.motion.y;
		sim.button.which = 1;

		if(!(state&SDL_BUTTON_LMASK)&&leftBindedControl!=-2){
			sim.button.button = SDL_BUTTON_LEFT;
			SDL_PushEvent(&sim); SDL_PushEvent(&e);
			return;
		}
		if(!(state&SDL_BUTTON_MMASK)&&middleBindedControl!=-2){
			sim.button.button = SDL_BUTTON_MIDDLE;
			SDL_PushEvent(&sim); SDL_PushEvent(&e);
			return;
		}
		if(!(state&SDL_BUTTON_RMASK)&&rightBindedControl!=-2){
			sim.button.button = SDL_BUTTON_RIGHT;
			SDL_PushEvent(&sim); SDL_PushEvent(&e);
			return;
		}
		//by this point, if there is a button down, there is one corresponding binded control. If there is a button down, send to the corresponding control only
		e.motion.x -= left;
		e.motion.y -= top;
		if(_DEGUGG) cout<<e.motion.x<<","<<e.motion.y<<"\n";
		if(state){
			int control = max(leftBindedControl,max(rightBindedControl,middleBindedControl));
			if(control==-1){
				this->callEvent(&e,e.type);
			}else{
				if(within(children[control]->left,children[control]->top,
					children[control]->width,children[control]->height,
					e.motion.x,e.motion.y)){
						children[control]->mouseEnter(&e);
						children[control]->handleEvent(e);
						hoveredControl = control;
				}else{
					children[control]->mouseLeave(&e);
					children[control]->handleEvent(e);
					hoveredControl = -2;
				}
			}
				
		}else{
			//find which control this belongs to.
			int control = -2;
			if(within(left,top,width,height,e.motion.x,e.motion.y)) control = -1;
			for(int i = 0; i < children.size(); i++){
				if(within(children[i]->left,children[i]->top,children[i]->width,
					children[i]->height,e.motion.x,e.motion.y)){
					control = i;
				}
			}
			if(control!=hoveredControl){
				if(hoveredControl==-1) mouseLeave(&e);
				if(hoveredControl>=0) children[hoveredControl] -> mouseLeave(&e);	
			}
			if(control==-1){
				mouseEnter(&e);
				callEvent(&e,e.type);
			}
			if(control>=0){
				children[control]->mouseEnter(&e);
				children[control]->handleEvent(e);
			}
			hoveredControl = control;
		}

}
Exemplo n.º 16
0
void ImageView::hoverLeaveEvent(QGraphicsSceneHoverEvent *a_event_ptr) {
  Q_EMIT mouseLeave();
  QGraphicsObject::hoverLeaveEvent(a_event_ptr);
}
Exemplo n.º 17
0
void DockAppIcon::leaveEvent(QEvent *)
{
    if (m_modeData->getDockMode() == Dock::FashionMode)
        emit mouseLeave();
}
Exemplo n.º 18
0
void DockAppItem::onMouseLeave()
{
    m_appBG->setIsHovered(false);
    hidePreview(false);
    emit mouseLeave();
}
Exemplo n.º 19
0
MainWidget::MainWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainWidget),
    _isChannelWidgetShowing(false),
    _isAnimStarted(false),
    _isLyricWidgetShowing(false),
    topBorder(new QLabel(this)),
    bottomBorder(new QLabel(this)),
    systemTrayIcon(nullptr)
{
    ui->setupUi(this);  
    ui->lyricWidget->lower();
    ui->channelWidget->raise();
    ui->controlWidget->raise();

    // Configure borders
    topBorder->setMaximumSize(this->width(), 5);
    topBorder->setMinimumSize(this->width(), 5);
    topBorder->setStyleSheet("background: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0 rgba(0,0,0,80), stop: 1 rgba(0,0,0,0));");
    topBorder->raise();
    topBorder->move(0, -topBorder->height());
    bottomBorder->setMaximumSize(this->width(), 10);
    bottomBorder->setMinimumSize(this->width(), 10);
    bottomBorder->setStyleSheet("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(0,0,0,120), stop: 1 rgba(0,0,0,0));");
    bottomBorder->raise();
    bottomBorder->move(0, ui->controlWidget->height());

    ui->pauseWidget->raise();
    ui->pauseWidget->setVisible(false);

    connect(ui->pauseWidget, SIGNAL(clicked()), ui->controlWidget, SLOT(play()));
    exitShortcut = new QShortcut(QKeySequence("Ctrl+Q"), this);
    connect(exitShortcut, SIGNAL(activated()), qApp, SLOT(quit()));
    pauseShortcut = new QShortcut(QKeySequence("Space"), this);
    connect(pauseShortcut, &QShortcut::activated, [this] () {
        bool visiable = ui->pauseWidget->isVisible();
        if (visiable)
            ui->controlWidget->play();
        else
            ui->controlWidget->pause();
        ui->pauseWidget->setVisible(!visiable);
    });
    nextShortcut = new QShortcut(QKeySequence("S"), this);
    connect(nextShortcut, SIGNAL(activated()), ui->controlWidget, SLOT(on_nextButton_clicked()));
    deleteShortcut = new QShortcut(QKeySequence("D"), this);
    connect(deleteShortcut, SIGNAL(activated()), ui->controlWidget, SLOT(on_trashButton_clicked()));
    likeShortcut = new QShortcut(QKeySequence("F"), this);
    connect(likeShortcut, SIGNAL(activated()), ui->controlWidget, SLOT(on_likeButton_clicked()));
    hideShortcut = new QShortcut(QKeySequence("Ctrl+W"), this);
    connect(hideShortcut, SIGNAL(activated()), this, SLOT(hide()));

    connect(ui->channelWidget, SIGNAL(mouseLeave()), this, SLOT(animHideChannelWidget()));

    connect(ui->controlWidget, SIGNAL(openChannelPanel()), this, SLOT(animShowChannelWidget()));
    connect(ui->controlWidget, SIGNAL(closeChannelPanel()), this, SLOT(animHideChannelWidget()));

    connect(ui->controlWidget, SIGNAL(openLyricPanel()), this, SLOT(animShowLyricWidget()));
    connect(ui->controlWidget, SIGNAL(closeLyricPanel()), this, SLOT(animHideLyricWidget()));

    // FIXME: Ubuntu doesn't support QSystemTrayIcon
    // Following code will cause confusing behaviour
#ifdef WITH_SYSTEM_TRAY_ICON
    if (QSystemTrayIcon::isSystemTrayAvailable()) {
        systemTrayIcon = new QSystemTrayIcon(QIcon("://icon.png"), this);
        connect(systemTrayIcon, &QSystemTrayIcon::activated, [&] () {
            if (this->isHidden())
                this->show();
        });
        QMenu *trayMenu = new QMenu(this);
        auto _openAction = trayMenu->addAction("打开主界面");
        trayMenu->addSeparator();
        auto _closeAction = trayMenu->addAction("退出");
        connect(trayMenu, &QMenu::triggered, [this, _openAction, _closeAction] (QAction *action) {
            if (action == _openAction)
                this->show();
            else if (action == _closeAction)
                qApp->quit();
        });
        systemTrayIcon->setContextMenu(trayMenu);
        systemTrayIcon->show();
    }
#endif

}
Exemplo n.º 20
0
void PopupFrame::leaveEvent(QEvent *)
{
    emit mouseLeave();
}