• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kalgebra

  • sources
  • kde-4.14
  • kdeedu
  • kalgebra
  • mobile
mobile/main.cpp
Go to the documentation of this file.
1 /*************************************************************************************
2  * Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License *
6  * as published by the Free Software Foundation; either version 2 *
7  * of the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the Free Software *
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
17  *************************************************************************************/
18 
19 #include <KApplication>
20 #include <KAboutData>
21 #include <KCmdLineArgs>
22 #include <KStandardDirs>
23 
24 #ifdef KDECOMPONENTS
25 #include <kdeclarative.h>
26 #endif
27 
28 #include <QDebug>
29 #include <QFileInfo>
30 #include <QDir>
31 #include <QDeclarativeView>
32 #include <QDeclarativeEngine>
33 #include <QDeclarativeContext>
34 #include <QIcon>
35 
36 #include "kalgebramobile.h"
37 
38 int main(int argc, char *argv[])
39 {
40 // KAboutData about("kalgebra", 0, ki18n(("KAlgebra Mobile")), "0.10", ki18n("A portable calculator"),
41 // KAboutData::License_GPL, ki18n("(C) 2006-2010 Aleix Pol Gonzalez"));
42 // about.addAuthor( ki18n("Aleix Pol Gonzalez"), KLocalizedString(), "aleixpol@kde.org" );
43 // KCmdLineArgs::init(argc, argv, &about);
44  QApplication app(argc, argv);
45  app.setApplicationName("kalgebramobile");
46  app.setWindowIcon(QIcon::fromTheme("kalgebra"));
47 
48  KAlgebraMobile widget;
49 
50  QDeclarativeView view;
51  view.setWindowTitle("KAlgebra Mobile");
52  view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
53  view.engine()->rootContext()->setContextProperty("app", &widget);
54 
55 // KGlobal::dirs()->addResourceDir("appdata", PREFIX "/share/apps");
56 
57 #ifdef KDECOMPONENTS
58  KDeclarative kdeclarative;
59  kdeclarative.setDeclarativeEngine(view.engine());
60  kdeclarative.initialize();
61  //binds things like kconfig and icons
62  kdeclarative.setupBindings();
63 #endif
64 
65  QString main = KStandardDirs::locate("appdata", "plugins/widgets/KAlgebraMobile.qml");
66 // QString main = KStandardDirs::locate("appdata", "plugins/Tables.qml");
67  QDir dir = QFileInfo(main).dir();
68  dir.cdUp();
69 
70  view.engine()->addImportPath(dir.path());
71  view.setSource(main);
72 
73  #if defined(__arm__) && !defined(ANDROID)
74  view.showFullScreen();
75  #else
76  view.resize(view.initialSize().width(), view.initialSize().height());
77  view.show();
78  #endif
79 
80  return app.exec();
81 }
main
int main(int argc, char *argv[])
Definition: mobile/main.cpp:38
QDeclarativeContext::setContextProperty
void setContextProperty(const QString &name, QObject *value)
QDeclarativeView::setSource
void setSource(const QUrl &url)
QSize::width
int width() const
QDeclarativeView::engine
QDeclarativeEngine * engine() const
QDeclarativeEngine::addImportPath
void addImportPath(const QString &path)
QApplication
QDeclarativeEngine::rootContext
QDeclarativeContext * rootContext() const
QWidget::resize
void resize(int w, int h)
QDeclarativeView
QDir::path
QString path() const
QFileInfo::dir
QDir dir() const
QString
QDir::cdUp
bool cdUp()
QFileInfo
QDeclarativeView::setResizeMode
void setResizeMode(ResizeMode)
QDir
QApplication::exec
int exec()
QApplication::setWindowIcon
void setWindowIcon(const QIcon &icon)
QWidget::setWindowTitle
void setWindowTitle(const QString &)
QSize::height
int height() const
QWidget::showFullScreen
void showFullScreen()
main
Definition: main.qml:22
kalgebramobile.h
QIcon::fromTheme
QIcon fromTheme(const QString &name, const QIcon &fallback)
QWidget::show
void show()
QDeclarativeView::initialSize
QSize initialSize() const
KAlgebraMobile
Definition: kalgebramobile.h:31
QCoreApplication::setApplicationName
void setApplicationName(const QString &application)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalgebra

Skip menu "kalgebra"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal