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
9
class
MyProxyStyle
:
public
QProxyStyle
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
21
int
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
...
36
auto
proxy =
new
MyProxyStyle(QApplication::style()->name());
37
proxy->setParent(widget);
// take ownership to avoid memleak
38
widget->setStyle(proxy);
39
...
40
//! [2]
MyProxyStyle
[1]
Definition
src_gui_qproxystyle.cpp:10
MyProxyStyle::styleHint
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...
Definition
src_gui_qproxystyle.cpp:12
TextEdit
Definition
textedit.h:10
main
int main(int argc, char *argv[])
[ctor_close]
Definition
src_corelib_animation_qpropertyanimation.cpp:100
qtbase
src
widgets
doc
snippets
code
src_gui_qproxystyle.cpp
Generated on
for Qt by
1.14.0