System notice: In light of the Debian OpenSSL security issue we've regenerated the server keys. See this thread for instructions and the new key fingerprints.

Blob of examples/view/main.cpp (raw blob data)

1 /***************************************************************************
2 * Copyright (C) 2008 by David Cuadrado *
3 * krawek@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21 #include <QApplication>
22 #include <QLabel>
23 #include <QIcon>
24 #include <QCalendarWidget>
25 #include <QTableWidget>
26 #include <QTextEdit>
27 #include <QDial>
28 #include <QGraphicsView>
29 #include <QGraphicsScene>
30 #include <QGraphicsRectItem>
31 #include <QGraphicsEllipseItem>
32
33 #include "sif/mainwindow.h"
34 #include "sif/view.h"
35
36 int main(int argc, char **argv)
37 {
38 QApplication app(argc, argv);
39 app.setApplicationName("Example 2");
40
41 SIF::MainWindow mw;
42 QObject::connect(&mw, SIGNAL(titleClicked()), qApp, SLOT(aboutQt()));
43
44 SIF::View *view1 = new SIF::View;
45 view1->addPage("Calendar", new QCalendarWidget);
46 view1->addPage("Table", new QTableWidget(10, 10));
47
48 mw.addPage("Data", view1);
49
50
51 SIF::View *view2 = new SIF::View;
52 view2->addPage("Editor", new QTextEdit("An editor"));
53 view2->addPage("Dial", new QDial);
54
55 QGraphicsView *qgv = new QGraphicsView;
56 qgv->setRenderHints(QPainter::Antialiasing);
57 QGraphicsScene *scene = new QGraphicsScene;
58
59 scene->addRect(QRect(25, 150, 100, 100))->setBrush(Qt::red);
60 scene->addEllipse(QRect(100, 20, 40, 100))->setBrush(Qt::blue);
61
62 qgv->setScene(scene);
63 view2->addPage("Graphics", qgv);
64
65
66 mw.addPage("View", view2);
67
68
69 mw.show();
70
71 return app.exec();
72 }