[welcome] Put Config object into context
This commit is contained in:
parent
c59678594b
commit
d41d8df2a5
@ -19,6 +19,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
Config::Config()
|
Config::Config()
|
||||||
|
: m_helpUrl( "https://www.kde.org/" )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
class Config : public QObject
|
class Config : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY( QUrl helpUrl READ helpUrl WRITE setHelpUrl )
|
Q_PROPERTY( QUrl helpUrl READ helpUrl WRITE setHelpUrl CONSTANT )
|
||||||
public:
|
public:
|
||||||
Config();
|
Config();
|
||||||
virtual ~Config();
|
virtual ~Config();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QQuickWidget>
|
#include <QQuickWidget>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -18,6 +19,12 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
|
static Config* theConfig()
|
||||||
|
{
|
||||||
|
static Config* cnf = new Config();
|
||||||
|
return cnf;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication a( argc, argv );
|
QApplication a( argc, argv );
|
||||||
@ -54,7 +61,7 @@ int main(int argc, char **argv)
|
|||||||
cnf.setHelpUrl( QUrl( argv[1] ) );
|
cnf.setHelpUrl( QUrl( argv[1] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
qmlRegisterType< Config >( "io.calamares.modules.welcome", 1, 0, "Config" );
|
qmlRegisterSingletonType< Config >( "io.calamares.modules.welcome", 1, 0, "PotatoConfig", [](QQmlEngine*, QJSEngine*) -> QObject* { return theConfig(); });
|
||||||
|
|
||||||
qqw.setSource( QUrl::fromLocalFile("../src/modules/welcome/welcome.qml") );
|
qqw.setSource( QUrl::fromLocalFile("../src/modules/welcome/welcome.qml") );
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import QtQuick 2.0;
|
import QtQuick 2.0;
|
||||||
|
import QtQuick.Controls 2.3;
|
||||||
import io.calamares.modules.welcome 1.0;
|
import io.calamares.modules.welcome 1.0;
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@ -6,8 +7,15 @@ Rectangle {
|
|||||||
height: 200;
|
height: 200;
|
||||||
color: "pink";
|
color: "pink";
|
||||||
|
|
||||||
Text {
|
Label {
|
||||||
|
id: label;
|
||||||
anchors.centerIn: parent;
|
anchors.centerIn: parent;
|
||||||
text: "Welcome to Calamares";
|
text: "Welcome to Calamares";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
anchors.top: label.bottom;
|
||||||
|
text: PotatoConfig.helpUrl;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user