diff options
author | Timothy Pearson <[email protected]> | 2012-11-01 22:54:34 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-11-01 22:54:34 -0500 |
commit | 7e54430051de46008830a2b837ff26cf81a9503f (patch) | |
tree | 3a70acbc902e7d0007a398b9f0696c90bc6b0f2f /style/lipstik.cpp | |
parent | fad7c06d70b0a62894e706c9a1a9859bceca8d61 (diff) | |
download | tde-style-lipstik-7e54430051de46008830a2b837ff26cf81a9503f.tar.gz tde-style-lipstik-7e54430051de46008830a2b837ff26cf81a9503f.zip |
Resolve potential crashes
Diffstat (limited to 'style/lipstik.cpp')
-rw-r--r-- | style/lipstik.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/style/lipstik.cpp b/style/lipstik.cpp index 64ac986..b5d581d 100644 --- a/style/lipstik.cpp +++ b/style/lipstik.cpp @@ -1308,8 +1308,7 @@ void LipstikStyle::drawKStylePrimitive(KStylePrimitive kpe, // ------ switch( kpe ) { case KPE_SliderGroove: { - const TQSlider* slider = (const TQSlider*)widget; - bool horizontal = slider->orientation() ==Qt::Horizontal; + bool horizontal = ceData.orientation == TQt::Horizontal; if (horizontal) { int center = r.y()+r.height()/2; @@ -1326,8 +1325,7 @@ void LipstikStyle::drawKStylePrimitive(KStylePrimitive kpe, } case KPE_SliderHandle: { - const TQSlider* slider = (const TQSlider*)widget; - bool horizontal = slider->orientation() ==Qt::Horizontal; + bool horizontal = ceData.orientation == TQt::Horizontal; const bool pressed = (flags&Style_Active); const WidgetState s = enabled?(pressed?IsPressed:IsEnabled):IsDisabled; @@ -2516,15 +2514,14 @@ void LipstikStyle::drawControl(ControlElement element, } case CE_ProgressBarContents: { - const TQProgressBar *pb = dynamic_cast<const TQProgressBar*>(widget); - int steps = pb->totalSteps(); + int steps = ceData.totalSteps; const TQColor bg = enabled?cg.base():cg.background(); // background const TQColor fg = enabled?cg.highlight():TQColor(cg.background().dark(110)); // foreground if( steps == 0 ) { // Busy indicator static const int barWidth = 10; - int progress = pb->progress() % (2*(r.width()-barWidth)); + int progress = ceData.currentStep % (2*(r.width()-barWidth)); if( progress < 0) progress = 0; if( progress > r.width()-barWidth ) @@ -2541,7 +2538,7 @@ void LipstikStyle::drawControl(ControlElement element, Round_UpperRight|Round_BottomRight| Round_UpperLeft|Round_BottomLeft|Is_Horizontal); } else { - double percent = static_cast<double>(pb->progress()) / static_cast<double>(steps); + double percent = static_cast<double>(ceData.currentStep) / static_cast<double>(steps); int w = static_cast<int>(r.width() * percent); // renderContour/renderSurface handle small sizes not very well, so set a minimal |