本文整理汇总了C++中QObject::event方法的典型用法代码示例。如果您正苦于以下问题:C++ QObject::event方法的具体用法?C++ QObject::event怎么用?C++ QObject::event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QObject
的用法示例。
在下文中一共展示了QObject::event方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mousePressEvent
void DlgExpressionInput::mousePressEvent(QMouseEvent* ev)
{
#if 0//defined(Q_WS_WIN)
bool handled = false;
if (QWidget::mouseGrabber() == this) {
QList<QWidget*> childs = this->findChildren<QWidget*>();
for (QList<QWidget*>::iterator it = childs.begin(); it != childs.end(); ++it) {
QPoint pos = (*it)->mapFromGlobal(ev->globalPos());
if ((*it)->rect().contains(pos)) {
// Create new mouse event with the correct local position
QMouseEvent me(ev->type(), pos, ev->globalPos(), ev->button(), ev->buttons(), ev->modifiers());
QObject* obj = *it;
obj->event(&me);
if (me.isAccepted()) {
handled = true;
break;
}
}
}
}
if (handled)
return;
#else
Q_UNUSED(ev);
#endif
// The 'FramelessWindowHint' is also set when the background is transparent.
if (windowFlags() & Qt::FramelessWindowHint) {
//we need to reject the dialog when clicked on the background. As the background is transparent
//this is the expected behaviour for the user
bool on = ui->expression->completerActive();
if (!on)
this->reject();
}
}
示例2: mouseReleaseEvent
void DlgExpressionInput::mouseReleaseEvent(QMouseEvent* ev)
{
#if 0//defined(Q_WS_WIN)
if (QWidget::mouseGrabber() == this) {
QList<QWidget*> childs = this->findChildren<QWidget*>();
for (QList<QWidget*>::iterator it = childs.begin(); it != childs.end(); ++it) {
QPoint pos = (*it)->mapFromGlobal(ev->globalPos());
if ((*it)->rect().contains(pos)) {
// Create new mouse event with the correct local position
QMouseEvent me(ev->type(), pos, ev->globalPos(), ev->button(), ev->buttons(), ev->modifiers());
QObject* obj = *it;
obj->event(&me);
if (me.isAccepted()) {
break;
}
}
}
}
#else
Q_UNUSED(ev);
#endif
}
示例3: updatePaintNode
QSGNode* ARCameraQml::updatePaintNode(QSGNode* node, UpdatePaintNodeData* )
{
using namespace QScrollEngine;
_context->lock();
QSGSimpleTextureNode* textureNode = dynamic_cast<QSGSimpleTextureNode*>(node);
if (_context->openGLContext() != QOpenGLContext::currentContext()) {
_clearFBOs();
_context->setOpenGLContext(QOpenGLContext::currentContext());
_context->setPostEffectUsed(false);
_context->setEnableClearing(false);
_surface.setQScrollEngineContext(_context);
_arSystem.setContext(_context);
if (textureNode == nullptr)
textureNode = new QSGSimpleTextureNode();
_context->unlock();
_initialize(textureNode);
_context->lock();
} else if (textureNode == nullptr) {
_context->unlock();
textureNode = new QSGSimpleTextureNode();
_initialize(textureNode);
_context->lock();
}
GLint defaultFBO = 0;
_context->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
AR::FrameProvider* frameProvider = _surface.frameProvider();
if (frameProvider) {
AR::IPoint resolution = frameProvider->originalTextureSize();
if ((resolution != _currentResolution) || (_currentBoundingRect != boundingRect())) {
_context->unlock();
_initialize(textureNode);
_context->lock();
}
}
textureNode->markDirty(QSGNode::DirtyForceUpdate);
_updateActions();
if (_scene == nullptr) {
_context->unlock();
emit needToScene();
return textureNode;
}
if (_arSystem.reconstructor3D()->isRunning()) {
_context->unlock();
_context->glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
textureNode->setRect(_currentTextureRect);
qDebug() << "Thread is running.";
return textureNode;
}
_scene->setFrameProvider(nullptr);
_scene->beginUpdate();
_context->glEnable(GL_CULL_FACE);
_context->glFrontFace(GL_CW);
if (!_surface.isActive()) {
_surface.scheduleOpenGLContextUpdate();
QObject* glThreadCallback = (_surface.property("_q_GLThreadCallback")).value<QObject*>();
if (glThreadCallback) {
QEvent event(QEvent::User);
glThreadCallback->event(&event);
}
if (!_context->postEffectUsed())
_FBOs[0]->bind();
_context->beginPaint();
} else {
bool frameAvailable = _surface.isFrameAvailable();
_surface.provideFrame();
if (frameProvider) {
_scene->setFrameProvider(frameProvider);
frameProvider->setUsedTransform(false);
if (frameAvailable) {
QTime timer;
timer.start();
_arSystem.tracking(frameProvider, _context, _FBOs[1], _FBOs[2]);
int time = timer.elapsed();
_textStatus = QString::number(frameProvider->timeProvideLuminanceFrame()) + "/" + QString::number(time);
QMatrix4x4 matrix = _arSystem.matrixWorld();
QQuaternion orientation;
QOtherMathFunctions::matrixToQuaternion(matrix, orientation);
QVector3D position(matrix(0, 3), matrix(1, 3), matrix(2, 3));
_scene->position = position;
_scene->orientation = orientation;
emit textStatusChanged();
}
frameProvider->setUsedTransform(true);
if (!_context->postEffectUsed())
_FBOs[0]->bind();
_context->beginPaint();
_context->glDisable(GL_DEPTH_TEST);
_context->glDepthMask(GL_FALSE);
_context->glViewport(0, 0, _currentResolution.x, _currentResolution.y);
frameProvider->bindColorShader(_context);
_context->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
using namespace TMath;
QMatrix2x2 transform;
if (_mirrored) {
QMatrix2x2 frameTransform = frameProvider->matrixTexture();
transform(0, 0) = frameTransform(0, 0);
transform(0, 1) = - frameTransform(0, 1);
transform(1, 0) = - frameTransform(1, 0);
transform(1, 1) = frameTransform(1, 1);
} else {
//.........这里部分代码省略.........