themes-example.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 1,123 行 · 第 1/5 页
HTML
1,123 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/examples/themes/themes.doc:4 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Themes (Styles)</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Themes (Styles)</h1> <p> This examples demonstrates how to let widgets be drawn in differentstyles (themes). As an example, themes looking like wood and metalare implemented. You can switch between the different stylesduring runtime using the pulldown menu.<p> <hr><p> Header file of the Wood theme:<p> <pre>/****************************************************************************** $Id$**** Definition of something or other**** Created : 979899**** Copyright (C) 1997 by Trolltech AS. All rights reserved.**** This file is part of an example program for Qt. This example** program may be used, distributed and modified without limitation.*******************************************************************************/#ifndef WOOD_H#define WOOD_H#include <<a href="qwindowsstyle-h.html">qwindowsstyle.h</a>>#include <<a href="qpalette-h.html">qpalette.h</a>>#ifndef QT_NO_STYLE_WINDOWSclass NorwegianWoodStyle : public <a href="qwindowsstyle.html">QWindowsStyle</a>{public: NorwegianWoodStyle(); void polish( <a href="qapplication.html">QApplication</a>*); void polish( <a href="qwidget.html">QWidget</a>* ); void unPolish( <a href="qwidget.html">QWidget</a>* ); void unPolish( <a href="qapplication.html">QApplication</a>*); void drawPrimitive( PrimitiveElement pe, <a href="qpainter.html">QPainter</a> *p, const <a href="qrect.html">QRect</a> &r, const <a href="qcolorgroup.html">QColorGroup</a> &cg, SFlags flags = Style_Default, const <a href="qstyleoption.html">QStyleOption</a>& = QStyleOption::Default ) const; void drawControl( ControlElement element, <a href="qpainter.html">QPainter</a> *p, const <a href="qwidget.html">QWidget</a> *widget, const <a href="qrect.html">QRect</a> &r, const <a href="qcolorgroup.html">QColorGroup</a> &cg, SFlags how = Style_Default, const <a href="qstyleoption.html">QStyleOption</a>& = QStyleOption::Default ) const; void drawControlMask( ControlElement element, <a href="qpainter.html">QPainter</a> *p, const <a href="qwidget.html">QWidget</a> *widget, const <a href="qrect.html">QRect</a> &r, const <a href="qstyleoption.html">QStyleOption</a>& = QStyleOption::Default ) const; void drawComplexControl( ComplexControl cc, <a href="qpainter.html">QPainter</a> *p, const <a href="qwidget.html">QWidget</a> *widget, const <a href="qrect.html">QRect</a> &r, const <a href="qcolorgroup.html">QColorGroup</a> &cg, SFlags how = Style_Default, SCFlags sub = SC_All, SCFlags subActive = SC_None, const <a href="qstyleoption.html">QStyleOption</a>& = QStyleOption::Default ) const; void drawComplexControlMask( ComplexControl control, <a href="qpainter.html">QPainter</a> *p, const <a href="qwidget.html">QWidget</a> *widget, const <a href="qrect.html">QRect</a> &r, const <a href="qstyleoption.html">QStyleOption</a>& = QStyleOption::Default ) const; <a href="qrect.html">QRect</a> querySubControlMetrics( ComplexControl control, const <a href="qwidget.html">QWidget</a> *widget, SubControl sc, const <a href="qstyleoption.html">QStyleOption</a>& = QStyleOption::Default ) const; <a href="qrect.html">QRect</a> subRect( SubRect r, const <a href="qwidget.html">QWidget</a> *widget ) const;private: void drawSemicircleButton(QPainter *p, const <a href="qrect.html">QRect</a> &r, int dir, bool sunken, const <a href="qcolorgroup.html">QColorGroup</a> &g ) const; <a href="qpalette.html">QPalette</a> oldPalette; <a href="qpixmap.html">QPixmap</a> *sunkenDark; <a href="qpixmap.html">QPixmap</a> *sunkenLight;};#endif#endif</pre><p> <hr><p> Implementation of the Wood theme:<p> <pre><a name="x212"></a><a name="x208"></a><a name="x163"></a>/****************************************************************************** $Id$**** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.**** This file is part of an example program for Qt. This example** program may be used, distributed and modified without limitation.*******************************************************************************/#include "wood.h"#ifndef QT_NO_STYLE_WINDOWS#include "qapplication.h"#include "qcombobox.h"#include "qpainter.h"#include "qdrawutil.h" // for now#include "qpixmap.h" // for now#include "qpalette.h" // for now#include "qwidget.h"#include "qlabel.h"#include "qimage.h"#include "qpushbutton.h"#include "qwidget.h"#include "qrangecontrol.h"#include "qscrollbar.h"#include <limits.h>#include "qstylefactory.h"/* XPM */static const char *polish_xpm[] = {/* width height num_colors chars_per_pixel */" 96 96 254 2",/* colors */".. c #9c4a34",".# c #a4825c",".a c #bc5e2c",".b c #d48432",".c c #dc9f51",".d c #bc6e1c",".e c #d4855d",".f c #94664c",".g c #bc714e",".h c #8c6664",".i c #d4923c",".j c #bc8444",".k c #d49360",".l c #d4794e",".m c #ecaf68",".n c #bc8365",".o c #d47439",".p c #a46954",".q c #dc9f70",".r c #e48544",".s c #bc7b51",".t c #a47761",".u c #bc7b42",".v c #a4523c",".w c #e4945e",".x c #9c784c",".y c #d4844a",".z c #eca053",".A c #bc614c",".B c #e4855c",".C c #bc8350",".D c #c48e68",".E c #b16634",".F c #e49339",".G c #bc703a",".H c #bc7c67",".I c #a45f34",".J c #cc714d",".K c #d48c5f",".L c #a47057",".M c #cc703a",".N c #dca674",".O c #b47859",".P c #bc6729",".Q c #d49475",".R c #d48b4a",".S c #cc8351",".T c #cc8466",".U c #ac6841",".V c #e4a651",".W c #e49576",".X c #d47d31",".Y c #ac6e4b",".Z c #c07650",".0 c #e48c43",".1 c #e49452",".2 c #9c745f",
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?