demos/interview/main.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2004-2006 Trolltech ASA. All rights reserved.
00004 **
00005 ** This file is part of the demonstration applications of the Qt Toolkit.
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://www.trolltech.com/products/qt/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00017 ** sales department at sales@trolltech.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ****************************************************************************/
00023 
00024 #include "model.h"
00025 
00026 #include <QApplication>
00027 #include <QTableView>
00028 #include <QTreeView>
00029 #include <QListView>
00030 #include <QSplitter>
00031 #include <QHeaderView>
00032 
00033 int main(int argc, char *argv[])
00034 {
00035     Q_INIT_RESOURCE(interview);
00036 
00037     QApplication app(argc, argv);
00038     QSplitter page;
00039 
00040     QAbstractItemModel *data = new Model(1000, 10, &page);
00041     QItemSelectionModel *selections = new QItemSelectionModel(data);
00042 
00043     QTableView *table = new QTableView;
00044     table->setModel(data);
00045     table->setSelectionModel(selections);
00046     table->horizontalHeader()->setMovable(true);
00047     table->verticalHeader()->setMovable(true);
00048     page.addWidget(table);
00049 
00050     QTreeView *tree = new QTreeView;
00051     tree->setModel(data);
00052     tree->setSelectionModel(selections);
00053     tree->setUniformRowHeights(true);
00054     tree->header()->setStretchLastSection(false);
00055     page.addWidget(tree);
00056 
00057     QListView *list = new QListView;
00058     list->setModel(data);
00059     list->setSelectionModel(selections);
00060     list->setViewMode(QListView::IconMode);
00061     list->setSelectionMode(QAbstractItemView::ExtendedSelection);
00062     list->setAlternatingRowColors(false);
00063     page.addWidget(list);
00064 
00065     page.setWindowIcon(QPixmap(":/images/interview.png"));
00066     page.setWindowTitle("Interview");
00067     page.show();
00068 
00069     return app.exec();
00070 }

Generated on Thu Mar 15 11:57:32 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1