Style_Salome::Style_Salome()
: QWindowsStyle()
{
+ //Q_INIT_RESOURCE(Style);
+
myModel = new Style_Model();
myModel->setDefaults( qApp );
pe = (spin->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
: PE_IndicatorSpinUp);
copy.rect = aBtnRect;
- drawPrimitive(PE_IndicatorSpinUp, ©, p, w);
+ drawPrimitive(pe, ©, p, w);
}
if (spin->subControls & SC_SpinBoxDown) {
copy.subControls = SC_SpinBoxDown;
}
}
break;
- case CE_ToolBoxTab:
- QCommonStyle::drawControl( ce, opt, p, w );
- break;
case CE_HeaderSection: {
bool aStateOn = opt->state & State_On;
QColor aColor = getColor( Style_Model::header_clr );
break;
}
default:
- QWindowsStyle::drawControl( ce, opt, p, w );
- break;
+ QWindowsStyle::drawControl( ce, opt, p, w );
}
}
void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
- QPainter* p, const QWidget* w ) const
+ QPainter* p, const QWidget* w ) const
{
const QPalette& pal = opt->palette;
bool doRestore = false;
case PE_IndicatorArrowUp:
case PE_IndicatorArrowDown:
case PE_IndicatorSpinUp:
- case PE_IndicatorSpinDown: {
+ case PE_IndicatorSpinDown:
+ case PE_IndicatorSpinPlus:
+ case PE_IndicatorSpinMinus: {
QRect rect = opt->rect;
QColor pen, brush;
if ( opt->state & State_Enabled ) {
pen = opt->palette.mid().color();
brush = pen;
}
- Style_Tools::drawArrow( pe, p, rect, pen, brush );
+ if ( pe == PE_IndicatorSpinPlus || pe == PE_IndicatorSpinMinus )
+ Style_Tools::drawSign( pe, p, rect, pen, brush );
+ else
+ Style_Tools::drawArrow( pe, p, rect, pen, brush );
break;
}
case PE_IndicatorCheckBox: {
QBrush fill;
if (opt->state & State_NoChange)
fill = QBrush( opt->palette.color( QPalette::Base ), Qt::Dense4Pattern);
- else if (opt->state & ( State_Sunken | !State_Enabled ) )
+ else if (opt->state & ( State_Sunken | ~State_Enabled ) )
fill = opt->palette.color( QPalette::Window );
else if (opt->state & State_Enabled) {
if (!(opt->state & State_Off) )
p->save();
doRestore = true;
}
- if (pe == PE_Q3CheckListIndicator || pe == PE_IndicatorViewItemCheck) {
- const QStyleOptionViewItem *itemViewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt);
- p->setPen(itemViewOpt && itemViewOpt->showDecorationSelected
- && opt->state & State_Selected ? opt->palette.highlightedText().color()
- : opt->palette.text().color());
- if (opt->state & State_NoChange)
- p->setBrush( opt->palette.color( QPalette::Button ) );
- p->drawRect(opt->rect.x() + 1, opt->rect.y() + 1, 11, 11);
- }
+ const QStyleOptionViewItem *itemViewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt);
+ p->setPen(itemViewOpt && itemViewOpt->showDecorationSelected
+ && opt->state & State_Selected ? opt->palette.highlightedText().color()
+ : opt->palette.text().color());
+ if (opt->state & State_NoChange)
+ p->setBrush( opt->palette.color( QPalette::Button ) );
+ p->drawRect(opt->rect.x() + 1, opt->rect.y() + 1, 11, 11);
if (!(opt->state & State_Off)) {
QLineF lines[11];
int i, xx, yy;
QColor aColor = getColor( Style_Model::pointer_clr );
if ( !(opt->state & State_Enabled ) )
aColor = opt->palette.mid().color();
- if ( opt->state & State_Selected )
+ if ( opt->state & State_Selected && itemViewOpt && itemViewOpt->showDecorationSelected )
aColor = opt->palette.highlightedText().color();
p->setPen( QPen( aColor ) );
drawHoverRect(p, opt->rect, opt->palette.color( QPalette::Window ), aRad, Style_Tools::All, true);
else {
Style_Tools::shadowRect( p, opt->rect, aRad, LINE_GR_MARGIN, SHADOW,
- Style_Tools::All, opt->palette.color( QPalette::Base ), //, getColor( Style_Model::fld_light_clr ),
+ Style_Tools::All, opt->palette.color( QPalette::Base ), // getColor( Style_Model::fld_light_clr ),
getColor( Style_Model::fld_dark_clr ), aBrdTopCol, aBrdBotCol,
getBoolValue( Style_Model::all_antialized ), false );
}
}
else {
- //drawPrimitive( PE_FrameLineEdit, opt, p, w );
- // fillRect()'s not correct working with basic color
- // for ListWidget in edit QListWidgetItem mode
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
QRect rect = panel->rect.adjusted( panel->lineWidth, panel->lineWidth,
-panel->lineWidth, -panel->lineWidth);
if ( qobject_cast<QTreeView*>(aWdg) ) {
QTreeView* trView = qobject_cast<QTreeView*>(aWdg);
QHeaderView* aHeader = trView->header();
- if ( aHeader ) {
+ if ( aHeader && aHeader->isVisible() ) {
int aHeight = aHeader->contentsRect().height();
r = QRect( r.x(), r.y()+aHeight, r.width(), r.height()-aHeight );
}
QPalette aPal = aWdg->palette();
double aMarg = LINE_GR_MARGIN;
QColor base = getColor( Style_Model::pal_base_clr ),
- light = base,
+ light = base,
light_alt = base.dark(110),//AlternateBase color
dark = getColor( Style_Model::fld_dark_clr );
- light.setAlpha( 0 );
+ //light.setAlpha( 0 ); // VSR commented: IPAL19262
QLinearGradient gr_h(r.x(), r.y(), r.right(), r.y());
gr_h.setColorAt( 0.0, dark );
gr_h.setColorAt( aMarg / r.width(), light );
}
}
+QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon,
+ const QStyleOption* opt,
+ const QWidget* widget ) const
+{
+ /*
+ switch ( standardIcon )
+ {
+ case SP_MessageBoxInformation:
+ return QPixmap( ":/images/information.png" );
+ case SP_MessageBoxWarning:
+ return QPixmap( ":/images/warning.png" );
+ case SP_MessageBoxCritical:
+ return QPixmap( ":/images/critical.png" );
+ case SP_MessageBoxQuestion:
+ return QPixmap( ":/images/question.png" );
+ default:
+ break;
+ }
+ */
+ return QWindowsStyle::standardIconImplementation( standardIcon, opt, widget );
+}
+
int Style_Salome::styleHint( StyleHint hint, const QStyleOption* opt, const QWidget* widget,
QStyleHintReturn* returnData ) const
{
p->restore();
}
+void Style_Tools::drawSign( QStyle::PrimitiveElement type, QPainter* p, const QRect& r,
+ const QColor& pen, const QColor& brush )
+{
+ p->save();
+ QPainterPath sign;
+ int x = r.x(), y = r.y(), w = r.right()-x, h = r.bottom()-y;
+ int x11 = 0, x12 = 0, y11 = 0, y12 = 0;
+ int aDelta = qMin( (int)(w/3.5), (int)(h/3.5) );
+ int deltaX = aDelta, deltaY = aDelta;
+ QLineF line( 0, 0, 1, 0 );
+ int xc = r.center().x(), yc = r.center().y();
+ p->translate( xc, yc );
+ bool correct = false;
+ switch( type ) {
+ case QStyle::PE_IndicatorSpinMinus:
+ correct = true;
+ case QStyle::PE_IndicatorSpinPlus: {
+ aDelta = (int)(deltaY/2);
+ if ( correct ) {
+ aDelta = -aDelta;
+ deltaY = -deltaY;
+ }
+ if ( correct )
+ sign.moveTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+ else {
+ sign.moveTo( aDelta/3, -aDelta/2 );
+ sign.lineTo( aDelta/3, -aDelta/2-(deltaY/2-aDelta/3) );
+ sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+ }
+
+ sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+
+ if ( !correct ) {
+ sign.lineTo( aDelta/3, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+ sign.lineTo( aDelta/3, -aDelta/2-deltaY );
+ sign.lineTo( -aDelta/3, -aDelta/2-deltaY );
+ sign.lineTo( -aDelta/3, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+ }
+
+ sign.lineTo( -deltaY/2, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+ sign.lineTo( -deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+
+ if ( correct )
+ sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+ else {
+ sign.lineTo( -aDelta/3, -aDelta/2-(deltaY/2-aDelta/3) );
+ sign.lineTo( -aDelta/3, -aDelta/2 );
+ sign.lineTo( aDelta/3, -aDelta/2);
+ }
+
+ if ( correct )
+ deltaX = -deltaX;
+ x11 = -deltaX, y11 = -deltaY, x12 = deltaX, y12 = 0;
+ break;
+ }
+ default:
+ p->restore();
+ return;
+ }
+ p->setPen( pen );
+ p->setBrush( brush );
+
+ QLinearGradient gr( x11, y11, x12, y12 );
+ gr.setColorAt( 0.0, pen ); // grayer
+ gr.setColorAt( 1.0, brush); // lighter
+ p->fillPath( sign, gr );
+ p->strokePath( sign, QPen( pen, Qt::SolidLine ) );
+
+ p->restore();
+}
+
QPainterPath Style_Tools::tabRect( QPainter* p, const QRect& r, const int position, const double rad,
const double delta, const QColor& light, const QColor& dark,
const QColor& border_top, const QColor& border_bot,