From c22c687fa68b7be95f83900c364823318b27dd4e Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 25 Nov 2016 23:31:33 +0000 Subject: [PATCH] kstyles: remove Q3 support code from Oxygen Signed-off-by: Ivailo Monev --- kstyles/oxygen/oxygenframeshadow.cpp | 2 - kstyles/oxygen/oxygenshadowhelper.cpp | 2 +- kstyles/oxygen/oxygenstyle.cpp | 130 +--------------------------------- kstyles/oxygen/oxygenstyle.h | 4 -- 4 files changed, 3 insertions(+), 135 deletions(-) diff --git a/kstyles/oxygen/oxygenframeshadow.cpp b/kstyles/oxygen/oxygenframeshadow.cpp index 65e5ba62..f3fed7b6 100644 --- a/kstyles/oxygen/oxygenframeshadow.cpp +++ b/kstyles/oxygen/oxygenframeshadow.cpp @@ -268,8 +268,6 @@ namespace Oxygen // grab viewport widget QWidget *viewport( FrameShadowBase::viewport() ); - if( !viewport && parentWidget() && parentWidget()->inherits( "Q3ListView" ) ) - { viewport = parentWidget(); } // set cursor from viewport if (viewport) setCursor(viewport->cursor()); diff --git a/kstyles/oxygen/oxygenshadowhelper.cpp b/kstyles/oxygen/oxygenshadowhelper.cpp index c85c1424..b225bd5b 100644 --- a/kstyles/oxygen/oxygenshadowhelper.cpp +++ b/kstyles/oxygen/oxygenshadowhelper.cpp @@ -209,7 +209,7 @@ namespace Oxygen //_______________________________________________________ bool ShadowHelper::isToolBar( QWidget* widget ) const - { return qobject_cast( widget ) || widget->inherits( "Q3ToolBar" ); } + { return qobject_cast( widget ); } //_______________________________________________________ bool ShadowHelper::acceptWidget( QWidget* widget ) const diff --git a/kstyles/oxygen/oxygenstyle.cpp b/kstyles/oxygen/oxygenstyle.cpp index f20f7f6c..f4139409 100644 --- a/kstyles/oxygen/oxygenstyle.cpp +++ b/kstyles/oxygen/oxygenstyle.cpp @@ -81,7 +81,7 @@ #include #include #include -#include +#include #include #include #include @@ -214,11 +214,6 @@ namespace Oxygen polishScrollArea( scrollArea ); - } else if( widget->inherits( "Q3ListView" ) ) { - - addEventFilter( widget ); - widget->setAttribute( Qt::WA_Hover ); - } // several widgets set autofill background to false, which effectively breaks the background @@ -365,7 +360,7 @@ namespace Oxygen // with ( usually sunken ) neighbor frames widget->setContentsMargins( 1, 1, 1, 1 ); - } else if( widget->inherits( "Q3ToolBar" ) || qobject_cast( widget ) ) { + } else if( qobject_cast( widget ) ) { widget->setBackgroundRole( QPalette::NoRole ); addEventFilter( widget ); @@ -449,13 +444,6 @@ namespace Oxygen if( isKTextEditFrame( widget ) ) { widget->setAttribute( Qt::WA_Hover, false ); } - if( widget && widget->inherits( "Q3ListView" ) ) { - - widget->removeEventFilter( this ); - widget->setAttribute( Qt::WA_Hover, false ); - - } - // event filters switch ( widget->windowFlags() & Qt::WindowType_Mask ) { @@ -505,7 +493,6 @@ namespace Oxygen } if( qobject_cast( widget ) - || ( widget && widget->inherits( "Q3ToolBar" ) ) || qobject_cast( widget ) || ( widget && qobject_cast( widget->parent() ) ) || qobject_cast( widget ) ) @@ -1031,10 +1018,6 @@ namespace Oxygen case PE_PanelTipLabel: fcn = &Style::drawPanelTipLabelPrimitive; break; case PE_IndicatorMenuCheckMark: fcn = &Style::drawIndicatorMenuCheckMarkPrimitive; break; -#ifndef QT_KATIE - case PE_Q3CheckListIndicator: fcn = &Style::drawQ3CheckListIndicatorPrimitive; break; - case PE_Q3CheckListExclusiveIndicator: fcn = &Style::drawQ3CheckListExclusiveIndicatorPrimitive; break; -#endif case PE_IndicatorBranch: fcn = &Style::drawIndicatorBranchPrimitive; break; case PE_IndicatorButtonDropDown: fcn = &Style::drawIndicatorButtonDropDownPrimitive; break; case PE_IndicatorCheckBox: fcn = &Style::drawIndicatorCheckBoxPrimitive; break; @@ -1136,9 +1119,6 @@ namespace Oxygen case CC_ComboBox: fcn = &Style::drawComboBoxComplexControl; break; case CC_Dial: fcn = &Style::drawDialComplexControl; break; case CC_GroupBox: fcn = &Style::drawGroupBoxComplexControl; break; -#ifndef QT_KATIE - case CC_Q3ListView: fcn = &Style::drawQ3ListViewComplexControl; break; -#endif case CC_Slider: fcn = &Style::drawSliderComplexControl; break; case CC_SpinBox: fcn = &Style::drawSpinBoxComplexControl; break; case CC_TitleBar: fcn = &Style::drawTitleBarComplexControl; break; @@ -1187,7 +1167,6 @@ namespace Oxygen // cast to QWidget QWidget *widget = static_cast( object ); - if( widget->inherits( "Q3ListView" ) ) { return eventFilterQ3ListView( widget, event ); } if( widget->inherits( "QComboBoxPrivateContainer" ) ) { return eventFilterComboBoxContainer( widget, event ); } return QCommonStyle::eventFilter( object, event ); @@ -1328,20 +1307,6 @@ namespace Oxygen } - //__________________________________________________________________________________ - bool Style::eventFilterQ3ListView( QWidget* widget, QEvent* event ) - { - // this apparently fixes a Qt bug with Q3ListView, consisting in - // the fact that Focus events do not trigger repaint of these - switch( event->type() ) - { - case QEvent::FocusIn: widget->update(); return false; - case QEvent::FocusOut: widget->update(); return false; - default: return false; - } - - } - //_________________________________________________________ bool Style::eventFilterScrollBar( QWidget* widget, QEvent* event ) { @@ -3376,38 +3341,6 @@ namespace Oxygen } -#ifndef QT_KATIE - //___________________________________________________________________________________ - bool Style::drawQ3CheckListIndicatorPrimitive( const QStyleOption *option, QPainter *painter, const QWidget *widget ) const - { - const QStyleOptionQ3ListView* listViewOpt( qstyleoption_cast( option ) ); - if( !listViewOpt || listViewOpt->items.isEmpty() ) return true; - - QStyleOptionButton buttonOption; - buttonOption.QStyleOption::operator=( *option ); - - QSize size( CheckBox_Size, CheckBox_Size ); - buttonOption.rect = centerRect( option->rect, size ).translated( 0, 4 ); - drawIndicatorCheckBoxPrimitive( &buttonOption, painter, widget ); - return true; - } - - //___________________________________________________________________________________ - bool Style::drawQ3CheckListExclusiveIndicatorPrimitive( const QStyleOption *option, QPainter *painter, const QWidget *widget ) const - { - const QStyleOptionQ3ListView* listViewOpt( qstyleoption_cast( option ) ); - if( !listViewOpt || listViewOpt->items.isEmpty() ) return true; - - QStyleOptionButton buttonOption; - buttonOption.QStyleOption::operator=( *option ); - - QSize size( CheckBox_Size, CheckBox_Size ); - buttonOption.rect = centerRect( option->rect, size ).translated( 0, 4 ); - drawIndicatorRadioButtonPrimitive( &buttonOption, painter, widget ); - return true; - } -#endif // QT_KATIE - //___________________________________________________________________________________ bool Style::drawIndicatorBranchPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* ) const { @@ -7102,65 +7035,6 @@ namespace Oxygen } else return false; } -#ifndef QT_KATIE - //______________________________________________________________ - bool Style::drawQ3ListViewComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const - { - - const QStyleOptionQ3ListView* optListView( qstyleoption_cast( option ) ); - if( !optListView ) return true; - - // this is copied from skulpture code - // Copyright ( c ) 2007-2010 Christoph Feck - if( optListView->subControls & QStyle::SC_Q3ListView ) - { - painter->fillRect( - optListView->rect, - optListView->viewportPalette.brush( optListView->viewportBGRole ) ); - } - - if( optListView->subControls & QStyle::SC_Q3ListViewBranch ) - { - - QStyleOption opt = *static_cast( option ); - int y = optListView->rect.y(); - - for ( int i = 1; i < optListView->items.size(); ++i ) - { - QStyleOptionQ3ListViewItem item = optListView->items.at( i ); - if( y + item.totalHeight > 0 && y < optListView->rect.height() ) - { - opt.state = QStyle::State_Item; - if ( i + 1 < optListView->items.size() ) - { opt.state |= QStyle::State_Sibling; } - - if( - item.features & QStyleOptionQ3ListViewItem::Expandable - || ( item.childCount > 0 && item.height > 0 ) ) - { opt.state |= QStyle::State_Children | ( item.state & QStyle::State_Open ); } - - opt.rect = QRect( optListView->rect.left(), y, optListView->rect.width(), item.height ); - drawIndicatorBranchPrimitive( &opt, painter, widget ); - - if( ( opt.state & QStyle::State_Sibling ) && item.height < item.totalHeight ) - { - opt.state = QStyle::State_Sibling; - opt.rect = QRect( - optListView->rect.left(), y + item.height, - optListView->rect.width(), item.totalHeight - item.height ); - drawIndicatorBranchPrimitive( &opt, painter, widget ); - } - } - - y += item.totalHeight; - } - } - - return true; - - } -#endif // QT_KATIE - //______________________________________________________________ bool Style::drawSliderComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { diff --git a/kstyles/oxygen/oxygenstyle.h b/kstyles/oxygen/oxygenstyle.h index 60587dfa..ffe33fdd 100644 --- a/kstyles/oxygen/oxygenstyle.h +++ b/kstyles/oxygen/oxygenstyle.h @@ -173,7 +173,6 @@ namespace Oxygen bool eventFilterComboBoxContainer( QWidget*, QEvent* ); bool eventFilterDockWidget( QDockWidget*, QEvent* ); bool eventFilterMdiSubWindow( QMdiSubWindow*, QEvent* ); - bool eventFilterQ3ListView( QWidget*, QEvent* ); bool eventFilterScrollBar( QWidget*, QEvent* ); bool eventFilterTabBar( QWidget*, QEvent* ); bool eventFilterToolBar( QToolBar*, QEvent* ); @@ -515,8 +514,6 @@ namespace Oxygen bool drawPanelItemViewItemPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const; bool drawPanelLineEditPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const; bool drawIndicatorMenuCheckMarkPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const; - bool drawQ3CheckListIndicatorPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const; - bool drawQ3CheckListExclusiveIndicatorPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const; bool drawIndicatorBranchPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const; bool drawIndicatorButtonDropDownPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const; bool drawIndicatorCheckBoxPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const; @@ -590,7 +587,6 @@ namespace Oxygen bool drawComboBoxComplexControl( const QStyleOptionComplex*, QPainter*, const QWidget* ) const; bool drawDialComplexControl( const QStyleOptionComplex*, QPainter*, const QWidget* ) const; bool drawGroupBoxComplexControl( const QStyleOptionComplex*, QPainter*, const QWidget* ) const; - bool drawQ3ListViewComplexControl( const QStyleOptionComplex*, QPainter*, const QWidget* ) const; bool drawSliderComplexControl( const QStyleOptionComplex*, QPainter*, const QWidget* ) const; bool drawSpinBoxComplexControl( const QStyleOptionComplex*, QPainter*, const QWidget* ) const; bool drawTitleBarComplexControl( const QStyleOptionComplex*, QPainter*, const QWidget* ) const; -- 2.11.0