<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /builddir/build/BUILD/libqxt-libqxt-v0.6.2/src/gui/qxtproxystyle.cpp --> <head> <title>QxtProxyStyle Class Reference</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://libqxt.org"><img src="images/qxt-logo.png" width="50" height="40" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="classes.html"><font color="#004faf">Classes</font></a> · <a href="namespaces.html"><font color="#004faf">Namespaces</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QxtProxyStyle Class Reference<br /><span class="small-subtitle">[<a href="qxtgui.html">QxtGui</a> module]</span> </h1> <p>The QxtProxyStyle class provides a proxy style. <a href="#details">More...</a></p> <pre> #include <QxtProxyStyle></pre><p>Inherits <a href="http://doc.qtsoftware.com/4.5/qstyle.html">QStyle</a>.</p> <ul> <li><a href="qxtproxystyle-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"></div><b><a href="qxtproxystyle.html#QxtProxyStyle">QxtProxyStyle</a></b> ( const QString & <i>baseStyle</i> )</li> <li><div class="fn"></div>virtual <b><a href="qxtproxystyle.html#dtor.QxtProxyStyle">~QxtProxyStyle</a></b> ()</li> </ul> <ul> <li><div class="fn"></div>23 public functions inherited from <a href="http://doc.qtsoftware.com/4.5/qstyle.html#public-functions">QStyle</a></li> <li><div class="fn"></div>29 public functions inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-functions">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li><div class="fn"></div>1 property inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#properties">QObject</a></li> <li><div class="fn"></div>1 public slot inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-slots">QObject</a></li> <li><div class="fn"></div>1 signal inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#signals">QObject</a></li> <li><div class="fn"></div>1 public type inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-variables">QObject</a></li> <li><div class="fn"></div>6 static public members inherited from <a href="http://doc.qtsoftware.com/4.5/qstyle.html#static-public-members">QStyle</a></li> <li><div class="fn"></div>4 static public members inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#static-public-members">QObject</a></li> <li><div class="fn"></div>7 protected functions inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#protected-functions">QObject</a></li> <li><div class="fn"></div>2 protected slots inherited from <a href="http://doc.qtsoftware.com/4.5/qstyle.html#protected-slots">QStyle</a></li> <li><div class="fn"></div>2 protected variables inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#protected-variables">QObject</a></li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QxtProxyStyle class provides a proxy style.</p> <p>A technique called "proxy style" is a common way for creating cross-platform custom styles. Developers often want to do slight adjustments in some specific values returned by <a href="http://doc.qtsoftware.com/4.5/qstyle.html">QStyle</a>. A proxy style is the solution to avoid subclassing any platform specific style (eg. <a href="http://doc.qtsoftware.com/4.5/qplastiquestyle.html">QPlastiqueStyle</a>, <a href="http://doc.qtsoftware.com/4.5/qwindowsxpstyle.html">QWindowsXPStyle</a>, or <a href="http://doc.qtsoftware.com/4.5/qmacstyle.html">QMacStyle</a>) and to retain the native look on all supported platforms.</p> <p>The subject has been discussed in <a href="http://doc.trolltech.com/qq/qq09-q-and-a.html#style">Qt Quarterly 9</a> (just notice that there are a few noteworthy spelling mistakes in the article).</p> <p>Proxy styles are becoming obsolete thanks to style sheets introduced in Qt 4.2. However, style sheets still is a new concept and only a portion of features are supported yet. Both - style sheets and proxy styles - have their pros and cons.</p> <a name="usage"></a> <h3>Usage</h3> <p>Implement the custom behaviour in a subclass of QxtProxyStyle:</p> <pre> class MyCustomStyle : public QxtProxyStyle { public: MyCustomStyle(const QString& baseStyle) : QxtProxyStyle(baseStyle) { } int pixelMetric(PixelMetric metric, const QStyleOption* option = 0, const QWidget* widget = 0) const { if (metric == QStyle::PM_ButtonMargin) return 6; return QxtProxyStyle::pixelMetric(metric, option, widget); } };</pre> <p>Using the custom style for the whole application:</p> <pre> QString defaultStyle = QApplication::style()->objectName(); QApplication::setStyle(new MyCustomStyle(defaultStyle));</pre> <p>Using the custom style for a single widget:</p> <pre> QString defaultStyle = widget->style()->objectName(); widget->setStyle(new MyCustomStyle(defaultStyle));</pre> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QxtProxyStyle"></a>QxtProxyStyle::QxtProxyStyle ( const <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> & <i>baseStyle</i> )</h3> <p>Constructs a new <a href="qxtproxystyle.html">QxtProxyStyle</a> for <i>baseStyle</i>. See <a href="http://doc.qtsoftware.com/4.5/qstylefactory.html#keys">QStyleFactory::keys</a>() for supported styles.</p> <p>See also <a href="http://doc.qtsoftware.com/4.5/qstylefactory.html#keys">QStyleFactory::keys</a>().</p> <h3 class="fn"><a name="dtor.QxtProxyStyle"></a>QxtProxyStyle::~QxtProxyStyle () <tt> [virtual]</tt></h3> <p>Destructs the proxy style.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td align="left">Copyright © 2007-2011 <a href="mailto:foundation@libqxt.org">Qxt Foundation</a></td> <td align="right"><div align="right"> <a href="http://libqxt.org">Qxt</a> 0.6.2</div></td> </tr></table></div></address></body> </html>