Skip to content

Commit

Permalink
fix flicker and hopefully qpaintengine warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
toloudis committed Dec 18, 2023
1 parent 1cf18fb commit 9e91458
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions agave_app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ main(int argc, char* argv[])

QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication a(argc, argv);
a.setOrganizationName("Allen Institute for Cell Science");
a.setOrganizationDomain("allencell.org");
Expand Down
18 changes: 18 additions & 0 deletions agave_app/wgpuView3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,3 +753,21 @@ WgpuView3D::restartRenderLoop()
std::shared_ptr<CStatus> s = getStatus();
s->EnableUpdates(true);
}


WgpuCanvas::WgpuCanvas(QCamera* cam, QRenderSettings* qrs, RenderSettings* rs, QWidget* parent)
{
setAttribute(Qt::WA_DeleteOnClose);
setMouseTracking(true);

m_view = new WgpuView3D(cam, qrs, rs, this);
connect(m_view, SIGNAL(ChangedRenderer()), this, SLOT(OnChangedRenderer()));
m_view->winId();

m_layout = new QHBoxLayout(this);
m_layout->setContentsMargins(0, 0, 0, 0);
setLayout(m_layout);
m_layout->addWidget(m_view);

show();
}
19 changes: 2 additions & 17 deletions agave_app/wgpuView3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,30 +124,15 @@ public slots:
void resizeEvent(QResizeEvent* event) override;
void paintEvent(QPaintEvent* event) override;

// virtual QPaintEngine* paintEngine() const override { return nullptr; }
virtual QPaintEngine* paintEngine() const override { return nullptr; }
};

class WgpuCanvas : public QWidget
{
Q_OBJECT;

public:
WgpuCanvas(QCamera* cam, QRenderSettings* qrs, RenderSettings* rs, QWidget* parent = 0)
{
setAttribute(Qt::WA_DeleteOnClose);
setMouseTracking(true);

m_view = new WgpuView3D(cam, qrs, rs, this);
connect(m_view, SIGNAL(ChangedRenderer()), this, SLOT(OnChangedRenderer()));
m_view->winId();

m_layout = new QHBoxLayout(this);
m_layout->setContentsMargins(0, 0, 0, 0);
setLayout(m_layout);
m_layout->addWidget(m_view);

show();
}
WgpuCanvas(QCamera* cam, QRenderSettings* qrs, RenderSettings* rs, QWidget* parent = 0);
~WgpuCanvas() { delete m_view; }

// make sure every time this updates, the child updates
Expand Down

0 comments on commit 9e91458

Please sign in to comment.