Skip to content

Commit

Permalink
新建gridview样例
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriyoung committed Dec 7, 2019
1 parent b0eb809 commit 09a640a
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gridview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Qt Quick 2.0 GridView

## TODO
- [ ] implement
- [ ] ...
30 changes: 30 additions & 0 deletions src/gridview/gridview.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
QT += quick

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
main.cpp

RESOURCES += qml.qrc

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
37 changes: 37 additions & 0 deletions src/gridview/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* QML examples - Qt5 and QML examples
* Copyright (c) 2019 Yuri Young<[email protected]>
*
* This examples is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This examples is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QGuiApplication>
#include <QQmlApplicationEngine>

int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

QGuiApplication app(argc, argv);

QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);

return app.exec();
}
9 changes: 9 additions & 0 deletions src/gridview/main.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import QtQuick 2.12
import QtQuick.Window 2.12

Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
}
5 changes: 5 additions & 0 deletions src/gridview/qml.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>
1 change: 1 addition & 0 deletions src/src.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
TEMPLATE = subdirs

SUBDIRS += \
gridview \
tableview \
treeview

0 comments on commit 09a640a

Please sign in to comment.