Skip to content

Commit

Permalink
Runnable HelloWorld Example in QML
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Reif committed Aug 30, 2017
1 parent 535e656 commit ddd76c8
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 71 deletions.
Binary file modified pfcrender_uml.asta
Binary file not shown.
9 changes: 7 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ if(COMPILE_GUI_SUPPORT)

endif()

set(SRC "PFCStart.cpp"
set(SRC
"QtGUI/PFCRender.cpp"

"Plugin/Plugin_Registry.cpp"

"PFCStart.cpp"
)

set(INC

"Plugin/Plugin_Registry.h"
"QtGUI/PFCRender.h"

"Plugin/Plugin_Registry.h"
)


Expand Down
9 changes: 9 additions & 0 deletions src/PFCStart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
#include <QUrl>
#include <QString>
#include <QQmlApplicationEngine>
#include <QQuickItem>

#include "Plugin/Plugin_Registry.h"
#include "QtGUI/PFCRender.h"

int main(int argc, char** argv)
{
Expand All @@ -17,6 +20,12 @@ int main(int argc, char** argv)
#if 1
QGuiApplication qapp(argc,argv);
QQmlApplicationEngine qeng(QUrl(QStringLiteral("qrc:///main.qml")));

QtGUI::PFCRender desktop_obj;

QObject* pItem = qobject_cast<QObject*>(qeng.rootObjects()[0]->findChild<QQuickItem*>(QString(QStringLiteral("Comptest"))));
QObject* pDesktop = &desktop_obj;

return qapp.exec();
#else
QCoreApplication qapp(argc,argv);
Expand Down
1 change: 1 addition & 0 deletions src/Plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(LSYS_Importer)
13 changes: 0 additions & 13 deletions src/Plugin/Importer_.cpp

This file was deleted.

17 changes: 0 additions & 17 deletions src/Plugin/Importer_.h

This file was deleted.

6 changes: 0 additions & 6 deletions src/Plugin/Plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <assert.h>

#include "Plugin.h"

namespace Plugin
Expand Down
15 changes: 10 additions & 5 deletions src/Plugin/Plugin.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#ifndef PLUGIN_PLUGIN_H
#define PLUGIN_PLUGIN_H

#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <assert.h>
#include "QList.h"
#include "auto.h"
#include "QString.h"

namespace Plugin
{
class Plugin
{
public:
virtual QList<QString> lookupServices()=0;

virtual auto execService()=0;

virtual bool hasService()=0;

};

} // namespace Plugin
Expand Down
12 changes: 9 additions & 3 deletions src/Plugin/Plugin_Registry.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
/**
* @class Plugin_Registry This class holds filenames of registered plugins and returns them by names of the services they expose. What to do with the files is up to the caller
*
**/


#ifndef PLUGIN_PLUGIN__REGISTRY_H
#define PLUGIN_PLUGIN__REGISTRY_H

#include <QHash>
#include <QString>
#include <QObject>

namespace Plugin
{
class Plugin_Registry
{
private:
static Plugin_Registry* instance;
QHash<QString,QObject*> m_registered;
QHash<QString,QString> m_registered;

private:
Plugin_Registry();
Plugin_Registry(const Plugin_Registry &)= delete ;
Plugin_Registry& operator=(const Plugin_Registry &) = delete;


public:
static Plugin_Registry* getInstance();

QString getPlugin(QString serviceName);
};

} // namespace Plugin
Expand Down
7 changes: 7 additions & 0 deletions src/QtGUI/HelloWorld.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import QtQuick 2.6
import QtQuick.Controls 2.2

Text{
objectName: "HelloWorld"
text: "HelloWorld"
}
11 changes: 5 additions & 6 deletions src/QtGUI/PFCRender.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <assert.h>

#include "PFCRender.h"
#include<iostream>

namespace QtGUI
{

PFCRender::PFCRender()
{

}

} // namespace QtGUI
24 changes: 7 additions & 17 deletions src/QtGUI/PFCRender.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
#ifndef QTGUI_P_F_C_RENDER_H
#define QTGUI_P_F_C_RENDER_H

#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <assert.h>

#include "Qt/QCoreApplication.h"
#include <QObject>

namespace QtGUI
{
/**
* Project pfcrender
*
* @author Adam Reif
*
*
*
* @version 0.1
*/
class PFCRender : public Qt::QCoreApplication

class PFCRender : public QObject
{
Q_OBJECT
public:
PFCRender();

};

} // namespace QtGUI
Expand Down
12 changes: 10 additions & 2 deletions src/QtGUI/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ ApplicationWindow
{
id: main
visible:true
Text{
text: "HelloWorld"

header: ToolBar
{}

footer: TabBar
{}

HelloWorld
{

}
}
1 change: 1 addition & 0 deletions src/QtGUI/qml.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>HelloWorld.qml</file>
</qresource>
</RCC>

0 comments on commit ddd76c8

Please sign in to comment.