Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
KCalc
Commits
43ecc4cc
Commit
43ecc4cc
authored
Dec 29, 2021
by
Waqar Ahmed
Committed by
Albert Astals Cid
Jan 18, 2022
Browse files
Fix leaks
parent
611635b9
Pipeline
#125456
passed with stage
in 47 seconds
Changes
8
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
bitbutton.cpp
View file @
43ecc4cc
...
...
@@ -93,19 +93,16 @@ void BitButton::setOn(bool value)
//------------------------------------------------------------------------------
void
BitButton
::
setRenderSize
(
const
QSize
&
size
)
{
if
(
renderSize_
)
{
delete
renderSize_
;
}
renderSize_
=
new
QSize
(
size
);
renderSize_
=
size
;
}
//------------------------------------------------------------------------------
// Name: renderSize
// Desc: returns current render size
//------------------------------------------------------------------------------
const
QSize
&
BitButton
::
renderSize
()
const
QSize
BitButton
::
renderSize
()
const
{
return
*
renderSize_
;
return
renderSize_
;
}
//------------------------------------------------------------------------------
...
...
bitbutton.h
View file @
43ecc4cc
...
...
@@ -18,7 +18,7 @@ public:
Q_REQUIRED_RESULT
bool
isOn
()
const
;
void
setOn
(
bool
value
);
void
setRenderSize
(
const
QSize
&
size
);
const
QSize
&
renderSize
()
const
;
QSize
renderSize
()
const
;
protected:
void
paintEvent
(
QPaintEvent
*
event
)
override
;
...
...
@@ -32,6 +32,6 @@ private:
void
leaveEvent
(
QEvent
*
event
)
override
;
bool
on_
=
false
;
bool
over_
=
false
;
QSize
*
renderSize_
=
nullptr
;
QSize
renderSize_
;
};
kcalc.cpp
View file @
43ecc4cc
...
...
@@ -54,9 +54,6 @@ KCalculator::KCalculator(QWidget *parent)
,
memory_num_
(
0.0
)
,
core
()
{
// initialize pointers
baseFont_
=
nullptr
;
// central widget to contain all the elements
auto
const
central
=
new
QWidget
(
this
);
central
->
setLayoutDirection
(
Qt
::
LeftToRight
);
...
...
@@ -2584,10 +2581,7 @@ void KCalculator::setFonts()
void
KCalculator
::
setBaseFont
(
const
QFont
&
font
)
{
// Overwrite current baseFont
if
(
baseFont_
)
{
delete
baseFont_
;
}
baseFont_
=
new
QFont
(
font
);
baseFont_
=
font
;
}
//------------------------------------------------------------------------------
...
...
@@ -2596,7 +2590,7 @@ void KCalculator::setBaseFont(const QFont &font)
//------------------------------------------------------------------------------
const
QFont
&
KCalculator
::
baseFont
()
const
{
return
*
baseFont_
;
return
baseFont_
;
}
//------------------------------------------------------------------------------
...
...
kcalc.h
View file @
43ecc4cc
...
...
@@ -272,8 +272,8 @@ private:
QList
<
QAbstractButton
*>
stat_button_list_
;
QList
<
QAbstractButton
*>
mem_button_list_
;
QList
<
QAbstractButton
*>
operation_button_list_
;
QFont
*
baseFont_
;
QFont
baseFont_
;
bool
is_still_in_launch_
=
true
;
// necessary for startup at minimum size
CalcEngine
core
;
...
...
kcalcdisplay.cpp
View file @
43ecc4cc
...
...
@@ -603,11 +603,7 @@ void KCalcDisplay::setText(const QString &string)
void
KCalcDisplay
::
setFont
(
const
QFont
&
font
)
{
// Overwrite current baseFont
if
(
baseFont_
)
{
delete
baseFont_
;
}
baseFont_
=
new
QFont
(
font
);
baseFont_
=
font
;
updateFont
();
}
...
...
@@ -637,7 +633,7 @@ void KCalcDisplay::updateFont()
//------------------------------------------------------------------------------
const
QFont
&
KCalcDisplay
::
baseFont
()
const
{
return
*
baseFont_
;
return
baseFont_
;
}
//------------------------------------------------------------------------------
...
...
kcalcdisplay.h
View file @
43ecc4cc
...
...
@@ -121,8 +121,8 @@ private:
int
fixed_precision_
;
// "-1" = no fixed_precision
KNumber
display_amount_
;
QFont
*
baseFont_
=
nullptr
;
QFont
baseFont_
;
QVector
<
KNumber
>
history_list_
;
int
history_index_
;
...
...
kcalchistory.cpp
View file @
43ecc4cc
...
...
@@ -146,11 +146,7 @@ void KCalcHistory::changeSettings()
void
KCalcHistory
::
setFont
(
const
QFont
&
font
)
{
// Overwrite current baseFont
if
(
baseFont_
)
{
delete
baseFont_
;
}
baseFont_
=
new
QFont
(
font
);
baseFont_
=
font
;
updateFont
();
}
...
...
@@ -181,7 +177,7 @@ void KCalcHistory::updateFont(double zoomFactor)
//------------------------------------------------------------------------------
const
QFont
&
KCalcHistory
::
baseFont
()
const
{
return
*
baseFont_
;
return
baseFont_
;
}
//------------------------------------------------------------------------------
...
...
kcalchistory.h
View file @
43ecc4cc
...
...
@@ -40,7 +40,7 @@ protected:
private:
bool
add_new_line_
=
false
;
QFont
*
baseFont_
=
nullptr
;
QFont
baseFont_
;
double
idealPointSizeF_
;
void
updateFont
(
double
zoomFactor
=
1.0
);
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment