Raw -> Smart Pointers for PVarDialog, mupp, qt5/qt6.
This commit is contained in:
parent
51520868f1
commit
9911d88889
@ -100,13 +100,13 @@ PVarDialog::PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
|
||||
QWidget *parent, Qt::WindowFlags f) :
|
||||
QDialog(parent, f), fCollList(collection_list)
|
||||
{
|
||||
fVarEdit = new QPlainTextEdit();
|
||||
fCollectionView = new QListWidget();
|
||||
fCancel = new QPushButton("&Cancel", this);
|
||||
fCheck = new QPushButton("Chec&k", this);
|
||||
fAdd = new QPushButton("&Add", this);
|
||||
fHelp = new QPushButton("&Help", this);
|
||||
fShowVarName = new QPushButton("Show&VarName", this);
|
||||
fVarEdit = std::make_unique<QPlainTextEdit>();
|
||||
fCollectionView = std::make_unique<QListWidget>();
|
||||
fCancel = std::make_unique<QPushButton>("&Cancel", this);
|
||||
fCheck = std::make_unique<QPushButton>("Chec&k", this);
|
||||
fAdd = std::make_unique<QPushButton>("&Add", this);
|
||||
fHelp = std::make_unique<QPushButton>("&Help", this);
|
||||
fShowVarName = std::make_unique<QPushButton>("Show&VarName", this);
|
||||
|
||||
// fill collection view
|
||||
for (int i=0; i<fCollList.count(); i++) {
|
||||
@ -118,23 +118,23 @@ PVarDialog::PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
|
||||
fCollectionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
QHBoxLayout *hLayout0 = new QHBoxLayout;
|
||||
hLayout0->addWidget(fShowVarName);
|
||||
hLayout0->addWidget(fHelp);
|
||||
hLayout0->addWidget(fShowVarName.get());
|
||||
hLayout0->addWidget(fHelp.get());
|
||||
|
||||
QHBoxLayout *hLayout1 = new QHBoxLayout;
|
||||
hLayout1->addWidget(fCancel);
|
||||
hLayout1->addWidget(fCheck);
|
||||
hLayout1->addWidget(fAdd);
|
||||
hLayout1->addWidget(fCancel.get());
|
||||
hLayout1->addWidget(fCheck.get());
|
||||
hLayout1->addWidget(fAdd.get());
|
||||
|
||||
QLabel *varLabel = new QLabel("Edit Variables:");
|
||||
QVBoxLayout *varVLayout = new QVBoxLayout;
|
||||
varVLayout->addWidget(varLabel);
|
||||
varVLayout->addWidget(fVarEdit);
|
||||
varVLayout->addWidget(fVarEdit.get());
|
||||
|
||||
QLabel *collLabel = new QLabel("Collections:");
|
||||
QVBoxLayout *collVLayout = new QVBoxLayout;
|
||||
collVLayout->addWidget(collLabel);
|
||||
collVLayout->addWidget(fCollectionView);
|
||||
collVLayout->addWidget(fCollectionView.get());
|
||||
|
||||
QWidget *varWidget = new QWidget(this); // only needed since splitter needs a QWidget
|
||||
varWidget->setLayout(varVLayout);
|
||||
@ -154,11 +154,11 @@ PVarDialog::PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
|
||||
setLayout(vLayout);
|
||||
resize(600, 450);
|
||||
|
||||
connect(fCancel, SIGNAL( clicked() ), this, SLOT( reject() ));
|
||||
connect(fCheck, SIGNAL( clicked() ), this, SLOT( check() ));
|
||||
connect(fAdd, SIGNAL( clicked() ), this, SLOT( add() ));
|
||||
connect(fHelp, SIGNAL( clicked() ), this, SLOT( help() ));
|
||||
connect(fShowVarName, SIGNAL( clicked() ), this, SLOT( showVarNames() ));
|
||||
connect(fCancel.get(), SIGNAL( clicked() ), this, SLOT( reject() ));
|
||||
connect(fCheck.get(), SIGNAL( clicked() ), this, SLOT( check() ));
|
||||
connect(fAdd.get(), SIGNAL( clicked() ), this, SLOT( add() ));
|
||||
connect(fHelp.get(), SIGNAL( clicked() ), this, SLOT( help() ));
|
||||
connect(fShowVarName.get(), SIGNAL( clicked() ), this, SLOT( showVarNames() ));
|
||||
|
||||
QString iconName("");
|
||||
if (darkTheme)
|
||||
|
@ -30,6 +30,8 @@
|
||||
#ifndef _PVARDIALOG_H_
|
||||
#define _PVARDIALOG_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QPushButton>
|
||||
#include <QPlainTextEdit>
|
||||
@ -73,13 +75,13 @@ class PVarDialog : public QDialog
|
||||
Qt::WindowFlags f = Qt::WindowFlags());
|
||||
|
||||
private:
|
||||
QPlainTextEdit *fVarEdit;
|
||||
QListWidget *fCollectionView;
|
||||
QPushButton *fCancel;
|
||||
QPushButton *fAdd;
|
||||
QPushButton *fCheck;
|
||||
QPushButton *fHelp;
|
||||
QPushButton *fShowVarName;
|
||||
std::unique_ptr<QPlainTextEdit> fVarEdit;
|
||||
std::unique_ptr<QListWidget> fCollectionView;
|
||||
std::unique_ptr<QPushButton> fCancel;
|
||||
std::unique_ptr<QPushButton> fAdd;
|
||||
std::unique_ptr<QPushButton> fCheck;
|
||||
std::unique_ptr<QPushButton> fHelp;
|
||||
std::unique_ptr<QPushButton> fShowVarName;
|
||||
|
||||
QVector<PCollInfo> fCollList;
|
||||
|
||||
|
@ -96,13 +96,13 @@ PVarDialog::PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
|
||||
QWidget *parent, Qt::WindowFlags f) :
|
||||
QDialog(parent, f), fCollList(collection_list)
|
||||
{
|
||||
fVarEdit = new QPlainTextEdit();
|
||||
fCollectionView = new QListWidget();
|
||||
fCancel = new QPushButton("&Cancel", this);
|
||||
fCheck = new QPushButton("Chec&k", this);
|
||||
fAdd = new QPushButton("&Add", this);
|
||||
fHelp = new QPushButton("&Help", this);
|
||||
fShowVarName = new QPushButton("Show&VarName", this);
|
||||
fVarEdit = std::make_unique<QPlainTextEdit>();
|
||||
fCollectionView = std::make_unique<QListWidget>();
|
||||
fCancel = std::make_unique<QPushButton>("&Cancel", this);
|
||||
fCheck = std::make_unique<QPushButton>("Chec&k", this);
|
||||
fAdd = std::make_unique<QPushButton>("&Add", this);
|
||||
fHelp = std::make_unique<QPushButton>("&Help", this);
|
||||
fShowVarName = std::make_unique<QPushButton>("Show&VarName", this);
|
||||
|
||||
// fill collection view
|
||||
for (int i=0; i<fCollList.count(); i++) {
|
||||
@ -114,23 +114,23 @@ PVarDialog::PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
|
||||
fCollectionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
QHBoxLayout *hLayout0 = new QHBoxLayout;
|
||||
hLayout0->addWidget(fShowVarName);
|
||||
hLayout0->addWidget(fHelp);
|
||||
hLayout0->addWidget(fShowVarName.get());
|
||||
hLayout0->addWidget(fHelp.get());
|
||||
|
||||
QHBoxLayout *hLayout1 = new QHBoxLayout;
|
||||
hLayout1->addWidget(fCancel);
|
||||
hLayout1->addWidget(fCheck);
|
||||
hLayout1->addWidget(fAdd);
|
||||
hLayout1->addWidget(fCancel.get());
|
||||
hLayout1->addWidget(fCheck.get());
|
||||
hLayout1->addWidget(fAdd.get());
|
||||
|
||||
QLabel *varLabel = new QLabel("Edit Variables:");
|
||||
QVBoxLayout *varVLayout = new QVBoxLayout;
|
||||
varVLayout->addWidget(varLabel);
|
||||
varVLayout->addWidget(fVarEdit);
|
||||
varVLayout->addWidget(fVarEdit.get());
|
||||
|
||||
QLabel *collLabel = new QLabel("Collections:");
|
||||
QVBoxLayout *collVLayout = new QVBoxLayout;
|
||||
collVLayout->addWidget(collLabel);
|
||||
collVLayout->addWidget(fCollectionView);
|
||||
collVLayout->addWidget(fCollectionView.get());
|
||||
|
||||
QWidget *varWidget = new QWidget(this); // only needed since splitter needs a QWidget
|
||||
varWidget->setLayout(varVLayout);
|
||||
@ -150,11 +150,11 @@ PVarDialog::PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
|
||||
setLayout(vLayout);
|
||||
resize(600, 450);
|
||||
|
||||
connect(fCancel, SIGNAL( clicked() ), this, SLOT( reject() ));
|
||||
connect(fCheck, SIGNAL( clicked() ), this, SLOT( check() ));
|
||||
connect(fAdd, SIGNAL( clicked() ), this, SLOT( add() ));
|
||||
connect(fHelp, SIGNAL( clicked() ), this, SLOT( help() ));
|
||||
connect(fShowVarName, SIGNAL( clicked() ), this, SLOT( showVarNames() ));
|
||||
connect(fCancel.get(), SIGNAL( clicked() ), this, SLOT( reject() ));
|
||||
connect(fCheck.get(), SIGNAL( clicked() ), this, SLOT( check() ));
|
||||
connect(fAdd.get(), SIGNAL( clicked() ), this, SLOT( add() ));
|
||||
connect(fHelp.get(), SIGNAL( clicked() ), this, SLOT( help() ));
|
||||
connect(fShowVarName.get(), SIGNAL( clicked() ), this, SLOT( showVarNames() ));
|
||||
|
||||
QString iconName("");
|
||||
if (darkTheme)
|
||||
|
@ -30,6 +30,8 @@
|
||||
#ifndef _PVARDIALOG_H_
|
||||
#define _PVARDIALOG_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QPushButton>
|
||||
#include <QPlainTextEdit>
|
||||
@ -73,13 +75,13 @@ class PVarDialog : public QDialog
|
||||
Qt::WindowFlags f = Qt::WindowFlags());
|
||||
|
||||
private:
|
||||
QPlainTextEdit *fVarEdit;
|
||||
QListWidget *fCollectionView;
|
||||
QPushButton *fCancel;
|
||||
QPushButton *fAdd;
|
||||
QPushButton *fCheck;
|
||||
QPushButton *fHelp;
|
||||
QPushButton *fShowVarName;
|
||||
std::unique_ptr<QPlainTextEdit> fVarEdit;
|
||||
std::unique_ptr<QListWidget> fCollectionView;
|
||||
std::unique_ptr<QPushButton> fCancel;
|
||||
std::unique_ptr<QPushButton> fAdd;
|
||||
std::unique_ptr<QPushButton> fCheck;
|
||||
std::unique_ptr<QPushButton> fHelp;
|
||||
std::unique_ptr<QPushButton> fShowVarName;
|
||||
|
||||
QVector<PCollInfo> fCollList;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user