[welcome] Add QML support
- test application to display the QML (this will be extended with adding the locale model to it) - sample QML that does nothing useful yet (will display the locale model once it's there)
This commit is contained in:
parent
549ba662f5
commit
156d78feb3
@ -40,3 +40,6 @@ calamares_add_plugin( welcome
|
||||
Qt5::Network
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
add_executable( welcomeqmltest qmlmain.cpp )
|
||||
target_link_libraries( welcomeqmltest calamaresui )
|
||||
|
52
src/modules/welcome/qmlmain.cpp
Normal file
52
src/modules/welcome/qmlmain.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
/* Example executable showing a QML page and using the
|
||||
* models from libcalamares for displaying a welcome.
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLabel>
|
||||
#include <QMainWindow>
|
||||
#include <QQuickWidget>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
#include <KAboutData>
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication a( argc, argv );
|
||||
|
||||
KAboutData aboutData( "calamares",
|
||||
"Calamares",
|
||||
"0.1",
|
||||
"Calamares QML Test Application",
|
||||
KAboutLicense::GPL_V3,
|
||||
QString(),
|
||||
QString(),
|
||||
"https://calamares.io",
|
||||
"https://github.com/calamares/calamares/issues" );
|
||||
KAboutData::setApplicationData( aboutData );
|
||||
a.setApplicationDisplayName( QString() ); // To avoid putting an extra "Calamares/" into the log-file
|
||||
|
||||
Logger::setupLogLevel( Logger::LOGVERBOSE );
|
||||
|
||||
QMainWindow mw;
|
||||
QWidget background;
|
||||
QVBoxLayout vl;
|
||||
QLabel l( "Hello, world", &mw );
|
||||
QQuickWidget qqw( &mw );
|
||||
vl.addWidget( &qqw );
|
||||
vl.addWidget( &l );
|
||||
background.setLayout( &vl );
|
||||
mw.setCentralWidget( &background );
|
||||
mw.resize( QSize( 400, 400 ) );
|
||||
mw.show();
|
||||
|
||||
qqw.setSource( QUrl::fromLocalFile("../src/modules/welcome/welcome.qml") );
|
||||
|
||||
return a.exec();
|
||||
}
|
12
src/modules/welcome/welcome.qml
Normal file
12
src/modules/welcome/welcome.qml
Normal file
@ -0,0 +1,12 @@
|
||||
import QtQuick 2.0;
|
||||
|
||||
Rectangle {
|
||||
width: 200;
|
||||
height: 200;
|
||||
color: "pink";
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent;
|
||||
text: "Welcome to Calamares";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user