Skip to content

Fix parent-child relationships for some Qt objects #7

@elfring

Description

@elfring

👀 Some Qt objects are created without specifying a corresponding pointer for the parameter “parent”.

Examples:

  • BackUp constructor
    for (int i=0;i<DataTex::GlobalFilesDatabaseList.count();i++ ) {
    QTreeWidgetItem * item = new QTreeWidgetItem();
    item->setText(3,QFileInfo(DataTex::GlobalFilesDatabaseList.values().at(i).databaseName()).baseName());
  • DataTables::LoadFields
    fields.exec(SqlFunctions::Fields_Query);
    while(fields.next()){
    item++;
    ui->FieldTable->insertRow(item);
    ui->FieldTable->setItem(item,0 , new QTableWidgetItem(fields.value(0).toString()));
    ui->FieldTable->setItem(item,1 , new QTableWidgetItem(fields.value(1).toString()));
  • InfoPage constructor
    InfoPage::InfoPage(QWidget *parent)
    : QWizardPage(parent)
    {
    QSqlQuery DatabaseListQuery(DataTex::DataTeX_Settings);
    DatabaseListQuery.exec("SELECT FileName FROM Databases");
    while (DatabaseListQuery.next()) {
    DatabaseList.append(DatabaseListQuery.value(0).toString());
    }
    setTitle("Create new Database");
    setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/datatex.png"));
    QLabel *label = new QLabel(tr("This wizard will help you create a new LaTeX database for DataTex."));
    label->setWordWrap(true);
    QVBoxLayout *layout = new QVBoxLayout;
    QHBoxLayout *hlayout = new QHBoxLayout;
    QHBoxLayout *hlayout2 = new QHBoxLayout;
    QHBoxLayout *hlayout3 = new QHBoxLayout;
    BaseFolder::FilesDB = new QRadioButton(tr("Files Database"));
    BaseFolder::DocsDB = new QRadioButton(tr("Document Database"));
    QHBoxLayout * RadioLH = new QHBoxLayout;
  • LatexTextBrowser constructor
    LatexTextBrowser::LatexTextBrowser(QWidget *parent) :
    QTextEdit(parent)
    {
    Highlighter * h = new Highlighter();
    h->setDocument(LatexTextBrowser::document());

💭 I got the impression that such data would be required for safe management of parent-child relationships at more source code places.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions