File tree 5 files changed +146
-0
lines changed
5 files changed +146
-0
lines changed Original file line number Diff line number Diff line change
1
+ QT += quick
2
+
3
+ CONFIG += c++11
4
+
5
+ SOURCES += \
6
+ main.cpp
7
+
8
+ RESOURCES += qml.qrc
9
+
Original file line number Diff line number Diff line change
1
+
2
+ import QtQuick 2.12
3
+ import QtGraphicalEffects 1.0
4
+
5
+ Item {
6
+ id: emboss
7
+
8
+ property alias source: topLeftShadow .source
9
+ property color lightColor: " white"
10
+ property color darkColor: " black"
11
+ property bool cached: true
12
+ property real radius: 1
13
+ property real spread: 0.1
14
+ property real offset: 1
15
+
16
+ InnerShadow {
17
+ id: topLeftShadow
18
+ anchors .fill : parent
19
+ cached: emboss .cached
20
+ horizontalOffset: emboss .offset
21
+ verticalOffset: emboss .offset
22
+ color: emboss .lightColor
23
+ radius: emboss .radius
24
+ samples: emboss .radius * 2
25
+ spread: emboss .spread
26
+ }
27
+ InnerShadow {
28
+ id: bottomRightShadow
29
+ anchors .fill : parent
30
+ cached: emboss .cached
31
+ source: topLeftShadow
32
+ horizontalOffset: - emboss .offset
33
+ verticalOffset: - emboss .offset
34
+ color: emboss .darkColor
35
+ radius: emboss .radius
36
+ samples: emboss .radius * 2
37
+ spread: emboss .spread
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ #include < QGuiApplication>
2
+ #include < QQmlApplicationEngine>
3
+
4
+ int main (int argc, char *argv[])
5
+ {
6
+ QCoreApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
7
+
8
+ QGuiApplication app (argc, argv);
9
+
10
+ QQmlApplicationEngine engine;
11
+ const QUrl url (QStringLiteral (" qrc:/main.qml" ));
12
+ QObject::connect (&engine, &QQmlApplicationEngine::objectCreated,
13
+ &app, [url](QObject *obj, const QUrl &objUrl) {
14
+ if (!obj && url == objUrl)
15
+ QCoreApplication::exit (-1 );
16
+ }, Qt::QueuedConnection);
17
+ engine.load (url);
18
+
19
+ return app.exec ();
20
+ }
Original file line number Diff line number Diff line change
1
+ import QtQuick 2.12
2
+ import QtQuick.Window 2.12
3
+ import QtGraphicalEffects 1.12
4
+
5
+ Window {
6
+ visible: true
7
+ width: 480
8
+ height: 480
9
+ title: qsTr (" Emboss" )
10
+ color: " lightsteelblue"
11
+
12
+ Grid {
13
+ anchors .centerIn : parent
14
+ columns: 2
15
+ spacing: 10
16
+
17
+ Rectangle {
18
+ width: 200
19
+ height: 200
20
+ radius: 10
21
+ gradient: " LandingAircraft"
22
+
23
+ Emboss {
24
+ anchors .fill : parent
25
+ source: parent
26
+ offset: 2
27
+ radius: 3
28
+ }
29
+ }
30
+ Rectangle {
31
+ width: 200
32
+ height: 200
33
+ radius: 10
34
+ gradient: " LandingAircraft"
35
+
36
+ Emboss {
37
+ anchors .fill : parent
38
+ source: parent
39
+ offset: - 2
40
+ radius: 3
41
+ }
42
+ }
43
+ Rectangle {
44
+ width: 200
45
+ height: 200
46
+ radius: 10
47
+ gradient: " AboveTheSky"
48
+
49
+ Emboss {
50
+ anchors .fill : parent
51
+ source: parent
52
+ opacity: 0.6
53
+ offset: 2
54
+ radius: 6
55
+ }
56
+ }
57
+ Rectangle {
58
+ width: 200
59
+ height: 200
60
+ radius: 10
61
+ gradient: " AboveTheSky"
62
+
63
+ Emboss {
64
+ anchors .fill : parent
65
+ source: parent
66
+ opacity: 0.6
67
+ offset: - 2
68
+ radius: 6
69
+ }
70
+ }
71
+ }
72
+ }
Original file line number Diff line number Diff line change
1
+ <RCC>
2
+ <qresource prefix="/">
3
+ <file>main.qml</file>
4
+ <file>Emboss.qml</file>
5
+ </qresource>
6
+ </RCC>
You can’t perform that action at this time.
0 commit comments