• 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
  • utils
utils/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 <analitzagui/operatorsmodel.h>
20 #include <QApplication>
21 #include <QStringList>
22 #include <QFile>
23 #include <QTextDocument>
24 #include <QtCore/QTextStream>
25 
26 int main(int argc, char** argv)
27 {
28  QApplication app(argc, argv);
29  OperatorsModel m;
30 
31  QFile f(app.arguments().last());
32  bool fileopened = f.open(QFile::WriteOnly);
33  Q_ASSERT(fileopened);
34 
35  QTextStream str(&f);
36  str.setCodec("UTF-8");
37 
38  str << "<!-- this file is autogenerated, if any change has to be done, please "
39  "fix kdeedu/kalgebra/utils/main.cpp and its dependencies. "
40  "Thank you, Aleix Pol -->";
41  str << "<chapter id='commands'>\n"
42  "<title>Commands supported by KAlgebra</title>\n";
43 
44  int rows = m.rowCount(), cols = m.columnCount();
45  QStringList colHeaders;
46  for(int i=0; i<cols; i++)
47  colHeaders += m.headerData(i, Qt::Horizontal).toString();
48 
49  for(int i=0; i<rows; i++) {
50  QString id = m.index(i,0).data().toString();
51  str << "\t<sect1 id='" << id << "'><title>" << id << "</title><itemizedlist>\n";
52  for(int c=0; c<cols; c++)
53  str << QString("\t\t<listitem><para>%1: %2</para></listitem>").arg(colHeaders[c]).arg(Qt::escape(m.index(i,c).data().toString())) << '\n';
54 
55  str << "\t</itemizedlist></sect1>\n";
56  }
57  str << "</chapter>\n";
58 
59  return 0;
60 }
QTextStream::setCodec
void setCodec(QTextCodec *codec)
QApplication
QFile
QTextStream
QString
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QStringList
Qt::escape
QString escape(const QString &plain)
QList::last
T & last()
QCoreApplication::arguments
QStringList arguments()
QString::data
QChar * data()
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
main
int main(int argc, char **argv)
Definition: utils/main.cpp:26
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