forked from zhengtianzuo/QtQuickExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa3cbe8
commit 2e96ae8
Showing
7 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#------------------------------------------------- | ||
# | ||
# Copyright (C) 2003-2103 CamelSoft Corporation | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += qml quick widgets | ||
|
||
CONFIG += c++11 | ||
|
||
SOURCES += main.cpp | ||
|
||
RESOURCES += qml.qrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*! | ||
*@file main.cpp | ||
*@brief 程序主文件 | ||
*@version 1.0 | ||
*@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation | ||
*@author zhengtianzuo | ||
*/ | ||
#include <QApplication> | ||
#include <QQmlApplicationEngine> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); | ||
QApplication app(argc, argv); | ||
QQmlApplicationEngine engine; | ||
engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); | ||
return app.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/*! | ||
*@file main.qml | ||
*@brief 主文件 | ||
*@version 1.0 | ||
*@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation | ||
*@author zhengtianzuo | ||
*/ | ||
import QtQuick 2.7 | ||
import QtQuick.Controls 2.0 | ||
import QtQuick.Layouts 1.0 | ||
import Qt.labs.platform 1.0 | ||
|
||
ApplicationWindow { | ||
visible: true | ||
width: 400 | ||
height: 300 | ||
title: qsTr("Qml文件对话框") | ||
|
||
|
||
Column{ | ||
anchors.centerIn: parent | ||
|
||
Button{ | ||
text: qsTr("打开文件") | ||
height: 48 | ||
width: 120 | ||
MouseArea{ | ||
anchors.fill: parent | ||
onClicked: { | ||
fileDialog1.open() | ||
} | ||
} | ||
} | ||
Button{ | ||
text: qsTr("打开多个文件") | ||
height: 48 | ||
width: 120 | ||
MouseArea{ | ||
anchors.fill: parent | ||
onClicked: { | ||
fileDialog2.open() | ||
} | ||
} | ||
} | ||
Button{ | ||
text: qsTr("保存文件") | ||
height: 48 | ||
width: 120 | ||
MouseArea{ | ||
anchors.fill: parent | ||
onClicked: { | ||
fileDialog3.open() | ||
} | ||
} | ||
} | ||
} | ||
|
||
FileDialog { | ||
id: fileDialog1 | ||
fileMode: FileDialog.OpenFile | ||
nameFilters: ["图像文件 (*.png *.jpg *.gif *.bmp)", "全部文件 (*.*)"] | ||
options :FileDialog.ReadOnly | ||
} | ||
FileDialog { | ||
id: fileDialog2 | ||
fileMode: FileDialog.OpenFiles | ||
nameFilters: ["图像文件 (*.png *.jpg *.gif *.bmp)", "全部文件 (*.*)"] | ||
options :FileDialog.ReadOnly | ||
} | ||
FileDialog { | ||
id: fileDialog3 | ||
nameFilters: ["图像文件 (*.png *.jpg *.gif *.bmp)", "全部文件 (*.*)"] | ||
fileMode: FileDialog.SaveFile | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>main.qml</file> | ||
</qresource> | ||
</RCC> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters