void QQuickPopupWindow::exposeEvent(QExposeEvent *e)
{
    if (isExposed() && m_needsActivatedEvent) {
        m_needsActivatedEvent = false;
        QWindowSystemInterface::handleWindowActivated(this);
    } else if (!isExposed() && !m_needsActivatedEvent) {
        m_needsActivatedEvent = true;
        if (QWindow *tp = transientParent())
            QWindowSystemInterface::handleWindowActivated(tp);
    }
    QQuickWindow::exposeEvent(e);
}
Beispiel #2
0
void ventanaGL::exposeEvent(QExposeEvent *event)
{
    Q_UNUSED(event);

    if (isExposed())
        renderNow();
}
Beispiel #3
0
void PainterWindow::renderPin( QSharedPointer<fugio::PinInterface> P )
{
	if (!isExposed())
		return;

	QRect rect(0, 0, width(), height());
	m_backingStore->beginPaint(rect);

	QPaintDevice *device = m_backingStore->paintDevice();

	QPainter painter(device);

	if( fugio::ImageInterface *I = input<fugio::ImageInterface *>( P ) )
	{
		const QImage		IM = I->image();

		painter.drawImage( 0, 0, IM );
	}
	else if( fugio::PainterInterface *I = input<fugio::PainterInterface *>( P ) )
	{
		I->render( painter );
	}

	m_backingStore->endPaint();
	m_backingStore->flush(rect);
}
Beispiel #4
0
void OpenGLWindow::exposeEvent( QExposeEvent *event )
{
    if( isExposed() ) {
        d->thread->update( d->renderId );
        d->thread->resize( d->renderId, event->region().boundingRect().size() );
    }
}
void OpenGLWindow::exposeEvent(QExposeEvent *event)
{
    Q_UNUSED(event);

    if (isExposed())
        renderNow();
}
Beispiel #6
0
void MyGLWidget::exposeEvent(QExposeEvent *event)
{
    Q_UNUSED(event);

    if (isExposed())
        renderNow();
}
void RasterWindow::exposeEvent(QExposeEvent *)
{
    if (isExposed()) {
        m_backingStore->resize(size());
        renderNow();
    }
}
void OpenGLWindow::renderNow()
{
    if (!isExposed())
        return;

    bool needsInitialize = false;

    // Create an OpenGL context if there is not any
    if (!m_context) {
        m_context = new QOpenGLContext(this);
        m_context->setFormat(requestedFormat());
        m_context->create();

        needsInitialize = true;
    }

    m_context->makeCurrent(this);

    m_funcs = m_context->versionFunctions<QOpenGLFunctions_3_3_Core>();

    if (needsInitialize) {
        initializeOpenGLFunctions();
        initialize();

    }

    render();

    m_context->swapBuffers(this);
}
Beispiel #9
0
void MainWindow::renderNow()
{
    if (!isExposed())
        return;

    calc->stop();

    m_update_pending = false;

    if (!m_context) {
        initialize();
    } else {
        m_context->makeCurrent(this);
    }

    render();
    m_context->swapBuffers(this);
    renderLater();

    counter++;
    if (counter >= 60 * 3600)
        counter = 0;

    emit needCalc();
}
Beispiel #10
0
void yage::GLWindow::beginDraw ( void )
{
    if (!isExposed()) {
        return;
    }

    bool needInit = false;
    if (!m_context) {
        qDebug() << "start ctx";
        // Specify the format and create platform-specific surface
        
        // Create an OpenGL context
        m_context = new QOpenGLContext( this );
        m_context->setFormat( requestedFormat() );
        m_context->create();

        if (!m_context->isValid()) {
            qCritical() << "invalid context";
        }

        // Make the context current on this window

        QList<QByteArray> extensions = m_context->extensions().toList();
        qDebug() << "Version: " << m_context->format().majorVersion() << "." << m_context->format().minorVersion();
        qDebug() << "Profile: " << m_context->format().profile();
        //std::sort(extensions.first(), extensions.last());
        qDebug() << "Supported extensions (" << extensions.count() << ")";
        foreach ( const QByteArray &extension, extensions )
            qDebug() << "    " << extension;

        needInit = true;
    }
Beispiel #11
0
void CheckBox::draw(void)
{
	if(!isExposed())
		return;
	
	// Draw the box
	if(enabled)
		drawGradient(theme->col_light_ctrl, theme->col_dark_ctrl ,2, 4, 7, 7);
	else
		drawGradient(theme->col_light_ctrl_disabled, theme->col_dark_ctrl_disabled,2, 4, 7, 7);
	
	drawLine(1, 3, 9, 1, theme->col_outline);
	drawLine(1,11, 9, 1, theme->col_outline);
	drawLine(1, 3, 9, 0, theme->col_outline);
	drawLine(9, 3, 9, 0, theme->col_outline);
	
	// Clear up
	if(!albino)
		drawFullBox(0, 0, 11, 3, theme->col_light_bg);
	else
		drawFullBox(0, 0, 11, 3, theme->col_dark_bg);
	
	// Checked or not
	if(checked == true)
		drawMonochromeIcon(1, 0, 10, 10, haken_bin);
	
	// Text
	if(!albino)
		drawString(label, 13, 2, 255, theme->col_text);
	else
		drawString(label, 13, 2, 255, theme->col_lighter_bg);
}
Beispiel #12
0
void QOgreWindow::renderNow()
{
    if (!isExposed()) return;
    if (oRoot == NULL) initialize();
    render();
    if (isAnimating) renderLater();
}
Beispiel #13
0
void OpenGLWindow::renderNow()
{
    if (!isExposed())
        return;

    m_update_pending = false;

    bool needsInitialize = false;

    if (!m_context) {
        m_context = new QOpenGLContext(this);
        m_context->setFormat(requestedFormat());
        m_context->create();

        needsInitialize = true;
    }

    m_context->makeCurrent(this);

    if (needsInitialize) {
        initializeOpenGLFunctions();
        initialize();
    }

    render();

    m_context->swapBuffers(this);

    if (m_animating)
        renderLater();
}
Beispiel #14
0
void MainWindow::renderNow()
{

    if (!isExposed())
        return;


    updatePending = false;

    bool needsInitialize = false;

    if (!context) {
        context = new QOpenGLContext(this);
        context->setFormat(requestedFormat());
        context->create();

        needsInitialize = true;
    }

    context->makeCurrent(this);

    if (world)
        world->simulate(timer.elapsed());
    timer.start();

    if (needsInitialize) {
        initializeOpenGLFunctions();
    }

    render();

    context->swapBuffers(this);
    if (animating)
        renderLater();
}
Beispiel #15
0
void Window::timerEvent(QTimerEvent *)
{
    if (isExposed())
        render();
    killTimer(m_renderTimer);
    m_renderTimer = 0;
}
Beispiel #16
0
//-------------------------------------------------------------------------------------
void MethodDescription::addToStream(MemoryStream* mstream, PyObject* args)
{
	uint8 argsSize = argTypes_.size();
	int offset = 0;

	// 将utype放进去,方便对端识别这个方法
	// 这里如果aliasID_大于0则采用一个优化的办法, 使用1字节传输
	if(aliasID_ < 0)
	{
		(*mstream) << utype_;
	}
	else
	{
		uint8 utype = (uint8)aliasID_;
		(*mstream) << utype;
	}

	// 如果是exposed方法则先将entityID打包进去
	if(isExposed() && g_componentType == CELLAPP_TYPE && isCell())
	{
		offset = 1;
		ENTITY_ID eid = PyLong_AsLong(PyTuple_GetItem(args, 0));
		(*mstream) << eid;
	}

	// 将每一个参数添加到流中
	for(uint8 i=0; i <argsSize; i++)
	{
		PyObject* pyArg = PyTuple_GetItem(args, i + offset);
		argTypes_[i]->addToStream(mstream, pyArg);
	}	
}
Beispiel #17
0
//-------------------------------------------------------------------------------------
PyObject* MethodDescription::createFromStream(MemoryStream* mstream)
{
	size_t argSize = getArgSize();
	PyObject* pyArgsTuple = NULL;
	int offset = 0;
	
	if(isExposed() && g_componentType == CELLAPP_TYPE && isCell())
	{
		offset = 1;
		pyArgsTuple = PyTuple_New(argSize + offset);

		// 设置一个调用者ID提供给脚本判断来源是否正确
		KBE_ASSERT(currCallerID_ > 0);
		PyTuple_SET_ITEM(pyArgsTuple, 0, PyLong_FromLong(currCallerID_));
	}
	else
		pyArgsTuple = PyTuple_New(argSize);

	for(size_t index=0; index<argSize; index++)
	{
		PyObject* pyitem = argTypes_[index]->createFromStream(mstream);

		if(pyitem == NULL)
		{
			WARNING_MSG(fmt::format("MethodDescription::createFromStream:{} arg[{}][{}] is NULL.\n", 
				this->getName(), index, argTypes_[index]->getName()));
		}

		PyTuple_SET_ITEM(pyArgsTuple, index + offset, pyitem);
	}
	
	return pyArgsTuple;
}
void OpenGLWindow::renderNow()
{
    // end function if window is not visible
    if (!isExposed())
        return;

    bool needsInitialize = false;

    /*QOpenGLContext represents the OpenGL state of an underlying OpenGL context.
    To set up a context, set its screen and format such that they match those of the surface
    or surfaces with which the context is meant to be used.*/
    if (!m_context) {
        m_context = new QOpenGLContext(this);
        m_context->setFormat(requestedFormat());
        m_context->create();

        needsInitialize = true;
    }

    m_context->makeCurrent(this);

    if (needsInitialize) {
        // intern OpenGL function
        initializeOpenGLFunctions();
        initialize();
    }

    render();

    m_context->swapBuffers(this);

    if (m_animating)
        renderLater();
}
Beispiel #19
0
//-------------------------------------------------------------------------------------
PyObject* MethodDescription::call(PyObject* func, PyObject* args)
{
	PyObject* pyResult = NULL;
	if (!PyCallable_Check(func))
	{
		PyErr_Format(PyExc_TypeError, "MethodDescription::call: method[%s] call attempted on a error object!", 
			getName());
	}
	else
	{
		if(args == NULL)
		{
			pyResult = PyObject_CallObject(func, NULL);
		}
		else
		{
			if(checkArgs(args))
				pyResult = PyObject_CallObject(func, args);
		}
	}

	if (PyErr_Occurred())
	{
		if (isExposed() && PyErr_ExceptionMatches(PyExc_TypeError))
		{
			WARNING_MSG(fmt::format("MethodDescription::call: {} is exposed of method, if there is a missing arguments error, "
				"try adding callerEntityID, For example: \ndef func(msg): => def func(callerEntityID, msg):\n",
				this->getName()));
		}

		PyErr_PrintEx(0);
	}

	return pyResult;
}
Beispiel #20
0
void MainWindow::resizeEvent(QResizeEvent *event)
{
    Q_UNUSED(event);

    if (isExposed())
        renderNow();
}
void OpenGLWindow::resizeEvent(QResizeEvent *event)
{
    Q_UNUSED(event);
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT |
GL_STENCIL_BUFFER_BIT );
	glViewport(0,0,width(),height());
    if (isExposed())
        renderNow();
}
Beispiel #22
0
void CanvasQt::paintGL() {
#ifdef USE_QWINDOW
    if (!isExposed())
        return;
#endif

    swapBuffersAllowed_ = true;
    CanvasGL::update();
}
    void exposeEvent(QExposeEvent *)
    {
        if (!isExposed())
            return;

        if (!gl) {
            gl = new QOpenGLContext();
            gl->setFormat(requestedFormat());
            gl->create();
        }

        gl->makeCurrent(this);

        QOpenGLShaderProgram prog;
        prog.addShaderFromSourceCode(QOpenGLShader::Vertex,
                                     "attribute highp vec4 a_Pos;"
                                     "attribute lowp vec4 a_Color;"
                                     "varying lowp vec4 v_Color;"
                                     "void main() {"
                                     "    gl_Position = a_Pos;"
                                     "    v_Color = a_Color;"
                                     "}");
        prog.addShaderFromSourceCode(QOpenGLShader::Fragment,
                                     "varying lowp vec4 v_Color;"
                                     "void main() {"
                                     "    gl_FragColor = v_Color;"
                                     "}");
        prog.bind();

        glClearColor(0, 0, 0, 1);
        glClear(GL_COLOR_BUFFER_BIT);
        glViewport(0, 0, width(), height());

        prog.enableAttributeArray("a_Pos");
        prog.enableAttributeArray("a_Color");

        float coords[] = { -0.7f,  0.7f,
                           0.8f,  0.8f,
                           -0.8f, -0.8f,
                           0.7f, -0.7f
                         };
        float colors[] = { 1, 0, 0, 1,
                           0, 1, 0, 1,
                           0, 0, 1, 1,
                           0, 0, 0, 0
                         };

        prog.setAttributeArray("a_Pos", GL_FLOAT, coords, 2, 0);
        prog.setAttributeArray("a_Color", GL_FLOAT, colors, 4, 0);

        glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

        prog.disableAttributeArray("a_Pos");
        prog.disableAttributeArray("a_Color");

        gl->swapBuffers(this);
    }
