modified z

This commit is contained in:
pimin 2025-11-13 22:18:18 +08:00
parent d7d1561ba8
commit 6cf2b5921e
3 changed files with 30 additions and 11 deletions

View File

@ -850,19 +850,22 @@ bool GraphicsWindowQt::releaseContextImplementation()
void GraphicsWindowQt::swapBuffersImplementation()
{
_widget->swapBuffers();
if (_widget->isVisible())
{
_widget->swapBuffers();
// FIXME: the processDeferredEvents should really be executed in a GUI (main) thread context but
// I couln't find any reliable way to do this. For now, lets hope non of *GUI thread only operations* will
// be executed in a QGLWidget::event handler. On the other hand, calling GUI only operations in the
// QGLWidget event handler is an indication of a Qt bug.
if (_widget->getNumDeferredEvents() > 0)
_widget->processDeferredEvents();
// FIXME: the processDeferredEvents should really be executed in a GUI (main) thread context but
// I couln't find any reliable way to do this. For now, lets hope non of *GUI thread only operations* will
// be executed in a QGLWidget::event handler. On the other hand, calling GUI only operations in the
// QGLWidget event handler is an indication of a Qt bug.
if (_widget->getNumDeferredEvents() > 0)
_widget->processDeferredEvents();
// We need to call makeCurrent here to restore our previously current context
// which may be changed by the processDeferredEvents function.
if (QGLContext::currentContext() != _widget->context())
_widget->makeCurrent();
// We need to call makeCurrent here to restore our previously current context
// which may be changed by the processDeferredEvents function.
if (QGLContext::currentContext() != _widget->context())
_widget->makeCurrent();
}
}
void GraphicsWindowQt::requestWarpPointer( float x, float y )

View File

@ -206,6 +206,15 @@ void OsgWidget::paintEvent(QPaintEvent*) {
frame();
}
void OsgWidget::showEvent(QShowEvent * event)
{
if (nullptr == view_) {
return;
}
qreal devicePixelRatio = screen()->devicePixelRatio();
viewUI_->Resize(size().width() * devicePixelRatio, size().height() * devicePixelRatio);
}
void OsgWidget::dragEnterEvent(QDragEnterEvent* event) {
LOG_INFO("OsgWidget::dragEnterEvent - Available formats:{}", event->mimeData()->formats().join(",").toStdString());
@ -279,6 +288,11 @@ void OsgWidget::OnPresetModelDropped(const QString& modelType, const QString& mo
height = 0.0;
}
if (height < 0.0)
{
height = 0.0;
}
bool success = false;
ModelInfo modelInfo = PresetModelConfigParser::Get().GetModelInfo(modelType, modelName, &success);
if (!success) {

View File

@ -29,6 +29,8 @@ protected:
void resizeEvent(QResizeEvent* event) override;
void paintEvent( QPaintEvent* /*event*/ ) override;
virtual void showEvent(QShowEvent *event) override;
// 拖拽事件处理
void dragEnterEvent(QDragEnterEvent* event) override;
void dragMoveEvent(QDragMoveEvent* event) override;