当前位置: 首页>>代码示例>>C++>>正文


C++ QMouseEvent::y方法代码示例

本文整理汇总了C++中QMouseEvent::y方法的典型用法代码示例。如果您正苦于以下问题:C++ QMouseEvent::y方法的具体用法?C++ QMouseEvent::y怎么用?C++ QMouseEvent::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QMouseEvent的用法示例。


在下文中一共展示了QMouseEvent::y方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: eventFilter

bool Row::eventFilter(QObject * obj, QEvent * ev) {

    if (obj == sideWidget && ev->type() == QEvent::MouseButtonPress) {
        QMouseEvent * e = static_cast<QMouseEvent *>(ev);
        mousePressed(e->x(), e->y());
    }

    if (obj == this && ev->type() == QEvent::MouseButtonPress) {
        QMouseEvent * e = static_cast<QMouseEvent *>(ev);
        mousePressed(e->x(), e->y());
    }

    if ((obj == this) && (ev->type() == QEvent::Paint)) {
        QPaintEvent * e = static_cast<QPaintEvent *>(ev);
        paint(e->rect());
    }

    if ((obj == this) && (ev->type() == QEvent::Resize)) {
        QResizeEvent * e = static_cast<QResizeEvent *>(ev);
        this->pixPerMs = (double) e->size().width() / (double) (globalStopTime - globalStartTime);
        qDebug() << pixPerMs;
        repaint();
    }


    return true;
}
开发者ID:porcupineG,项目名称:eviewer,代码行数:27,代码来源:row.cpp

示例2: eventFilter

bool PersonalChatDlg::eventFilter(QObject *obj, QEvent *event)
{
    if(obj == ui->btn_min){                          //最小化、最大化、关闭按钮换图
            if(event->type() == QEvent::Enter){
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton-hover.png"));
            }else if(event->type() == QEvent::Leave){
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton.png"));
            }else if(event->type() == QEvent::MouseButtonPress){
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton-hover.png"));
            }else if(event->type() == QEvent::MouseButtonRelease){
                QMouseEvent *me = (QMouseEvent *)event;
                QLabel *lb = (QLabel *)obj;
                if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
                    this->showMinimized();
                }else{
                    ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton.png"));
                }
            } else {
                return QObject::eventFilter(obj, event);
            }
        }
    if(obj == ui->btn_close){                          //最小化、最大化、关闭按钮换图
            if(event->type() == QEvent::Enter){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton-hover.png"));
            }else if(event->type() == QEvent::Leave){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton.png"));
            }else if(event->type() == QEvent::MouseButtonPress){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton-hover.png"));
            }else if(event->type() == QEvent::MouseButtonRelease){
                QMouseEvent *me = (QMouseEvent *)event;
                QLabel *lb = (QLabel *)obj;
                if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
                    this->close();
                    emit closePersonalchatdlg(bareJid);
                }else{
                    ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton.png"));
                }
            } else {
                return QObject::eventFilter(obj, event);
            }
        }

    if(obj==ui->closeButton||obj==ui->sendMessageButton
                            ||obj==ui->sendfileButton
                            ||obj==ui->saveFileButton
                            ||obj==ui->refuseButton)
    {
        if(event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent *me = (QMouseEvent *)event;
            dragPos = me->globalPos() - frameGeometry().topLeft();
        }else if(event->type() == QEvent::MouseButtonRelease)
        {
            setWindowOpacity(1);
        }
    }
    return QObject::eventFilter(obj, event);


}
开发者ID:zhangchao1987,项目名称:Lotus,代码行数:60,代码来源:personalchatdlg_event.cpp

示例3: event

bool VncView::event(QEvent *event)
{
    QMouseEvent *ev = static_cast<QMouseEvent*>(event);
    QKeyEvent *ek = static_cast<QKeyEvent*>(event);
    QWheelEvent *ew = static_cast<QWheelEvent*>(event);
    switch (event->type()) {
    case QEvent::KeyPress:
    case QEvent::KeyRelease:
//         kDebug(5011) << "keyEvent";
        if ( ek!=Q_NULLPTR ) keyEventHandler(ek);
        return true;
    case QEvent::MouseButtonDblClick:
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonRelease:
        emit mouseClickedInto();
        if ( ev!=Q_NULLPTR ) mouseEventHandler(ev);
        return true;
    case QEvent::MouseMove:
//         kDebug(5011) << "mouseEvent";
        if ( 0<=ev->y() && ev->y()<= 3 )
            emit boarderTouched();
        mouseEventHandler(ev);
        return true;
    case QEvent::Wheel:
//         kDebug(5011) << "wheelEvent";
        if ( ew!=Q_NULLPTR ) wheelEventHandler(ew);
        return true;
    default:
        return RemoteView::event(event);
    }
}
开发者ID:F1ash,项目名称:qt-virt-manager,代码行数:31,代码来源:vncview.cpp

示例4: editorEvent

bool ButtonDelegate::editorEvent(QEvent *event, QAbstractItemModel *, const QStyleOptionViewItem &option, const QModelIndex &index)
{
    QRect rect = option.rect;
    QRect rectBu(rect.left() + rect.width()/2 - 15,
                 rect.top() + rect.height()/2 - 5,
                 30, 15);

    if (event->type() == QEvent::MouseMove) {
        QMouseEvent* e =(QMouseEvent*)event;

        if (rectBu.contains(e->x(), e->y())) {

        }
    }

    if (event->type() == QEvent::MouseButtonRelease) {
        QMouseEvent* e =(QMouseEvent*)event;
        if (rectBu.contains(e->x(), e->y())) {
            int row = index.row();
            emit currentRow(row);
            return true;
        }
    }
    return false;
}
开发者ID:JinduYin,项目名称:YQCSongsMaintain,代码行数:25,代码来源:yqcdelegate.cpp

示例5: eventFilter

bool MouseMove::eventFilter(QObject *widget, QEvent *e) {
  if (e->type() == QEvent::MouseButtonPress) {
    x = ((QMouseEvent *) e)->x();
    y = ((QMouseEvent *) e)->y();
    return true;
  }

  if (e->type() == QEvent::MouseMove) {
    QMouseEvent *qMouseEv = (QMouseEvent *) e;
    GlMainWidget *glMainWidget = (GlMainWidget *) widget;

    if (qMouseEv->x() != x)
      glMainWidget->getScene()->translateCamera(qMouseEv->x()-x,0,0);

    if (qMouseEv->y() != y)
      glMainWidget->getScene()->translateCamera(0,y-qMouseEv->y(),0);

    x = qMouseEv->x();
    y = qMouseEv->y();
    glMainWidget->draw(false);
    return true;
  }

  return false;
}
开发者ID:kdbanman,项目名称:browseRDF,代码行数:25,代码来源:MouseInteractors.cpp

示例6: eventFilter

bool KFontDialog::eventFilter(QObject *obj, QEvent *event) {
    if(obj == ui->btn_close) {
            if(event->type() == QEvent::Enter){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn-hover.png"));
            }else if(event->type() == QEvent::Leave){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
            }else if(event->type() == QEvent::MouseButtonPress){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn-hover.png"));
            }else if(event->type() == QEvent::MouseButtonRelease){
                QMouseEvent *me = (QMouseEvent *)event;
                QLabel *lb = (QLabel *)obj;
                if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
                    this->close();
                }else{
                    ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
                }
            } else {
                return QObject::eventFilter(obj, event);
            }
    }
    if(obj == ui->okBtn ||obj == ui->quitBtn)
    {
        if(event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent *me = (QMouseEvent *)event;
            dragPos = me->globalPos() - frameGeometry().topLeft();
        }else if(event->type() == QEvent::MouseButtonRelease)
        {
            setWindowOpacity(1);
        }
    }
    return QObject::eventFilter(obj, event);
}
开发者ID:fanyujiao,项目名称:CMS,代码行数:33,代码来源:kfontdialog.cpp

示例7: OnMouseMotion

void Camera::OnMouseMotion(const QMouseEvent & event)
{

    _theta -= (event.x() - initialCursorPositionX ) *_sensivity;
    _phi -= (event.y() - initialCursorPositionY ) *_sensivity;

    initialCursorPositionX = event.x();
    initialCursorPositionY = event.y();
    VectorsFromAngles();
}
开发者ID:sangohan42,项目名称:Opengl_sample,代码行数:10,代码来源:Camera.cpp

示例8: rect

void
KdmThemer::widgetEvent( QEvent *e )
{
	if (!rootItem)
		return;
	switch (e->type()) {
	case QEvent::MouseMove:
		{
			QMouseEvent *me = static_cast<QMouseEvent *>(e);
			rootItem->mouseEvent( me->x(), me->y() );
		}
		break;
	case QEvent::MouseButtonPress:
		{
			QMouseEvent *me = static_cast<QMouseEvent *>(e);
			rootItem->mouseEvent( me->x(), me->y(), true );
		}
		break;
	case QEvent::MouseButtonRelease:
		{
			QMouseEvent *me = static_cast<QMouseEvent *>(e);
			rootItem->mouseEvent( me->x(), me->y(), false, true );
		}
		break;
	case QEvent::Resize:
		m_geometryOutdated = true;
		widget()->update();
		break;
	case QEvent::Paint:
		if (m_geometryOutdated) {
			debug() << "==== updating geometry ====" << endl;
			QStack<QSize> ps;
			QRect rect( QPoint( 0, 0 ), widget()->size() );
			rootItem->setGeometry( ps, rect, m_geometryInvalid );
			if (debugLevel & DEBUG_THEMING)
				showStructure();
			m_geometryOutdated = m_geometryInvalid = false;
		}
		{
			QRect paintRect = static_cast<QPaintEvent *>(e)->rect();
			//kDebug() << "paint on: " << paintRect;

			QPainter p( widget() );
			rootItem->paint( &p, paintRect );
			rootItem->showWidget();
		}
		break;
	default:
		break;
	}
}
开发者ID:jschwartzenberg,项目名称:kicker,代码行数:51,代码来源:kdmthemer.cpp

示例9: eventFilter

bool ParallelCoordsAxisBoxPlot::eventFilter(QObject *widget, QEvent *e) {

  GlMainWidget *glWidget = dynamic_cast<GlMainWidget *>(widget);

  if(!glWidget)
    return false;

  initOrUpdateBoxPlots();

  if (e->type() == QEvent::MouseMove) {
    QMouseEvent *me = (QMouseEvent *) e;
    int x = glWidget->width() - me->x();
    int y = me->y();
    Coord screenCoords(x, y, 0.0f);
    Coord sceneCoords(glWidget->getScene()->getLayer("Main")->getCamera().viewportTo3DWorld(glWidget->screenToViewport(screenCoords)));
    selectedAxis = parallelView->getAxisUnderPointer(me->x(), me->y());

    if (selectedAxis != NULL && dynamic_cast<QuantitativeParallelAxis *>(selectedAxis)) {
      if (axisBoxPlotMap.find(static_cast<QuantitativeParallelAxis *>(selectedAxis)) != axisBoxPlotMap.end())
        if (parallelView->getLayoutType() == ParallelCoordinatesDrawing::CIRCULAR) {
          rotateVector(sceneCoords, -(selectedAxis->getRotationAngle()), Z_ROT);
        }

      axisBoxPlotMap[static_cast<QuantitativeParallelAxis *>(selectedAxis)]->setHighlightRangeIfAny(sceneCoords);
    }

    parallelView->refresh();
    return true;
  }

  if (e->type() == QEvent::MouseButtonPress) {
    return false;
  }

  if (e->type() == QEvent::MouseButtonRelease) {
    if (selectedAxis != NULL && dynamic_cast<QuantitativeParallelAxis *>(selectedAxis)) {
      Observable::holdObservers();

      if (axisBoxPlotMap.find(static_cast<QuantitativeParallelAxis *>(selectedAxis)) != axisBoxPlotMap.end())
        parallelView->highlightDataInAxisBoxPlotRange(static_cast<QuantitativeParallelAxis *>(selectedAxis));

      Observable::unholdObservers();
      selectedAxis = NULL;
      parallelView->refresh();
      return true;
    }
  }

  return false;
}
开发者ID:mneumann,项目名称:tulip,代码行数:50,代码来源:ParallelCoordsAxisBoxPlot.cpp

