Skip to content

Commit

Permalink
Zinc window: keep a temporary copy of our .exfile file.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Aug 13, 2020
1 parent ee98ba2 commit dbebe3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/plugins/test/ZincWindow/src/zincwindowwindow.cpp
Expand Up @@ -60,6 +60,12 @@ ZincWindowWindow::ZincWindowWindow(QWidget *pParent) :

mGui->setupUi(this);

// Create a temporary copy of our .exfile file

mExFile = Core::canonicalFileName(QDir::tempPath()+"/ZincWindow/trilinearCube.exfile");

Core::writeResourceToFile(mExFile, ":/ZincWindow/trilinearCube.exfile");

// Create and add a Zinc widget

mZincWidget = new ZincWidget::ZincWidget(this);
Expand Down Expand Up @@ -87,6 +93,10 @@ ZincWindowWindow::ZincWindowWindow(QWidget *pParent) :

ZincWindowWindow::~ZincWindowWindow()
{
// Delete the temporary copy of our .exfile file

QFile::remove(mExFile);

// Delete some internal objects

delete mZincContext;
Expand Down Expand Up @@ -136,15 +146,9 @@ void ZincWindowWindow::createAndSetZincContext()
// Load our .exfile to our default region using a temporary copy of our
// .exfile file

QString exFile = Core::canonicalFileName(QDir::tempPath()+"/ZincWindow/trilinearCube.exfile");

Core::writeResourceToFile(exFile, ":/ZincWindow/trilinearCube.exfile");

OpenCMISS::Zinc::Region region = mZincContext->getDefaultRegion();

region.readFile(exFile.toUtf8().constData());

QFile::remove(exFile);
region.readFile(mExFile.toUtf8().constData());

// Create a field magnitude for our default region

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/test/ZincWindow/src/zincwindowwindow.h
Expand Up @@ -77,6 +77,8 @@ class ZincWindowWindow : public Core::WindowWidget

int mAxesFontPointSize = 0;

QString mExFile;

private slots:
void createAndSetZincContext();
void graphicsInitialized();
Expand Down

0 comments on commit dbebe3e

Please sign in to comment.