mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: make templateOptions and printOptions reference types
These two structs describe options used during printing. They are passed through numerous classes as pointer. In this case, reference semantics are preferred, as references: - can never be null - can not change during their lifetime This not only helps the compiler, as it can optimize away null checks, but also your fellow coder. Moreover, it prevents unintentional creation of uninitialized references: one can't create an instance of a class without initializing a reference member. It does not prevent references from going dangling. However, pointers have the same disadvantage. Contains a few whitespace cleanups. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
7bdd968e05
commit
0cbb448740
9 changed files with 97 additions and 111 deletions
|
@ -87,7 +87,7 @@ PrintDialog::PrintDialog(QWidget *parent) :
|
|||
}
|
||||
|
||||
// create a print options object and pass our options struct
|
||||
optionsWidget = new PrintOptions(this, &printOptions, &templateOptions);
|
||||
optionsWidget = new PrintOptions(this, printOptions, templateOptions);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
|
@ -175,7 +175,7 @@ void PrintDialog::createPrinterObj()
|
|||
qprinter = new QPrinter();
|
||||
qprinter->setResolution(printOptions.resolution);
|
||||
qprinter->setOrientation((QPrinter::Orientation)printOptions.landscape);
|
||||
printer = new Printer(qprinter, &printOptions, &templateOptions, Printer::PRINT);
|
||||
printer = new Printer(qprinter, printOptions, templateOptions, Printer::PRINT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue