Fixed Tape crash.
(grafted from 47b3aaf84786a338bc7c31284bef0bd5017a0c67) --HG-- branch : develop
This commit is contained in:
parent
458d7be6b2
commit
ed6c72bda9
|
@ -104,7 +104,8 @@ TMainWindow::TMainWindow(QWidget *parent)
|
|||
dockDiagramVisible(true),
|
||||
isInitialized(false),
|
||||
recentFileActs(),
|
||||
separatorAct(nullptr)
|
||||
separatorAct(nullptr),
|
||||
hackedWidgets()
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -1869,39 +1870,23 @@ void TMainWindow::InitWindow()
|
|||
// Because Qt Designer doesn't know about our deleting we will create empty objects for correct
|
||||
// working the retranslation UI
|
||||
// Tab Measurements
|
||||
delete ui->horizontalLayoutValue;
|
||||
delete ui->plainTextEditFormula;
|
||||
delete ui->toolButtonExpr;
|
||||
|
||||
delete ui->labelFormula;
|
||||
ui->labelFormula = new QLabel(this);
|
||||
|
||||
delete ui->pushButtonGrow;
|
||||
ui->pushButtonGrow = new QPushButton(this);
|
||||
HackWidget(&ui->horizontalLayoutValue);
|
||||
HackWidget(&ui->plainTextEditFormula);
|
||||
HackWidget(&ui->toolButtonExpr);
|
||||
HackWidget(&ui->labelFormula);
|
||||
HackWidget(&ui->pushButtonGrow);
|
||||
|
||||
// Tab Information
|
||||
delete ui->lineEditGivenName;
|
||||
delete ui->lineEditFamilyName;
|
||||
delete ui->comboBoxGender;
|
||||
delete ui->lineEditEmail;
|
||||
|
||||
delete ui->labelGivenName;
|
||||
ui->labelGivenName = new QLabel(this);
|
||||
|
||||
delete ui->labelFamilyName;
|
||||
ui->labelFamilyName = new QLabel(this);
|
||||
|
||||
delete ui->labelBirthDate;
|
||||
ui->labelBirthDate = new QLabel(this);
|
||||
|
||||
delete ui->dateEditBirthDate;
|
||||
ui->dateEditBirthDate = new QDateEdit(this);
|
||||
|
||||
delete ui->labelGender;
|
||||
ui->labelGender = new QLabel(this);
|
||||
|
||||
delete ui->labelEmail;
|
||||
ui->labelEmail = new QLabel(this);
|
||||
HackWidget(&ui->lineEditGivenName);
|
||||
HackWidget(&ui->lineEditFamilyName);
|
||||
HackWidget(&ui->comboBoxGender);
|
||||
HackWidget(&ui->lineEditEmail);
|
||||
HackWidget(&ui->labelGivenName);
|
||||
HackWidget(&ui->labelFamilyName);
|
||||
HackWidget(&ui->labelBirthDate);
|
||||
HackWidget(&ui->dateEditBirthDate);
|
||||
HackWidget(&ui->labelGender);
|
||||
HackWidget(&ui->labelEmail);
|
||||
|
||||
const QStringList listHeights = VMeasurement::WholeListHeights(mUnit);
|
||||
const QStringList listSizes = VMeasurement::WholeListSizes(mUnit);
|
||||
|
@ -1941,31 +1926,18 @@ void TMainWindow::InitWindow()
|
|||
ui->lineEditEmail->setEnabled(true);
|
||||
|
||||
// Tab Measurements
|
||||
delete ui->doubleSpinBoxBaseValue;
|
||||
delete ui->doubleSpinBoxInSizes;
|
||||
delete ui->doubleSpinBoxInHeights;
|
||||
|
||||
delete ui->labelBaseValue;
|
||||
ui->labelBaseValue = new QLabel(this);
|
||||
|
||||
delete ui->labelInSizes;
|
||||
ui->labelInSizes = new QLabel(this);
|
||||
|
||||
delete ui->labelInHeights;
|
||||
ui->labelInHeights = new QLabel(this);
|
||||
HackWidget(&ui->doubleSpinBoxBaseValue);
|
||||
HackWidget(&ui->doubleSpinBoxInSizes);
|
||||
HackWidget(&ui->doubleSpinBoxInHeights);
|
||||
HackWidget(&ui->labelBaseValue);
|
||||
HackWidget(&ui->labelInSizes);
|
||||
HackWidget(&ui->labelInHeights);
|
||||
|
||||
// Tab Information
|
||||
delete ui->labelBaseSize;
|
||||
ui->labelBaseSize = new QLabel(this);
|
||||
|
||||
delete ui->labelBaseSizeValue;
|
||||
ui->labelBaseSizeValue = new QLabel(this);
|
||||
|
||||
delete ui->labelBaseHeight;
|
||||
ui->labelBaseHeight = new QLabel(this);
|
||||
|
||||
delete ui->labelBaseHeightValue;
|
||||
ui->labelBaseHeightValue = new QLabel(this);
|
||||
HackWidget(&ui->labelBaseSize);
|
||||
HackWidget(&ui->labelBaseSizeValue);
|
||||
HackWidget(&ui->labelBaseHeight);
|
||||
HackWidget(&ui->labelBaseHeightValue);
|
||||
|
||||
ui->lineEditGivenName->setText(m->GivenName());
|
||||
ui->lineEditFamilyName->setText(m->FamilyName());
|
||||
|
@ -3003,3 +2975,12 @@ void TMainWindow::InitGender(QComboBox *gender)
|
|||
gender->addItem(tr("male", "gender"), QVariant(static_cast<int>(GenderType::Male)));
|
||||
gender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
void TMainWindow::HackWidget(T **widget)
|
||||
{
|
||||
delete *widget;
|
||||
*widget = new T();
|
||||
hackedWidgets.append(*widget);
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ private:
|
|||
enum { MaxRecentFiles = 5 };
|
||||
QAction *recentFileActs[MaxRecentFiles];
|
||||
QAction *separatorAct;
|
||||
|
||||
QVector<QObject *> hackedWidgets;
|
||||
|
||||
void SetupMenu();
|
||||
void InitWindow();
|
||||
|
@ -205,6 +205,9 @@ private:
|
|||
void CreateWindowMenu(QMenu *menu);
|
||||
|
||||
bool IgnoreLocking(int error, const QString &path);
|
||||
|
||||
template <class T>
|
||||
void HackWidget(T **widget);
|
||||
};
|
||||
|
||||
#endif // TMAINWINDOW_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user