示例10: eventFilter

bool Renderer::eventFilter(QObject *object, QEvent *event) {
	if (object == image_label_ && event->type() == QEvent::MouseButtonPress) {
        QMouseEvent *keyEvent = static_cast<QMouseEvent*>(event);
        if (keyEvent->button() == Qt::LeftButton && print_zp_) {
			// Sets the fixed frequency of the zoneplate to the corresponding
			// frequency of the click location
			double dist = sqrt(keyEvent->x()*keyEvent->x() + keyEvent->y()*keyEvent->y());
			dist = zone_plate_.Size() * dist / std::max(Height(), Width());
			freq_spin_->setValue(dist);
            return true;
        } else
            return false;
    }
    return false;
}
开发者ID:White-Link,项目名称:PointSetAnalyser,代码行数:15,代码来源:renderer.cpp

示例11: eventFilter

bool TopBar::eventFilter(QObject *object, QEvent *event) {
    if(object == ui->buttonIcon) {
        if(event->type() == QEvent::MouseButtonPress) {
            canMoveTopbar = true;
            QMouseEvent *e = (QMouseEvent *)event;
            pressedMouseX = e->x();
            pressedMouseY = e->y();
            event->accept();
        } else if (event->type() == QEvent::MouseMove) {
            if(canMoveTopbar) {
                QMouseEvent *e = (QMouseEvent *)event;
                ui->buttonIcon->setCursor(Qt::ClosedHandCursor);
                move(e->globalX() - pressedMouseX, e->globalY() - pressedMouseY);
            }
        } else if(event->type() == QEvent::MouseButtonRelease) {
            canMoveTopbar = false;
            ui->buttonIcon->setCursor(Qt::OpenHandCursor);
            event->accept();
        } else if(event->type() == QEvent::Enter) {
            ui->buttonIcon->setCursor(Qt::OpenHandCursor);
        }
    }

    return QObject::eventFilter(object, event);
}
开发者ID:OpenBangla,项目名称:OpenBangla-Keyboard,代码行数:25,代码来源:TopBar.cpp

示例12: eventMouse

