mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 13:46:16 +00:00
cleanup: remove QPointer instances
QPointer is a strange "smart" pointer class, which resets itself when the pointed-to QObject is deleted. It does this by listening to the corresponding signal and therefore is surprisingly heavy for a plain pointer. A cynic would say that the existence of QPointer is an expression of Qt's broken ownership model. In any case, QPointer was only used at two places, were it was 100% useless: As a parameter to a function and as a locally scoped pointer. It only makes sense if a) there is a chance that the object disappears during the pointer's lifetime and b) it is actually checked for null before use None of which was the case here. Remove. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
fa6eb6144b
commit
dc37ba7758
3 changed files with 3 additions and 4 deletions
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include <QPointer>
|
|
||||||
#include <QtBluetooth/QBluetoothLocalDevice>
|
#include <QtBluetooth/QBluetoothLocalDevice>
|
||||||
#include <QtBluetooth/QBluetoothDeviceDiscoveryAgent>
|
#include <QtBluetooth/QBluetoothDeviceDiscoveryAgent>
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ Printer::~Printer()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Printer::putProfileImage(const QRect &profilePlaceholder, const QRect &viewPort, QPainter *painter,
|
void Printer::putProfileImage(const QRect &profilePlaceholder, const QRect &viewPort, QPainter *painter,
|
||||||
struct dive *dive, QPointer<ProfileWidget2> profile)
|
struct dive *dive, ProfileWidget2 *profile)
|
||||||
{
|
{
|
||||||
int x = profilePlaceholder.x() - viewPort.x();
|
int x = profilePlaceholder.x() - viewPort.x();
|
||||||
int y = profilePlaceholder.y() - viewPort.y();
|
int y = profilePlaceholder.y() - viewPort.y();
|
||||||
|
@ -125,7 +125,7 @@ void Printer::flowRender()
|
||||||
void Printer::render(int Pages = 0)
|
void Printer::render(int Pages = 0)
|
||||||
{
|
{
|
||||||
// keep original preferences
|
// keep original preferences
|
||||||
QPointer<ProfileWidget2> profile = MainWindow::instance()->graphics;
|
ProfileWidget2 *profile = MainWindow::instance()->graphics;
|
||||||
int profileFrameStyle = profile->frameStyle();
|
int profileFrameStyle = profile->frameStyle();
|
||||||
int animationOriginal = qPrefDisplay::animation_speed();
|
int animationOriginal = qPrefDisplay::animation_speed();
|
||||||
double fontScale = profile->getFontPrintScale();
|
double fontScale = profile->getFontPrintScale();
|
||||||
|
|
|
@ -32,7 +32,7 @@ private:
|
||||||
void render(int Pages);
|
void render(int Pages);
|
||||||
void flowRender();
|
void flowRender();
|
||||||
void putProfileImage(const QRect &box, const QRect &viewPort, QPainter *painter,
|
void putProfileImage(const QRect &box, const QRect &viewPort, QPainter *painter,
|
||||||
struct dive *dive, QPointer<ProfileWidget2> profile);
|
struct dive *dive, ProfileWidget2 *profile);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void templateProgessUpdated(int value);
|
void templateProgessUpdated(int value);
|
||||||
|
|
Loading…
Add table
Reference in a new issue