📄 klearlook.cpp
字号:
r.x() + r.width() - 1, r.y() + r.height() - 2 ); } if ( !formMode ) { if ( tall ) p->setPen( cg.background() ); else p->setPen( midColor( custom ? custom[ 3 ] : gray[ 3 ], cg.background() ) ); p->drawPoint( r.x() + r.width() - 1, r.y() ); p->drawPoint( r.x() + r.width() - 1, r.y() + r.height() - 1 ); } break; default: break; } } else { p->setPen( flags & Style_ButtonDefault && IND_FONT_COLOUR == defBtnIndicator ? cg.text() : custom ? custom[ 5 ] : gray[ 5 ] ); p->setBrush( NoBrush ); p->drawRect( r ); } p->restore();}void KlearlookStyle::drawLightBevel( QPainter *p, const QRect &r, const QColorGroup &cg, QStyle::SFlags flags, bool useGrad, ERound round, const QColor &fill, const QColor *custom, bool light ) const{ QRect br( r ); bool sunken = ( flags & ( QStyle::Style_Down | QStyle::Style_On | QStyle::Style_Sunken ) ); int dark = borderButton ? 4 : 5, c1 = sunken ? dark : light ? 6 : 0; p->save(); if ( !borderButton ) br.addCoords( -1, -1, 1, 1 ); if ( ( sunken && !borderButton ) || ( !sunken && flags & QStyle::Style_Raised ) ) { p->setPen( custom ? custom[ c1 ] : gray[ c1 ] ); if ( APPEARANCE_LIGHT_GRADIENT != appearance ) { int c2 = sunken ? 0 : dark; p->drawLine( br.x() + 1, br.y() + 2, br.x() + 1, br.y() + br.height() - 3 ); // left p->drawLine( br.x() + 1, br.y() + 1, br.x() + br.width() - 2, br.y() + 1 ); // top p->setPen( custom ? custom[ c2 ] : gray[ c2 ] ); p->drawLine( br.x() + br.width() - 2, br.y() + 1, br.x() + br.width() - 2, br.y() + br.height() - 3 ); // right p->drawLine( br.x() + 1, br.y() + br.height() - 2, br.x() + br.width() - 2, br.y() + br.height() - 2 ); // bottom br.addCoords( 2, 2, -2, -2 ); } else { p->drawLine( br.x() + 1, br.y() + 2, br.x() + 1, br.y() + br.height() - 2 ); // left p->drawLine( br.x() + 1, br.y() + 1, br.x() + br.width() - 2, br.y() + 1 ); // top br.addCoords( 2, 2, -1, -1 ); } } else br.addCoords( 1, 1, -1, -1 ); // fill if ( useGrad && APPEARANCE_FLAT != appearance ) { drawBevelGradient( fill, !sunken, 0, p, QRect( br.left() - 1, br.top() - 1, br.width() + 2, br.height() + 2 ), flags & Style_Horizontal, sunken ? SHADE_BEVEL_GRAD_SEL_LIGHT( appearance ) : SHADE_BEVEL_GRAD_LIGHT( appearance ), sunken ? SHADE_BEVEL_GRAD_SEL_DARK( appearance ) : SHADE_BEVEL_GRAD_DARK( appearance ) ); } else { p->fillRect( br, fill ); } if ( borderButton ) if ( rounded && ROUNDED_NONE != round ) { bool wide = r.width() >= QTC_MIN_BTN_SIZE, tall = r.height() >= QTC_MIN_BTN_SIZE; QColor border = menuPbar[ GRADIENT_BASE ].dark( 130 ); p->setPen( border ); switch ( round ) { case ROUNDED_ALL: p->drawLine( r.x() + 1, r.y(), r.x() + r.width() - 2, r.y() ); // top p->drawLine( r.x() + 1, r.y() + r.height() - 1, r.x() + r.width() - 2, r.y() + r.height() - 1 ); // bottom p->drawLine( r.x(),r.y() + 1, r.x(),r.y() + r.height() - 2 ); // left p->drawLine( r.x() + r.width() - 1, r.y() + 1, r.x() + r.width() - 1, r.y() + r.height() - 2 ); // right //p->drawLine( r.x() + 2, r.y() + r.height() - 1, r.x() + r.width() - 3, r.y() + r.height() - 1 ); //p->drawLine( r.x(), r.y() + 2, r.x(), r.y() + r.height() - 3 ); //p->drawLine( r.x() + r.width() - 1, r.y() + 2, r.x() + r.width() - 1, r.y() + r.height() - 3 ); if ( tall && wide ) { //p->drawPoint( r.x() + r.width() - 2, r.y() + 1 ); //p->drawPoint( r.x() + 1, r.y() + r.height() - 2 ); //p->drawPoint( r.x() + r.width() - 2, r.y() + r.height() - 2 ); //p->drawPoint( r.x() + 1, r.y() + 1 ); p->setPen( midColor( border, cg.background() ) ); } if ( !formMode || !( tall && wide ) ) { //p->drawLine( r.x(), r.y() + 1, r.x() + 1, r.y() ); //p->drawLine( r.x() + r.width() - 2, r.y(), r.x() + r.width() - 1, r.y() + 1 ); //p->drawLine( r.x(), r.y() + r.height() - 2, r.x() + 1, r.y() + r.height() - 1 ); //p->drawLine( r.x() + r.width() - 2, r.y() + r.height() - 1, r.x() + r.width() - 1, r.y() + r.height() - 2 ); } if ( !formMode ) { if ( tall && wide ) p->setPen( cg.background() ); else p->setPen( midColor( custom ? custom[ 3 ] : gray[ 3 ], cg.background() ) ); //p->drawPoint( r.x(), r.y() ); //p->drawPoint( r.x() + r.width() - 1, r.y() ); //p->drawPoint( r.x(), r.y() + r.height() - 1 ); //p->drawPoint( r.x() + r.width() - 1, r.y() + r.height() - 1 ); } break; case ROUNDED_TOP: p->drawLine( r.x() + 2, r.y(), r.x() + r.width() - 3, r.y() ); p->drawLine( r.x() + 1, r.y() + r.height() - 1, r.x() + r.width() - 2, r.y() + r.height() - 1 ); p->drawLine( r.x(), r.y() + 2, r.x(), r.y() + r.height() - 1 ); p->drawLine( r.x() + r.width() - 1, r.y() + 2, r.x() + r.width() - 1, r.y() + r.height() - 1 ); if ( wide ) { p->drawPoint( r.x() + r.width() - 2, r.y() + 1 ); p->drawPoint( r.x() + 1, r.y() + 1 ); p->setPen( midColor( border, cg.background() ) ); } if ( !formMode || !wide ) { p->drawLine( r.x(), r.y() + 1, r.x() + 1, r.y() ); p->drawLine( r.x() + r.width() - 2, r.y(), r.x() + r.width() - 1, r.y() + 1 ); } if ( !formMode ) { if ( wide ) p->setPen( cg.background() ); else p->setPen( midColor( custom ? custom[ 3 ] : gray[ 3 ], cg.background() ) ); p->drawPoint( r.x(), r.y() ); p->drawPoint( r.x() + r.width() - 1, r.y() ); } break; case ROUNDED_BOTTOM: p->drawLine( r.x() + 1, r.y(), r.x() + r.width() - 2, r.y() ); p->drawLine( r.x() + 2, r.y() + r.height() - 1, r.x() + r.width() - 3, r.y() + r.height() - 1 ); p->drawLine( r.x(), r.y(), r.x(), r.y() + r.height() - 3 ); p->drawLine( r.x() + r.width() - 1, r.y(), r.x() + r.width() - 1, r.y() + r.height() - 3 ); if ( wide ) { p->drawPoint( r.x() + 1, r.y() + r.height() - 2 ); p->drawPoint( r.x() + r.width() - 2, r.y() + r.height() - 2 ); p->setPen( midColor( border, cg.background() ) ); } if ( !formMode || !wide ) { p->drawLine( r.x(), r.y() + r.height() - 2, r.x() + 1, r.y() + r.height() - 1 ); p->drawLine( r.x() + r.width() - 2, r.y() + r.height() - 1, r.x() + r.width() - 1, r.y() + r.height() - 2 ); } if ( !formMode ) { if ( wide ) p->setPen( cg.background() ); else p->setPen( midColor( custom ? custom[ 3 ] : gray[ 3 ], cg.background() ) ); p->drawPoint( r.x(), r.y() + r.height() - 1 ); p->drawPoint( r.x() + r.width() - 1, r.y() + r.height() - 1 ); } break; case ROUNDED_LEFT: p->drawLine( r.x() + 2, r.y(), r.x() + r.width() - 2, r.y() ); p->drawLine( r.x() + 2, r.y() + r.height() - 1, r.x() + r.width() - 2, r.y() + r.height() - 1 ); p->drawLine( r.x(), r.y() + 2, r.x(), r.y() + r.height() - 3 ); p->drawLine( r.x() + r.width() - 1, r.y(), r.x() + r.width() - 1, r.y() + r.height() - 1 ); if ( tall ) { p->drawPoint( r.x() + 1, r.y() + r.height() - 2 ); p->drawPoint( r.x() + 1, r.y() + 1 ); p->setPen( midColor( border, cg.background() ) ); } if ( !formMode || !tall ) { p->drawLine( r.x(), r.y() + 1, r.x() + 1, r.y() ); p->drawLine( r.x(), r.y() + r.height() - 2, r.x() + 1, r.y() + r.height() - 1 ); } if ( !formMode ) { if ( tall ) p->setPen( cg.background() ); else p->setPen( midColor( custom ? custom[ 3 ] : gray[ 3 ], cg.background() ) ); p->drawPoint( r.x(), r.y() ); p->drawPoint( r.x(), r.y() + r.height() - 1 ); } break; case ROUNDED_RIGHT: p->drawLine( r.x() + 1, r.y(), r.x() + r.width() - 3, r.y() ); p->drawLine( r.x() + 1, r.y() + r.height() - 1, r.x() + r.width() - 3, r.y() + r.height() - 1 ); p->drawLine( r.x(), r.y(), r.x(), r.y() + r.height() - 1 ); p->drawLine( r.x() + r.width() - 1, r.y() + 2, r.x() + r.width() - 1, r.y() + r.height() - 3 ); if ( tall ) { p->drawPoint( r.x() + r.width() - 2, r.y() + 1 ); p->drawPoint( r.x() + r.width() - 2, r.y() + r.height() - 2 ); p->setPen( midColor( border, cg.background() ) ); } if ( !formMode || !tall ) { p->drawLine( r.x() + r.width() - 2, r.y(), r.x() + r.width() - 1, r.y() + 1 ); p->drawLine( r.x() + r.width() - 2, r.y() + r.height() - 1, r.x() + r.width() - 1, r.y() + r.height() - 2 ); } if ( !formMode ) { if ( tall ) p->setPen( cg.background() ); else p->setPen( midColor( custom ? custom[ 3 ] : gray[ 3 ], cg.background() ) ); p->drawPoint( r.x() + r.width() - 1, r.y() ); p->drawPoint( r.x() + r.width() - 1, r.y() + r.height() - 1 ); } break; default: break; } } else { p->setPen( flags & Style_ButtonDefault && IND_FONT_COLOUR == defBtnIndicator ? cg.text() : custom ? custom[ 5 ] : gray[ 5 ] ); p->setBrush( NoBrush ); p->drawRect( r ); } p->restore();}void KlearlookStyle::drawArrow( QPainter *p, const QRect &r, const QColorGroup &cg, QStyle::SFlags flags, QStyle::PrimitiveElement pe, bool small, bool checkActive ) const { QPointArray a; const QColor &col = flags & Style_Enabled ? checkActive && flags & Style_Active ? cg.highlightedText() : cg.text() : cg.mid(); if ( vArrow ) if ( small ) switch ( pe ) { case QStyle::PE_ArrowUp: a.setPoints( 7, 2, 1, 2, 0, 0, -2, -2, 0, -2, 1, -2, 0, 2, 0 ); break; case QStyle::PE_ArrowDown: a.setPoints( 7, 2, -1, 2, 0, 0, 2, -2, 0, -2, -1, -2, 0, 2, 0 ); break; case QStyle::PE_ArrowRight: a.setPoints( 7, 1, -2, 0, -2, -2, 0, 0, 2, 1, 2, 0, 2, 0, -2 ); break; case QStyle::PE_ArrowLeft: a.setPoints( 7, -1, -2, 0, -2, 2, 0, 0, 2, -1, 2, 0, 2, 0, -2 ); break; default: return ; } else switch ( pe ) { case QStyle::PE_ArrowUp: a.setPoints( 7, 3, 1, 0, -2, -3, 1, -2, 2, -1, 1, 1, 1, 2, 2 ); break; case QStyle::PE_ArrowDown: a.setPoints( 7, 3, -1, 0, 2, -3, -1, -2, -2, -1, -1, 1, -1, 2, -2 ); break; case QStyle::PE_ArrowRight: a.setPoints( 7, -1, -3, 2, 0, -1, 3, -2, 2, -1, 1, -1, -1, -2, -2 ); break; case QStyle::PE_ArrowLeft: a.setPoints( 7, 1, -3, -2, 0, 1, 3, 2, 2, 1, 1, 1, -1, 2, -2 ); break; default: return ; } else if ( small ) switch ( pe ) { case QStyle::PE_ArrowUp: a.setPoints( 4, 2, 0, 0, -2, -2, 0, 2, 0 ); break; case QStyle::PE_ArrowDown: a.setPoints( 4, 2, 0, 0, 2, -2, 0, 2, 0 ); break; case QStyle::PE_ArrowRight: a.setPoints( 4, 0, -2, -2, 0, 0, 2, 0, -2 ); break; case QStyle::PE_ArrowLeft: a.setPoints( 4, 0, -2, 2, 0, 0, 2, 0, -2 ); break; default: return ; } else switch ( pe ) { case QStyle::PE_ArrowUp: a.setPoints( 4, 3, 1, 0, -2, -3, 1, 3, 1 ); break; case QStyle::PE_ArrowDown: a.setPoints( 4, 3, -1, 0, 2, -3, -1, 3, -1 ); break; case QStyle::PE_ArrowRight: a.setPoints( 4, -1, -3, 2, 0, -1, 3, -1, -3 ); break; case QStyle::PE_ArrowLeft: a.setPoints( 4, 1, -3, -2, 0, 1, 3, 1, -3 ); break; default:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -