📄 themes-main-cpp.html
字号:
rgb = c.<a href="qcolor.html#b8dbb6">dark</a>(180).rgb(); img.<a href="qimage.html#271983">setColor</a>(i,rgb); } sunkenDark = new <a href="qpixmap.html">QPixmap</a>; sunkenDark->convertFromImage(img); img = bgimage; img.<a href="qimage.html#d576dd">detach</a>(); for (i=0; i<img.<a href="qimage.html#39c029">numColors</a>(); i++) { QRgb rgb = img.<a href="qimage.html#cf6e7d">color</a>(i); <a href="qcolor.html">QColor</a> c(rgb); rgb = c.<a href="qcolor.html#b8743e">light</a>(130).rgb(); img.<a href="qimage.html#271983">setColor</a>(i,rgb); } sunkenLight= new <a href="qpixmap.html">QPixmap</a>; sunkenLight->convertFromImage(img); <a href="qpalette.html">QPalette</a> op(<a href="qcolor.html">QColor</a>(212,140,95)); // QPalette op(white); <a href="qcolorgroup.html">QColorGroup</a> active (op.<a href="qpalette.html#35368b">normal</a>().foreground(), <a href="qbrush.html">QBrush</a>(op.<a href="qpalette.html#35368b">normal</a>().button(),button), <a href="qbrush.html">QBrush</a>(op.<a href="qpalette.html#35368b">normal</a>().light(), light), <a href="qbrush.html">QBrush</a>(op.<a href="qpalette.html#35368b">normal</a>().dark(), dark), <a href="qbrush.html">QBrush</a>(op.<a href="qpalette.html#35368b">normal</a>().mid(), mid), op.<a href="qpalette.html#35368b">normal</a>().text(), Qt::white, <a href="qcolor.html">QColor</a>(236,182,120), <a href="qbrush.html">QBrush</a>(op.<a href="qpalette.html#35368b">normal</a>().background(), background) ); <a href="qcolorgroup.html">QColorGroup</a> disabled (op.<a href="qpalette.html#50d5fa">disabled</a>().foreground(), <a href="qbrush.html">QBrush</a>(op.<a href="qpalette.html#50d5fa">disabled</a>().button(),button), <a href="qbrush.html">QBrush</a>(op.<a href="qpalette.html#50d5fa">disabled</a>().light(), light), op.<a href="qpalette.html#50d5fa">disabled</a>().dark(), <a href="qbrush.html">QBrush</a>(op.<a href="qpalette.html#50d5fa">disabled</a>().mid(), mid), op.<a href="qpalette.html#50d5fa">disabled</a>().text(), Qt::white, <a href="qcolor.html">QColor</a>(236,182,120), <a href="qbrush.html">QBrush</a>(op.<a href="qpalette.html#50d5fa">disabled</a>().background(), background) ); app-><a href="qapplication.html#63c60d">setPalette</a>(<a href="qpalette.html">QPalette</a>(active, disabled, active), TRUE );}void <a name="95"></a>NorwegianWoodStyle::unPolish( <a href="qapplication.html">QApplication</a> *app){ app-><a href="qapplication.html#63c60d">setPalette</a>(oldPalette, TRUE);}/*! Reimplementation from QStyle */void <a name="94"></a>NorwegianWoodStyle::polish( <a href="qwidget.html">QWidget</a>* w){ // the polish function sets some widgets to transparent mode and // some to translate background mode in order to get the full // benefit from the nice pixmaps in the color group. if (w-><a href="qobject.html#beb5d8">inherits</a>("QTipLabel") || w-><a href="qobject.html#beb5d8">inherits</a>("QLCDNumber") ){ return; } if ( !w-><a href="qwidget.html#17338a">isTopLevel</a>() ) { if ( w-><a href="qobject.html#beb5d8">inherits</a>("QPushButton") || w-><a href="qobject.html#beb5d8">inherits</a>("QToolButton") || w-><a href="qobject.html#beb5d8">inherits</a>("QGroupBox") || w-><a href="qobject.html#beb5d8">inherits</a>("QTabWidget") || w-><a href="qobject.html#beb5d8">inherits</a>("QComboBox") ) { w-><a href="qwidget.html#efa8f9">setAutoMask</a>( TRUE ); return; } if (w-><a href="qobject.html#beb5d8">inherits</a>("QLabel") || w-><a href="qobject.html#beb5d8">inherits</a>("QButton") ) { w-><a href="qwidget.html#67b25b">setBackgroundOrigin</a>( QWidget::ParentOrigin ); } }}void <a name="95"></a>NorwegianWoodStyle::unPolish( <a href="qwidget.html">QWidget</a>* w){ // the polish function sets some widgets to transparent mode and // some to translate background mode in order to get the full // benefit from the nice pixmaps in the color group. if (w-><a href="qobject.html#beb5d8">inherits</a>("QTipLabel") || w-><a href="qobject.html#beb5d8">inherits</a>("QLCDNumber") ){ return; } if ( !w-><a href="qwidget.html#17338a">isTopLevel</a>() ) { if ( w-><a href="qobject.html#beb5d8">inherits</a>("QPushButton") || w-><a href="qobject.html#beb5d8">inherits</a>("QToolButton") || w-><a href="qobject.html#beb5d8">inherits</a>("QGroupBox") || w-><a href="qobject.html#beb5d8">inherits</a>("QTabWidget") || w-><a href="qobject.html#beb5d8">inherits</a>("QComboBox") ) { w-><a href="qwidget.html#efa8f9">setAutoMask</a>( FALSE ); return; } if (w-><a href="qobject.html#beb5d8">inherits</a>("QLabel") || w-><a href="qobject.html#beb5d8">inherits</a>("QButton") ) { w-><a href="qwidget.html#67b25b">setBackgroundOrigin</a>( QWidget::WidgetOrigin ); } }}static void drawroundrect( <a href="qpainter.html">QPainter</a> *p, QCOORD x, QCOORD y, QCOORD w, QCOORD h, QCOORD d ){ int rx = (200*d)/w; int ry = (200*d)/h; p-><a href="qpainter.html#887bfb">drawRoundRect</a>( x, y, w, h, rx, ry );}static QRegion roundRectRegion( const QRect& g, int r ){ <a href="qpointarray.html">QPointArray</a> a; a.<a href="qpointarray.html#76de1d">setPoints</a>( 8, g.x()+r, g.y(), g.right()-r, g.y(), g.right(), g.y()+r, g.right(), g.bottom()-r, g.right()-r, g.bottom(), g.x()+r, g.bottom(), g.x(), g.bottom()-r, g.x(), g.y()+r ); <a href="qregion.html">QRegion</a> reg( a ); int d = r*2-1; reg += QRegion( g.x(),g.y(),r*2,r*2, QRegion::Ellipse ); reg += QRegion( g.right()-d,g.y(),r*2,r*2, QRegion::Ellipse ); reg += QRegion( g.x(),g.bottom()-d,r*2,r*2, QRegion::Ellipse ); reg += QRegion( g.right()-d,g.bottom()-d,r*2,r*2, QRegion::Ellipse ); return reg;}static int get_combo_extra_width( int h, int *return_awh=0 ){ int awh; if ( h < 8 ) { awh = 6; } else if ( h < 14 ) { awh = h - 2; } else { awh = h/2; } if ( return_awh ) *return_awh = awh; return awh*3/2;}static void get_combo_parameters( const QRect &r, int &ew, int &awh, int &ax, int &ay, int &sh, int &dh, int &sy ){ ew = get_combo_extra_width( r.<a href="qrect.html#581ab8">height</a>(), &awh ); sh = (awh+3)/4; if ( sh < 3 ) sh = 3; dh = sh/2 + 1; ay = r.<a href="qrect.html#f448f7">y</a>() + (r.<a href="qrect.html#581ab8">height</a>()-awh-sh-dh)/2; if ( ay < 0 ) { //panic mode ay = 0; sy = r.<a href="qrect.html#581ab8">height</a>(); } else { sy = ay+awh+dh; } ax = r.<a href="qrect.html#fccae7">x</a>() + r.<a href="qrect.html#45fe95">width</a>() - ew +(ew-awh)/2;}void <a name="96"></a>NorwegianWoodStyle::drawComboButton( <a href="qpainter.html">QPainter</a> *p, int x, int y, int w, int h, const QColorGroup &g, bool /* sunken */, bool editable, bool /*enabled */, const QBrush *fb ){ <a href="qbrush.html">QBrush</a> fill = fb ? *fb : g.<a href="qcolorgroup.html#dc90ba">brush</a>( QColorGroup::Button ); int awh, ax, ay, sh, sy, dh, ew; get_combo_parameters( buttonRect(x,y,w,h), ew, awh, ax, ay, sh, dh, sy ); <a href=#99>drawButton</a>( p, x, y, w, h, g, FALSE, &fill ); qDrawArrow( p, DownArrow, MotifStyle, FALSE, ax, ay, awh, awh, g, TRUE ); p-><a href="qpainter.html#0183e4">setPen</a>( g.<a href="qcolorgroup.html#5ff1d5">light</a>() ); p-><a href="qpainter.html#e3a489">drawLine</a>( ax, sy, ax+awh-1, sy ); p-><a href="qpainter.html#e3a489">drawLine</a>( ax, sy, ax, sy+sh-1 ); p-><a href="qpainter.html#0183e4">setPen</a>( g.<a href="qcolorgroup.html#9f3d58">dark</a>() ); p-><a href="qpainter.html#e3a489">drawLine</a>( ax+1, sy+sh-1, ax+awh-1, sy+sh-1 ); p-><a href="qpainter.html#e3a489">drawLine</a>( ax+awh-1, sy+1, ax+awh-1, sy+sh-1 ); if ( 0 && editable ) { <a href="qrect.html">QRect</a> r( <a href="qwindowsstyle.html#343938">comboButtonRect</a>(x-1,y-1,w+2,h+2) ); <a href="qpainter.html#b03ffb">qDrawShadePanel</a>( p, r, g, TRUE, 1, &fill ); }}static inline int buttonthickness( int d ){ return d > 20 ? 5 : ( d < 10 ? 2: 3 ); }enum { PointUp, PointDown, PointLeft, PointRight };void <a name="97"></a>NorwegianWoodStyle::drawSemicircleButton( <a href="qpainter.html">QPainter</a> *p, const QRect &r, int dir, bool sunken, const QColorGroup &g ){ int b = scrollBarExtent().height() > 20 ? 3 : 2; <a href="qregion.html">QRegion</a> extrn( r.<a href="qrect.html#fccae7">x</a>(), r.<a href="qrect.html#f448f7">y</a>(), r.<a href="qrect.html#45fe95">width</a>(), r.<a href="qrect.html#581ab8">height</a>(), QRegion::Ellipse ); <a href="qregion.html">QRegion</a> intern( r.<a href="qrect.html#fccae7">x</a>()+b, r.<a href="qrect.html#f448f7">y</a>()+b, r.<a href="qrect.html#45fe95">width</a>()-2*b, r.<a href="qrect.html#581ab8">height</a>()-2*b, QRegion::Ellipse ); int w2 = r.<a href="qrect.html#45fe95">width</a>()/2; int h2 = r.<a href="qrect.html#581ab8">height</a>()/2; int bug = 1; //off-by-one somewhere!!!??? switch( dir ) { case PointRight: extrn += QRegion( r.<a href="qrect.html#fccae7">x</a>(), r.<a href="qrect.html#f448f7">y</a>(), w2, r.<a href="qrect.html#581ab8">height</a>() ); intern += QRegion( r.<a href="qrect.html#fccae7">x</a>()+b,r.<a href="qrect.html#f448f7">y</a>()+b, w2-2*b, r.<a href="qrect.html#581ab8">height</a>()-2*b ); break; case PointLeft: extrn += QRegion( r.<a href="qrect.html#fccae7">x</a>()+w2, r.<a href="qrect.html#f448f7">y</a>(), w2, r.<a href="qrect.html#581ab8">height</a>() ); intern += QRegion( r.<a href="qrect.html#fccae7">x</a>()+w2+b,r.<a href="qrect.html#f448f7">y</a>()+b, w2-2*b, r.<a href="qrect.html#581ab8">height</a>()-2*b ); break; case PointUp: extrn += QRegion( r.<a href="qrect.html#fccae7">x</a>(), r.<a href="qrect.html#f448f7">y</
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -