Created
June 17, 2016 13:36
-
-
Save anonymous/1ad94c9539fdc51d29258f6164f72487 to your computer and use it in GitHub Desktop.
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
#include <QGuiApplication> | |
#include <QQmlApplicationEngine> | |
#include <QQuickStyle> | |
int main(int argc, char *argv[]) | |
{ | |
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); | |
QGuiApplication app(argc, argv); | |
// default material unless overridden | |
QString style = QQuickStyle::name(); | |
if (style.isEmpty()) QQuickStyle::setStyle("Material"); | |
QQmlApplicationEngine engine; | |
engine.load(QUrl("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
import QtQuick 2.7 | |
import QtQuick.Controls 2.0 | |
import QtQml 2.2 | |
ApplicationWindow | |
{ | |
visible: true | |
width: 640 | |
height: 800 | |
function makeText() | |
{ | |
var s = "click <a href=\"http://qt.io\">here</a>\n" | |
for (var i = 0; i < 10; ++i) | |
{ | |
s += | |
"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras at tempus felis. Nulla facilisi. Duis quam purus, posuere eu rutrum vel, blandit quis lorem. Cras vitae orci eget lorem luctus cursus quis nec nibh. Sed luctus ligula urna, vel commodo nisi finibus quis. Donec pretium eu purus a porttitor. Nam vehicula nunc quis dui gravida luctus. Morbi fermentum, elit nec ullamcorper accumsan, ex ligula iaculis nisi, id pretium ipsum metus quis quam. In lobortis dignissim semper. Aenean at neque lorem. Maecenas dapibus, arcu a condimentum consequat, mauris enim vehicula nibh, in fringilla quam nisi eu ipsum.</p>" | |
} | |
return s | |
} | |
Flickable | |
{ | |
id: flickable | |
anchors.fill: parent | |
flickableDirection: Flickable.VerticalFlick | |
// place a TextArea inside the flickable, you can edit text | |
// but you cannot select because click & move mouse flicks the view. | |
TextArea.flickable: TextArea | |
{ | |
id: textarea | |
wrapMode: TextArea.Wrap | |
font.pointSize: 16 | |
textMargin: 16 | |
textFormat: TextEdit.RichText | |
// can select but kills scrolling | |
//selectByMouse: true | |
text: Qt.platform.os + "\n" + makeText() | |
// try out links | |
onLinkActivated: Qt.openUrlExternally(link) | |
} | |
ScrollBar.vertical: ScrollBar { } | |
} | |
} | |
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
TEMPLATE = app | |
QT += qml quick quickcontrols2 | |
CONFIG += console | |
SOURCES += main.cpp | |
RESOURCES += qml.qrc | |
DISTFILES += \ | |
android/AndroidManifest.xml \ | |
android/gradle/wrapper/gradle-wrapper.jar \ | |
android/gradlew \ | |
android/res/values/libs.xml \ | |
android/build.gradle \ | |
android/gradle/wrapper/gradle-wrapper.properties \ | |
android/gradlew.bat | |
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android | |
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
<RCC> | |
<qresource prefix="/"> | |
<file>main.qml</file> | |
</qresource> | |
</RCC> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment