Skip to content

Commit

Permalink
Merge pull request #303 from AntonioBL/fix_possible_access_violation
Browse files Browse the repository at this point in the history
fix #20823: Possible access violation
  • Loading branch information
wschweer committed Apr 22, 2013
2 parents 2de5cf3 + 9c35d40 commit dc46fde
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions mstyle/mstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,31 +1773,33 @@ bool MgStyle::drawPanelButtonToolPrimitive( const QStyleOption* option, QPainter
QRect r( option->rect );

// adjust rect depending on shape
const QTabBar* tabBar( static_cast<const QTabBar*>( widget->parent() ) );
switch ( tabBar->shape() ) {
case QTabBar::RoundedNorth:
case QTabBar::TriangularNorth:
r.setBottom( r.bottom() - 6 );
break;

case QTabBar::RoundedSouth:
case QTabBar::TriangularSouth:
r.setTop( r.top() + 6 );
break;

case QTabBar::RoundedWest:
case QTabBar::TriangularWest:
r.setRight( r.right() - 6 );
break;

case QTabBar::RoundedEast:
case QTabBar::TriangularEast:
r.setLeft( r.left() + 6 );
break;

default:
break;
if (qobject_cast<const QTabBar*>( widget->parent())) {
const QTabBar* tabBar( static_cast<const QTabBar*>( widget->parent() ) );
switch ( tabBar->shape() ) {
case QTabBar::RoundedNorth:
case QTabBar::TriangularNorth:
r.setBottom( r.bottom() - 6 );
break;

case QTabBar::RoundedSouth:
case QTabBar::TriangularSouth:
r.setTop( r.top() + 6 );
break;

case QTabBar::RoundedWest:
case QTabBar::TriangularWest:
r.setRight( r.right() - 6 );
break;

case QTabBar::RoundedEast:
case QTabBar::TriangularEast:
r.setLeft( r.left() + 6 );
break;

default:
break;

}
}

const QPalette local(widget->parentWidget() ? widget->parentWidget()->palette() : palette);
Expand Down

0 comments on commit dc46fde

Please sign in to comment.