-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <QSlider>
#include <QMainWindow>
#include <QPixmapCache>
-
-#include <limits.h>
+#include <QTileRules>
#define SHADOW 1
#define LINE_GR_MARGIN 10
Use Style_Salome::apply() static function to set SALOME style to the application.
*/
-Style_Salome::Style_Salome()
- : QWindowsStyle()
+Style_Salome::Style_Salome() : BaseStyle()
{
// initialize SALOME style resources
Q_INIT_RESOURCE( Style );
*/
void Style_Salome::polish ( QApplication* app )
{
- QWindowsStyle::polish( app );
-
+ BaseStyle::polish( app );
+
if ( checkDebugLevel(1) ) {
return;
}
void Style_Salome::polish ( QWidget* w )
{
if ( checkDebugLevel(2) ) {
- QWindowsStyle::polish( w );
+ BaseStyle::polish( w );
return;
}
qobject_cast<QMenuBar*>(w) || qobject_cast<QDockWidget*>(w) )
w->setAttribute( Qt::WA_Hover );
}
-
- QWindowsStyle::polish( w );
+ BaseStyle::polish( w );
}
/*!
void Style_Salome::unpolish( QWidget* w )
{
if ( checkDebugLevel(3) ) {
- QWindowsStyle::unpolish( w );
+ BaseStyle::unpolish( w );
return;
}
qobject_cast<QMenuBar*>(w) || qobject_cast<QDockWidget*>(w) )
w->setAttribute( Qt::WA_Hover, false );
}
-
- QWindowsStyle::unpolish( w );
+ BaseStyle::unpolish( w );
}
/*!
QPainter* p, const QWidget* w ) const
{
if ( checkDebugLevel(4) ) {
- QWindowsStyle::drawComplexControl( cc, opt, p, w );
+ BaseStyle::drawComplexControl( cc, opt, p, w );
return;
}
if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
QStyleOptionSlider tmpSlider = *slider;
tmpSlider.subControls = SC_SliderGroove;
- QWindowsStyle::drawComplexControl(cc, &tmpSlider, p, w);
+ BaseStyle::drawComplexControl(cc, &tmpSlider, p, w);
}
if (slider->subControls & SC_SliderTickmarks) {
QStyleOptionSlider tmpSlider = *slider;
if (w && ( qobject_cast<QToolBar *>(w->parentWidget() ) ||
( toolbutton->state & State_AutoRaise && !( toolbutton->state & State_MouseOver ) ) )
) {
- QWindowsStyle::drawComplexControl( cc, opt, p, w );
+ BaseStyle::drawComplexControl( cc, opt, p, w );
return;
}
int aMinDelta = (int)model()->widgetRounding( Style_Model::ButtonRadius );
}
}
case CC_TitleBar: {
- QWindowsStyle::drawComplexControl( cc, opt, p, w );
+ BaseStyle::drawComplexControl( cc, opt, p, w );
break;
}
case CC_GroupBox:
break;
}
case CC_Dial: {
- QWindowsStyle::drawComplexControl( cc, opt, p, w );
+ BaseStyle::drawComplexControl( cc, opt, p, w );
break;
}
default:
- QWindowsStyle::drawComplexControl( cc, opt, p, w );
+ BaseStyle::drawComplexControl( cc, opt, p, w );
}
}
void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt,
QPainter* p, const QWidget* w ) const
{
- if ( checkDebugLevel(5) ) {
- QWindowsStyle::drawControl( ce, opt, p, w );
+ if ( checkDebugLevel(5) ) {
+ BaseStyle::drawControl( ce, opt, p, w );
return;
}
break;
}
case CE_Splitter: {
- QWindowsStyle::drawControl( ce, opt, p, w );
+ BaseStyle::drawControl( ce, opt, p, w );
QRect r = opt->rect;
bool horiz = r.width() > r.height();
int aLen = model()->splitHandleLength();
aBrdTopCol, aBrdBotCol, isSelected, isLast, isHover );
p->restore();
} else
- QCommonStyle::drawControl(ce, opt, p, w);
+ QCommonStyle::drawControl( ce, opt, p, w );
break;
}
case CE_TabBarTabLabel:
}
QStyleOptionTab* copyTab = (QStyleOptionTab*)tab;
copyTab->rect = oldRect;
- QWindowsStyle::drawControl( ce, copyTab, p, w );
+ BaseStyle::drawControl( ce, copyTab, p, w );
}
else
- QWindowsStyle::drawControl( ce, opt, p, w );
+ BaseStyle::drawControl( ce, opt, p, w );
break;
}
case CE_MenuBarItem:
break;
}
default:
- QWindowsStyle::drawControl( ce, opt, p, w );
+ BaseStyle::drawControl( ce, opt, p, w );
break;
}
}
QPainter* p, const QWidget* w ) const
{
if ( checkDebugLevel(6) ) {
- QWindowsStyle::drawPrimitive( pe, opt, p, w );
+ BaseStyle::drawPrimitive( pe, opt, p, w );
return;
}
break;
}
else
- QWindowsStyle::drawPrimitive( pe, opt, p, w );
+ BaseStyle::drawPrimitive( pe, opt, p, w );
}
break;
case PE_FrameFocusRect: {
aBrdTopCol, aBrdBotCol, false, false, isHover, true );
}
else {
- QWindowsStyle::drawPrimitive( pe, opt, p, w );
+ BaseStyle::drawPrimitive( pe, opt, p, w );
}
break;
}
p->setPen(opt->palette.text().color());
} // Fall through!
case PE_IndicatorViewItemCheck:
- case PE_Q3CheckListIndicator: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ case PE_Q3CheckListIndicator:
+#endif
+ {
if (!doRestore) {
p->save();
doRestore = true;
break;
}
case PE_Widget: {
- QWindowsStyle::drawPrimitive( pe, opt, p, w );
+ BaseStyle::drawPrimitive( pe, opt, p, w );
+
if ( !w )
break;
if( w->parent() && !qobject_cast<QMenuBar*>((QWidget*)w) )
= qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
if (tbb->shape != QTabBar::RoundedNorth && tbb->shape != QTabBar::RoundedEast &&
tbb->shape != QTabBar::RoundedSouth && tbb->shape != QTabBar::RoundedWest) {
- QWindowsStyle::drawPrimitive( pe, opt, p, w );
+ BaseStyle::drawPrimitive( pe, opt, p, w );
break;
}
QRect aSelRect = tbb->selectedTabRect;
aPal.setBrush( QPalette::AlternateBase, QBrush( gr_alt ) );
aWdg->setPalette( aPal );
}
- QWindowsStyle::drawPrimitive( pe, opt, p, w );
+ BaseStyle::drawPrimitive( pe, opt, p, w );
break;
}
default:
- QWindowsStyle::drawPrimitive( pe, opt, p, w );
+ BaseStyle::drawPrimitive( pe, opt, p, w );
}
}
const QWidget* w ) const
{
if ( checkDebugLevel(7) ) {
- return QWindowsStyle::pixelMetric( metric, opt, w );
+ return BaseStyle::pixelMetric( metric, opt, w );
}
-
- int aRes = QWindowsStyle::pixelMetric( metric, opt, w );
+ int aRes = BaseStyle::pixelMetric( metric, opt, w );
switch( metric ) {
case PM_SliderLength: {
aRes += (int)((double)model()->sliderSize()/2);
const QSize& contentsSize, const QWidget* w ) const
{
if ( checkDebugLevel(8) ) {
- return QWindowsStyle::sizeFromContents( ct, opt,contentsSize, w );
+ return BaseStyle::sizeFromContents( ct, opt,contentsSize, w );
}
-
- QSize sz = QWindowsStyle::sizeFromContents( ct, opt, contentsSize, w );
+ QSize sz = BaseStyle::sizeFromContents( ct, opt, contentsSize, w );
switch (ct) {
case CT_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
QRect res = QRect( 0, 0, sz.width(), sz.height() );
int aHalfRect = (int)Style_Tools::getMaxRect( res,
(int)model()->widgetRounding( Style_Model::EditRadius )/2 ); // left value
- QRect old_arrow = QWindowsStyle::subControlRect( CC_ComboBox, cmb,
+
+ QRect old_arrow = BaseStyle::subControlRect( CC_ComboBox, cmb,
SC_ComboBoxArrow, w );
int aDelta = res.height() - old_arrow.width(); // right value
if ( cmb->editable )
const QWidget *w) const
{
if ( checkDebugLevel(9) ) {
- return QWindowsStyle::standardPixmap( stPixmap, opt, w );
+ return BaseStyle::standardPixmap( stPixmap, opt, w );
}
switch ( stPixmap )
case SP_TitleBarMinButton:
return QPixmap( minimize_xpm );
default:
- return QWindowsStyle::standardPixmap( stPixmap, opt, w );
+ return BaseStyle::standardPixmap( stPixmap, opt, w );
}
}
const QWidget* w ) const
{
if ( checkDebugLevel(10) ) {
- return QWindowsStyle::standardIconImplementation( standardIcon, opt, w );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return BaseStyle::standardIconImplementation( standardIcon, opt, w );
+#else
+ return QCommonStyle::standardIcon( standardIcon, opt, w );
+#endif
}
switch ( standardIcon )
default:
break;
}
- return QWindowsStyle::standardIconImplementation( standardIcon, opt, w );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return BaseStyle::standardIconImplementation( standardIcon, opt, w );
+#else
+ return BaseStyle::standardIcon( standardIcon, opt, w );
+#endif
}
/*!
QStyleHintReturn* returnData ) const
{
if ( checkDebugLevel(11) ) {
- return QWindowsStyle::styleHint( hint, opt, w, returnData );
+ return BaseStyle::styleHint( hint, opt, w, returnData );
}
-
- int aRes = QWindowsStyle::styleHint( hint, opt, w, returnData );
+ int aRes = BaseStyle::styleHint( hint, opt, w, returnData );
switch( hint ) {
case SH_Table_GridLineColor: {
if ( opt )
SubControl sc, const QWidget* wid ) const
{
if ( checkDebugLevel(12) ) {
- return QWindowsStyle::subControlRect( cc, opt, sc, wid );
+ return BaseStyle::subControlRect( cc, opt, sc, wid );
}
-
- QRect res = QWindowsStyle::subControlRect( cc, opt, sc, wid );
+ QRect res = BaseStyle::subControlRect( cc, opt, sc, wid );
switch ( cc ) {
case CC_SpinBox: {
int x = res.x(), w = res.width(), h = res.height();
if ( sc==SC_SpinBoxUp || sc==SC_SpinBoxDown ) {
- QRect frame_r = QWindowsStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid );
+ QRect frame_r = BaseStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid );
h = frame_r.height();
res.setX( x+w-h );
res.setWidth( h );
}
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- QRect slider_r = QWindowsStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid );
+ QRect slider_r = BaseStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid );
int aRect = Style_Tools::getMaxRect( slider_r, (int)model()->widgetRounding( Style_Model::ButtonRadius ) );
switch( sc ) {
case SC_ScrollBarSubPage: // between top/left button and slider
const QWidget* wid ) const
{
if ( checkDebugLevel(13) ) {
- return QWindowsStyle::subElementRect( se, opt, wid );
+ return BaseStyle::subElementRect( se, opt, wid );
}
- QRect res = QWindowsStyle::subElementRect( se, opt, wid );
+ QRect res = BaseStyle::subElementRect( se, opt, wid );
int aHalfRect = (int)Style_Tools::getMaxRect( res, (int)model()->widgetRounding( Style_Model::EditRadius )/2 );
int w = res.width(), h = res.height();
switch ( se ) {
case SE_ComboBoxFocusRect: {
- QRect old_r = QWindowsStyle::subControlRect( CC_ComboBox,
+
+ QRect old_r = BaseStyle::subControlRect( CC_ComboBox,
qstyleoption_cast<const QStyleOptionComplex*>( opt ),
SC_ComboBoxArrow, wid );
int old_w = old_r.width();