void OpenGLWindow::exposeEvent(QExposeEvent *event)
{
    /*The exposeEvent() is the notification to the window that its exposure,
    meaning visibility, on the screen has changed.*/
    Q_UNUSED(event);

    if (isExposed())
        renderNow();
}
Beispiel #25
0
void NGLScene::resizeEvent(QResizeEvent *_event )
{
  m_width=this->size().width();
  m_height=this->size().height();
  if(isExposed())
  {
    renderLater();
  }
}
void MapViewer::exposeEvent(QExposeEvent *event)
{
    Q_UNUSED(event);
    if (isExposed()) {
        // Make sure the viewer is initialized when the window is exposed
        initialize();
        m_renderer->setState(m_render_state);
    }
}
Beispiel #27
0
void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
{
    if (isExposed()) {
        m_widget->setAttribute(Qt::WA_Mapped);
        if (!event->region().isNull())
            m_widget->d_func()->syncBackingStore(event->region());
    } else {
        m_widget->setAttribute(Qt::WA_Mapped, false);
    }
}
Beispiel #28
0
void OpenGLWindow::resizeEvent(QResizeEvent *event)
{
    Q_UNUSED(event);

    if (isExposed())
	{
		resizeWindow();
        renderNow();
	}
}
Beispiel #29
0
bool QOgreWindow::eventFilter(QObject *target, QEvent *event)
{
    if (target == this)
    {
        if (event->type() == QEvent::Resize)
        {
            if (isExposed() && oWin != NULL) oWin->resize(this->width(), this->height());
        }
    }
    return false;
}
Beispiel #30
0
void VideoWindow::resizeEvent(QResizeEvent *_event )
{
  if(isExposed())
  {
  int w=_event->size().width();
  int h=_event->size().height();
  // set the viewport for openGL
  glViewport(0,0,w,h);
  renderLater();
  }
}