void CFrmSettings::doPreview(QString fileName)
{
- if (getActiveWindow()->previewFrm) {
+ if (getActiveWindow()->previewFrm != nullptr) {
getActiveWindow()->parentFrm->mdiArea->
removeSubWindow(getActiveWindow()->previewFrm->subWindowRef);
- delete getActiveWindow()->previewFrm;
getActiveWindow()->previewFrm = NULL;
}
* Contributors: Details at https://graphviz.org
*************************************************************************/
-
+#include <memory>
#include <QtWidgets>
#include "mdichild.h"
renderIdx = 0;
preview = true;
applyCairo = false;
- previewFrm = NULL;
settingsSet = false;
}
bool MdiChild::loadPreview(QString fileName)
{
- if (!this->previewFrm) {
- previewFrm = new ImageViewer();
+ if (previewFrm == nullptr) {
+ previewFrm = std::unique_ptr<ImageViewer>(new ImageViewer());
previewFrm->graphWindow = this;
- QMdiSubWindow *s = parentFrm->mdiArea->addSubWindow(previewFrm);
+ QMdiSubWindow *s = parentFrm->mdiArea->addSubWindow(previewFrm.get());
s->resize(600, 400);
s->move(parentFrm->mdiArea->subWindowList().count() * 5,
#pragma once
+#include <memory>
#include <QTextEdit>
#include "imageviewer.h"
class CMainWindow;
bool preview;
bool applyCairo;
QString attributes;
- ImageViewer* previewFrm;
+ std::unique_ptr<ImageViewer> previewFrm;
CMainWindow* parentFrm;
bool loadPreview(QString fileName);
bool firstTime();