📄 themes-main-cpp.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Qt Toolkit - themes/main.cpp example file</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: white; color: black; }--></style></head><body bgcolor="#ffffff"><table width="100%"><tr><td><a href="index.html"><img width="100" height="100" src="qtlogo.png"alt="Home" border="0"><img width="100"height="100" src="face.png" alt="Home" border="0"></a><td valign="top"><div align="right"><img src="dochead.png" width="472" height="27"><br><a href="classes.html"><b>Classes</b></a>- <a href="annotated.html">Annotated</a>- <a href="hierarchy.html">Tree</a>- <a href="functions.html">Functions</a>- <a href="index.html">Home</a>- <a href="topicals.html"><b>Structure</b> <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qte</font></a></div></table><h1 align=center>Themes (Styles)</h1><br clear="all"> This examples demonstrates how to let widgets draw in different styles (themes). As example, themes looking like wood and metal are implemented. You can switch between the different styles during runtime using the pulldown menu. <hr> Header file of the Wood-Theme: <pre>/****************************************************************************** $Id: qt/examples/themes/wood.h 2.3.8 edited 2004-05-12 $**** 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>>class NorwegianWoodStyle : public QWindowsStyle{public: NorwegianWoodStyle( int sbext = -1 ); 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 drawButton( <a href="qpainter.html">QPainter</a> *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken = FALSE, const QBrush *fill = 0 ); void drawBevelButton( <a href="qpainter.html">QPainter</a> *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken = FALSE, const QBrush *fill = 0 ); <a href="qrect.html">QRect</a> buttonRect( int x, int y, int w, int h); void drawButtonMask( <a href="qpainter.html">QPainter</a> *p, int x, int y, int w, int h); void 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 ); void drawPushButton( <a href="qpushbutton.html">QPushButton</a>* btn, QPainter *p); void drawPushButtonLabel( <a href="qpushbutton.html">QPushButton</a>* btn, QPainter *p); void drawScrollBarControls( <a href="qpainter.html">QPainter</a>*, const QScrollBar*, int sliderStart, uint controls, uint activeControl );private: void drawSemicircleButton(<a href="qpainter.html">QPainter</a> *p, const QRect &r, int dir, bool sunken, const QColorGroup &g ); <a href="qpalette.html">QPalette</a> oldPalette; <a href="qpixmap.html">QPixmap</a> *sunkenDark; <a href="qpixmap.html">QPixmap</a> *sunkenLight;};#endif</pre> <hr> Implementation of the Wood-Theme: <pre>/****************************************************************************** $Id: qt/examples/themes/wood.cpp 2.3.8 edited 2004-05-12 $**** 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"#include "<a href="qapplication-h.html">qapplication.h</a>"#include "<a href="qpainter-h.html">qpainter.h</a>"#include "<a href="qdrawutil-h.html">qdrawutil.h</a>" // for now#include "<a href="qpixmap-h.html">qpixmap.h</a>" // for now#include "<a href="qpalette-h.html">qpalette.h</a>" // for now#include "<a href="qwidget-h.html">qwidget.h</a>"#include "<a href="qlabel-h.html">qlabel.h</a>"#include "<a href="qimage-h.html">qimage.h</a>"#include "<a href="qpushbutton-h.html">qpushbutton.h</a>"#include "<a href="qwidget-h.html">qwidget.h</a>"#include "<a href="qrangecontrol-h.html">qrangecontrol.h</a>"#include "<a href="qscrollbar-h.html">qscrollbar.h</a>"#include <limits.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",".3 c #e47e54",".4 c #cc7c4f",".5 c #cc7c32",".6 c #b46133",".7 c #d49a68",".8 c #d67e4f",".9 c #bc7643","#. c #b47056","## c #d48b3a","#a c #dc9f5e","#b c #e49a60","#c c #cc6a31","#d c #8c6244","#e c #dc9a41","#f c #eca753","#g c #bc8a58","#h c #d48c76","#i c #bc693f","#j c #bc715d","#k c #9c6857","#l c #f4b171","#m c #bc8a6a","#n c #eca16d","#o c #a87e58","#p c #a4613f","#q c #a48569","#r c #d4846d","#s c #dc935f","#t c #c47c50","#u c #dc8449","#v c #bc6950","#w c #cc9678","#x c #c4703a","#y c #cc7b67","#z c #dc8c5e","#A c #ac7067","#B c #eca86e","#C c #b4786d","#D c #dc8c4a","#E c #b46842",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -