File tree Expand file tree Collapse file tree 8 files changed +83
-1
lines changed Expand file tree Collapse file tree 8 files changed +83
-1
lines changed Original file line number Diff line number Diff line change
1
+ # -------------------------------------------------
2
+ #
3
+ # Copyright (C) 2003-2103 CamelSoft Corporation
4
+ #
5
+ # -------------------------------------------------
6
+
7
+ QT += qml quick
8
+
9
+ CONFIG += c++11
10
+
11
+ SOURCES += main.cpp
12
+
13
+ RESOURCES += qml.qrc
Original file line number Diff line number Diff line change
1
+ /* !
2
+ *@file main.cpp
3
+ *@brief 程序主文件
4
+ *@version 1.0
5
+ *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation
6
+ *@author zhengtianzuo
7
+ */
8
+ #include < QGuiApplication>
9
+ #include < QQmlApplicationEngine>
10
+
11
+ int main (int argc, char *argv[])
12
+ {
13
+ QCoreApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
14
+ QGuiApplication app (argc, argv);
15
+
16
+ QQmlApplicationEngine engine;
17
+ engine.load (QUrl (QLatin1String (" qrc:/main.qml" )));
18
+
19
+ return app.exec ();
20
+ }
Original file line number Diff line number Diff line change
1
+ /*!
2
+ *@file main.qml
3
+ *@brief 主文件
4
+ *@version 1.0
5
+ *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation
6
+ *@author zhengtianzuo
7
+ */
8
+ import QtQuick 2.7
9
+ import QtQuick.Controls 2.0
10
+ import QtGraphicalEffects 1.0
11
+
12
+ ApplicationWindow {
13
+ visible: true
14
+ width: 400
15
+ height: 300
16
+ title: qsTr (" Qml图片转灰度" )
17
+
18
+ Row{
19
+ anchors .centerIn : parent
20
+
21
+ Image {
22
+ id: source
23
+ source: " qrc:/1.png"
24
+ smooth: true
25
+ }
26
+
27
+ Image {
28
+ id: target
29
+ source: " qrc:/1.png"
30
+ smooth: true
31
+ Desaturate {
32
+ anchors .fill : parent
33
+ source: parent
34
+ desaturation: 1.0
35
+ }
36
+ }
37
+ }
38
+ }
Original file line number Diff line number Diff line change
1
+ <RCC>
2
+ <qresource prefix="/">
3
+ <file>main.qml</file>
4
+ <file>1.png</file>
5
+ </qresource>
6
+ </RCC>
Original file line number Diff line number Diff line change @@ -29,4 +29,4 @@ SUBDIRS += QmlToggleButton
29
29
SUBDIRS += QmlCircularProgress
30
30
SUBDIRS += QmlFontList
31
31
SUBDIRS += QmlFlipImage
32
-
32
+ SUBDIRS += QmlGrayImage
Original file line number Diff line number Diff line change @@ -127,3 +127,8 @@ QmlFlipImage: Qml翻转效果
127
127
128
128
![ ] ( https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlFlipImage/show.gif?raw=true )
129
129
130
+
131
+ QmlGrayImage: Qml图片转灰度
132
+
133
+ ![ ] ( https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlGrayImage/show.jpg?raw=true )
134
+
You can’t perform that action at this time.
0 commit comments