diff options
Diffstat (limited to 'doc/src/snippets/code/src_gui_qproxystyle.cpp')
-rw-r--r-- | doc/src/snippets/code/src_gui_qproxystyle.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/doc/src/snippets/code/src_gui_qproxystyle.cpp b/doc/src/snippets/code/src_gui_qproxystyle.cpp index 7633160..46a2a5f 100644 --- a/doc/src/snippets/code/src_gui_qproxystyle.cpp +++ b/doc/src/snippets/code/src_gui_qproxystyle.cpp @@ -3,7 +3,7 @@ class MyProxyStyle : public QProxyStyle { public: - int styleHint(StyleHint hint, const QStyleOption *option = 0, + int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const { if (hint == QStyle::SH_UnderlineShortcut) @@ -13,3 +13,33 @@ public: }; //! [0] + +//! [1] +#include "textedit.h" +#include <QApplication> +#include <QProxyStyle> + +class MyProxyStyle : public QProxyStyle +{ + public: + int styleHint(StyleHint hint, const QStyleOption *option = 0, + const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const + { + if (hint == QStyle::SH_UnderlineShortcut) + return 0; + return QProxyStyle::styleHint(hint, option, widget, returnData); + } +}; + +int main(int argc, char **argv) +{ + Q_INIT_RESOURCE(textedit); + + QApplication a(argc, argv); + a.setStyle(new MyProxyStyle); + TextEdit mw; + mw.resize(700, 800); + mw.show(); + //... +} +//! [1] |