A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQListView</id>
		<title>C++/Qt/QListView - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQListView"/>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B/Qt/QListView&amp;action=history"/>
		<updated>2026-04-10T03:41:26Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://cppe.ru/index.php?title=C%2B%2B/Qt/QListView&amp;diff=1260&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B/Qt/QListView&amp;diff=1260&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://cppe.ru/index.php?title=C%2B%2B/Qt/QListView&amp;diff=1261&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B/Qt/QListView&amp;diff=1261&amp;oldid=prev"/>
				<updated>2010-05-25T10:25:17Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Int model for QListView==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
Foundations of Qt Development\Chapter05\editmodel\intmodel.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;quot;intmodel.h&amp;quot;&lt;br /&gt;
IntModel::IntModel( int count, QObject *parent )&lt;br /&gt;
{&lt;br /&gt;
  for( int i=0; i&amp;lt;count; ++i )&lt;br /&gt;
    m_values &amp;lt;&amp;lt; i+1;&lt;br /&gt;
}&lt;br /&gt;
Qt::ItemFlags IntModel::flags( const QModelIndex &amp;amp;index ) const&lt;br /&gt;
{&lt;br /&gt;
  return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;&lt;br /&gt;
}&lt;br /&gt;
QVariant IntModel::data( const QModelIndex &amp;amp;index, int role ) const&lt;br /&gt;
{&lt;br /&gt;
  if( role != Qt::DisplayRole &amp;amp;&amp;amp; role != Qt::EditRole )&lt;br /&gt;
    return QVariant();&lt;br /&gt;
    &lt;br /&gt;
  if( index.column() == 0 &amp;amp;&amp;amp; index.row() &amp;lt; m_values.count() )&lt;br /&gt;
    return m_values.at( index.row() );&lt;br /&gt;
  else&lt;br /&gt;
    return QVariant();&lt;br /&gt;
}&lt;br /&gt;
int IntModel::rowCount( const QModelIndex &amp;amp;parent ) const&lt;br /&gt;
{&lt;br /&gt;
  return m_values.count();&lt;br /&gt;
}&lt;br /&gt;
bool IntModel::setData( const QModelIndex &amp;amp;index, const QVariant &amp;amp;value, int role )&lt;br /&gt;
{&lt;br /&gt;
  if( role != Qt::EditRole || index.column() != 0 || index.row() &amp;gt;= m_values.count() )&lt;br /&gt;
    return false;&lt;br /&gt;
    &lt;br /&gt;
  if( value.toInt() == m_values.at( index.row() ) )&lt;br /&gt;
    return false;&lt;br /&gt;
  m_values[ index.row() ] = value.toInt();&lt;br /&gt;
    &lt;br /&gt;
  emit dataChanged( index, index );&lt;br /&gt;
  return true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter05\editmodel\intmodel.h&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#ifndef INTMODEL_H&lt;br /&gt;
#define INTMODEL_H&lt;br /&gt;
#include &amp;lt;QAbstractListModel&amp;gt;&lt;br /&gt;
#include &amp;lt;QList&amp;gt;&lt;br /&gt;
class IntModel : public QAbstractListModel&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  IntModel( int count, QObject *parent = 0 );&lt;br /&gt;
  &lt;br /&gt;
  Qt::ItemFlags flags( const QModelIndex &amp;amp;index ) const;&lt;br /&gt;
  QVariant data( const QModelIndex &amp;amp;index, int role = Qt::DisplayRole ) const;&lt;br /&gt;
  int rowCount( const QModelIndex &amp;amp;parent = QModelIndex() ) const;&lt;br /&gt;
  bool setData( const QModelIndex &amp;amp;index, const QVariant &amp;amp;value, int role = Qt::EditRole );&lt;br /&gt;
private:&lt;br /&gt;
  QList&amp;lt;int&amp;gt; m_values;&lt;br /&gt;
};&lt;br /&gt;
#endif // INTMODEL_H&lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter05\editmodel\main.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QListView&amp;gt;&lt;br /&gt;
#include &amp;quot;intmodel.h&amp;quot;&lt;br /&gt;
int main( int argc, char **argv )&lt;br /&gt;
{&lt;br /&gt;
  QApplication app( argc, argv );&lt;br /&gt;
  &lt;br /&gt;
  IntModel model( 25 );&lt;br /&gt;
  &lt;br /&gt;
  QListView list;&lt;br /&gt;
  list.setModel( &amp;amp;model );&lt;br /&gt;
  list.show();&lt;br /&gt;
  &lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==QListView demo and QStandardItem==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
Foundations of Qt Development\Chapter05\readonlyview\main.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QSplitter&amp;gt;&lt;br /&gt;
#include &amp;lt;QTreeView&amp;gt;&lt;br /&gt;
#include &amp;lt;QListView&amp;gt;&lt;br /&gt;
#include &amp;lt;QTableView&amp;gt;&lt;br /&gt;
#include &amp;lt;QStandardItemModel&amp;gt;&lt;br /&gt;
int main( int argc, char **argv )&lt;br /&gt;
{&lt;br /&gt;
  QApplication app( argc, argv );&lt;br /&gt;
  &lt;br /&gt;
  QTreeView *tree = new QTreeView();&lt;br /&gt;
  QListView *list = new QListView();&lt;br /&gt;
  QTableView *table = new QTableView();&lt;br /&gt;
  &lt;br /&gt;
  QSplitter splitter;&lt;br /&gt;
  splitter.addWidget( tree );&lt;br /&gt;
  splitter.addWidget( list );&lt;br /&gt;
  splitter.addWidget( table );&lt;br /&gt;
  &lt;br /&gt;
  QStandardItemModel model( 5, 2 );&lt;br /&gt;
  for( int r=0; r&amp;lt;5; r++ ) &lt;br /&gt;
    for( int c=0; c&amp;lt;2; c++) &lt;br /&gt;
    {&lt;br /&gt;
      QStandardItem *item = new QStandardItem( QString(&amp;quot;Row:%0, Column:%1&amp;quot;).arg(r).arg(c) );&lt;br /&gt;
      &lt;br /&gt;
      if( c == 0 )&lt;br /&gt;
        for( int i=0; i&amp;lt;3; i++ )&lt;br /&gt;
        {&lt;br /&gt;
          QStandardItem *child = new QStandardItem( QString(&amp;quot;Item %0&amp;quot;).arg(i) );&lt;br /&gt;
          child-&amp;gt;setEditable( false );&lt;br /&gt;
          item-&amp;gt;appendRow( child );&lt;br /&gt;
        }&lt;br /&gt;
      &lt;br /&gt;
      model.setItem(r, c, item);&lt;br /&gt;
    }&lt;br /&gt;
  model.setHorizontalHeaderItem( 0, new QStandardItem( &amp;quot;Foo&amp;quot; ) );&lt;br /&gt;
  model.setHorizontalHeaderItem( 1, new QStandardItem( &amp;quot;Bar-Baz&amp;quot; ) );&lt;br /&gt;
  tree-&amp;gt;setModel( &amp;amp;model );&lt;br /&gt;
  list-&amp;gt;setModel( &amp;amp;model );&lt;br /&gt;
  table-&amp;gt;setModel( &amp;amp;model );&lt;br /&gt;
  list-&amp;gt;setSelectionModel( tree-&amp;gt;selectionModel() );&lt;br /&gt;
  table-&amp;gt;setSelectionModel( tree-&amp;gt;selectionModel() );&lt;br /&gt;
  table-&amp;gt;setSelectionBehavior( QAbstractItemView::SelectRows );&lt;br /&gt;
  table-&amp;gt;setSelectionMode( QAbstractItemView::SingleSelection );&lt;br /&gt;
  splitter.show();&lt;br /&gt;
  &lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==QStringListModel and QStringList==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter05\stringlist\main.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QListView&amp;gt;&lt;br /&gt;
#include &amp;lt;QStringListModel&amp;gt;&lt;br /&gt;
int main( int argc, char **argv )&lt;br /&gt;
{&lt;br /&gt;
  QApplication app( argc, argv );&lt;br /&gt;
  QListView list;&lt;br /&gt;
  QStringListModel model;&lt;br /&gt;
  QStringList strings;&lt;br /&gt;
  &lt;br /&gt;
  strings &amp;lt;&amp;lt; &amp;quot;foo&amp;quot; &amp;lt;&amp;lt; &amp;quot;bar&amp;quot; &amp;lt;&amp;lt; &amp;quot;baz&amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  model.setStringList( strings );&lt;br /&gt;
  list.setModel( &amp;amp;model );&lt;br /&gt;
  list.show();&lt;br /&gt;
  &lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set view mode for QListView==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
int main(int argc, char* argv[]){&lt;br /&gt;
  QApplication app(argc, argv);&lt;br /&gt;
  QDirModel dirModel;&lt;br /&gt;
  QWidgetw;&lt;br /&gt;
  w.setWindowTitle(QObject::tr(&amp;quot;Four directory views using one model&amp;quot;));&lt;br /&gt;
  QGridLayout *lay = new QGridLayout(&amp;amp;w);&lt;br /&gt;
  QListView *lv =new QListView;&lt;br /&gt;
  lay-&amp;gt;addWidget(lv, 0, 0);&lt;br /&gt;
  lv-&amp;gt;setModel(&amp;amp;dirModel);&lt;br /&gt;
  QListView *lvi = new QListView;&lt;br /&gt;
  lay-&amp;gt;addWidget(lvi, 0, 1);&lt;br /&gt;
  lvi-&amp;gt;setViewMode(QListView::IconMode);&lt;br /&gt;
  lvi-&amp;gt;setModel(&amp;amp;dirModel);&lt;br /&gt;
  QTreeView *trv =new QTreeView;&lt;br /&gt;
  lay-&amp;gt;addWidget(trv, 1, 0);&lt;br /&gt;
  trv-&amp;gt;setModel(&amp;amp;dirModel);&lt;br /&gt;
  QTableView *tav =new QTableView;&lt;br /&gt;
  tav-&amp;gt;setModel(&amp;amp;dirModel);&lt;br /&gt;
  lay-&amp;gt;addWidget(tav, 1, 1);&lt;br /&gt;
  QModelIndex cwdIndex = dirModel.index(QDir::currentPath());&lt;br /&gt;
  lv-&amp;gt;setRootIndex(cwdIndex);&lt;br /&gt;
  lvi-&amp;gt;setRootIndex(cwdIndex);&lt;br /&gt;
  trv-&amp;gt;setRootIndex(cwdIndex);&lt;br /&gt;
  tav-&amp;gt;setRootIndex(cwdIndex);&lt;br /&gt;
  w.show();&lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>