void PWidget::eventMouse(QObject *, QEvent *e)  
{
  PukeMessage pm;
  widgetId wI;

  QMouseEvent *me = Q_MOUSE_EVENT(e);
  
  wI = widgetIden();
  pm.iCommand = - e->type() - 1020; // 1020 offset for events
  pm.iWinId = wI.iWinId;
  pm.iArg = 0;

  // special cArg handling
  pm.iTextSize = 4*sizeof(int);
  int *icArg = new int[4];
  icArg[0] = me->x();
  icArg[1] = me->y();
  icArg[2] = me->button();
  icArg[3] = me->state();
  pm.cArg = (char *) icArg;

  emit outputMessage(wI.fd, &pm);
  
  delete[] icArg;
  
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:26,代码来源:pwidget.cpp

示例13: event

bool GameWindow::event(QEvent *event)
{
    QMouseEvent *mouseEvent;
    float deltaX = this->width() * 0.5f;
    float deltaY = this->height() * 0.5f;
    switch (event->type())
    {
    case QEvent::MouseMove:
        if(cursorCaptured) {
            mouseEvent = static_cast<QMouseEvent*>(event);
            camera->rotate(-(deltaY - mouseEvent->y()) * 0.1f,
                           0,
                           -(deltaX - mouseEvent->x()) * 0.1f
                           );
        }
        return true;
    case QEvent::MouseButtonPress:
        this->setCursor(*cursor);
        cursorCaptured = true;
        return true;
    case QEvent::UpdateRequest:

        renderNow();
        return true;
    default:
        return QWindow::event(event);
    }
}
开发者ID:znoraka,项目名称:tp5,代码行数:28,代码来源:gamewindow.cpp

示例14: x

MouseEvent::MouseEvent(const QMouseEvent& event, const unsigned int deviceID) :
    x(event.x()),
    y(event.y()),
    deviceID(deviceID),
    isLeftButton(event.buttons().testFlag(Qt::LeftButton)),
    isRightButton(event.buttons().testFlag(Qt::RightButton)),
    isMiddleButton(event.buttons().testFlag(Qt::MiddleButton)),
    isShifted(event.modifiers().testFlag(Qt::ShiftModifier)),
    isControl(event.modifiers().testFlag(Qt::ControlModifier)),
    isMeta(event.modifiers().testFlag(Qt::MetaModifier)),
    isAlt(event.modifiers().testFlag(Qt::AltModifier))
{
    // single button that caused the event
    switch (event.button()) {
        case Qt::LeftButton:
            button = "LEFT";
            isLeftButton = true;
            break;
        case Qt::RightButton:
            button = "RIGHT";
            isRightButton = true;
            break;
        case Qt::MiddleButton:
            button = "MIDDLE";
            isMiddleButton = true;
            break;
        default:
            button = "NONE";
            break;
    }
}
开发者ID:DaveDubUK,项目名称:hifi,代码行数:31,代码来源:MouseEvent.cpp

示例15: editorEvent

bool NodeTableDelegate::editorEvent ( QEvent* event, 
                                      QAbstractItemModel* model,
                                      const QStyleOptionViewItem& option,
                                      const QModelIndex& index )
{
    if ( index.column() != 2 )
        return false;

    QMouseEvent *mouseEvent;

    if ( event->type() == QEvent::MouseButtonRelease ) {
        mouseEvent = static_cast<QMouseEvent*>( event );
        
        QRect checkBoxRect1 = getCheckBoxDrawArea( option );
        QRect checkBoxRect2 = getCheckBoxDrawArea( option, false );

        if ( checkBoxRect1.contains( mouseEvent->x(), mouseEvent->y() ) )
        {
            bool xCheckState, yCheckState;
            getCheckStates( xCheckState, yCheckState, index );
          
            Node::Fixation fixType = 
                getFixationByCheckStates( ! xCheckState, yCheckState );
            
            QVariant fixation;
            qVariantSetValue<Node::Fixation>( fixation, fixType );
            model->setData( index, fixation );

            emit cellWasChanged( index.row(), index.column() );
        }
        else if ( checkBoxRect2.contains( mouseEvent->x(), mouseEvent->y() ) )
        {
            bool xCheckState, yCheckState;
            getCheckStates( xCheckState, yCheckState, index );
          
            Node::Fixation fixType = 
                getFixationByCheckStates( xCheckState, ! yCheckState );
            
            QVariant fixation;
            qVariantSetValue<Node::Fixation>( fixation, fixType );
            model->setData( index, fixation );

            emit cellWasChanged( index.row(), index.column() );
        }
    }    
    return true;
}
开发者ID:rouming,项目名称:FermaNext,代码行数:47,代码来源:GeometryTabWidget.cpp


注:本文中的QMouseEvent::y方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。