Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_gui_qproxystyle.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4//! [1]
5#include "textedit.h"
6#include <QApplication>
7#include <QProxyStyle>
8
10{
11 public:
12 int styleHint(StyleHint hint, const QStyleOption *option = nullptr,
13 const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override
14 {
15 if (hint == QStyle::SH_UnderlineShortcut)
16 return 0;
17 return QProxyStyle::styleHint(hint, option, widget, returnData);
18 }
19};
20
21int main(int argc, char **argv)
22{
23 Q_INIT_RESOURCE(textedit);
24
25 QApplication a(argc, argv);
26 a.setStyle(new MyProxyStyle);
27 TextEdit mw;
28 mw.resize(700, 800);
29 mw.show();
30 //...
31}
32//! [1]
33
34//! [2]
35...
36auto proxy = new MyProxyStyle(QApplication::style()->name());
37proxy->setParent(widget); // take ownership to avoid memleak
38widget->setStyle(proxy);
39...
40//! [2]
int styleHint(StyleHint hint, const QStyleOption *option=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const override
Returns an integer representing the specified style hint for the given widget described by the provid...
int main(int argc, char *argv[])
[ctor_close]