Qt Item Views
  The Next Generation
•   Marius Bugge Monsen (mbm)

•   Qt Developer

•   Qt Widget Team Lead
Qt Item Views
           The Next Generation



• What is Qt Item Views?
• Why a “Next Generation”?
• How Does it Work?
• Can I Start Using It?
What Is Qt Item Views?
QListView   QTableView   QTreeView
• QWidget-based
• Model-View
• Since Qt 4.0
Creative Friday!
Why a “Next Generation”?
... and why now?
• Lessons Learned
• Qt Development
• Competition
• Design Lessons
 • Different views - different use-cases
 • Eye-candy matters
 • KISS
• Process Lessons
 • Be open
 • Use the API
 • Encourage others to use the API
• So What Do We Want ?
Shark_food by starstreak007 on flickr
• Features
 • Fast
 • Integrated
 • Hardware Accelerated
• API
 • Discoverable
 • Structured
 • Clear
• Implementation
 • Simple
 • Clean
 • Testable
How Does It Work?
Model


View           Controller
Data and logic
                       Selection state


Presentation              Behavior
Data and logic   Selection state


Presentation        Behavior
Data


QListModelInterface   QListSelectionManager


QGraphicsListView        QListController



    Output                  Input
QListModelInterface
        vs.
QAbstractItemModel
• Optimizable
• Maintainable
• Expandable
List View




 Adaptor




Tree Model
QListWidgetNG


QListDefaultModel   QListSelectionManager


QGraphicsListView      QListController
Graphics View



   Item View
int main(int argc, char *argv[])
{
   QApplication app(argc, argv);
   QListWidgetNG widget;
   widget.show();
   return app.exec();
}
int main(int argc, char *argv[])
{
   QApplication app(argc, argv);
   QListWidgetNG widget;
   widget.controller()->setModel(new MyData(&widget));
   widget.show();
   return app.exec();
}
Data and logic    Selection state


QGraphicsListView      Behavior
• View or Layout?
View



Item
Invisible item




    Item
Invisible item




    Item
Invisible item




    Item
QGraphicsWidget



  QGraphicsWidget
QPropertyAnimation


                 QGraphicsWidget
Position                                      Size


       Opacity                     Rotation

                     Scale
Demo
QGraphicsSimpleTextItem


                                       QGraphicsLayout




                          Me



QGraphicsPixmapItem
                                      QGraphicsSvgItem
View




Item




Me
‘SUP DAWG YO I HERD U LIKE ITEM VIEWS...
View



View
Data and logic    Selection state


QGraphicsListView      Behavior
Data and logic   Selection state


                    Behavior
Data and logic   Selection state


                    Behavior
Data and logic   Selection state


PathListView        Behavior
int main(int argc, char *argv[])
{
   QApplication app(argc, argv);
   QListWidgetNG widget;
   widget.controller()->setView(new MyPathView);
   widget.show();
   return app.exec();
}
View



Item
View



Item
Demo
Data and logic   Selection state


Presentation        Behavior
Data and logic   Selection state


Presentation     QListController
Input Events



Model   Controller
View                Input Events



Item   Controller
View                Scrollbar



Item   Controller
Data and logic   Selection state


Presentation     QListController
Data and logic   Selection state


Presentation
Data and logic   Selection state


Presentation
Data and logic       Selection state


Presentation     QKineticListController
int main(int argc, char *argv[])
{
   QApplication app(argc, argv);
   QListWidgetNG widget(new QKineticListController);
   widget.show();
   return app.exec();
}
Can I Start Using It?
• Yes
• Yes, but ...
Research!
• Current status
 • Integrating in existing applications
 • Profiling and optimizing
• Current status
 • Missing features
 • API may change
• Unsolved problem
 • Data Invalidation
“Don’t expect, inspect!”
http://labs.trolltech.com/page/Projects/Itemview/ItemviewsNG

         http://qt.gitorious.org/qt-labs/itemviews-ng
Thank you!

Questions?

Qt Itemviews, The Next Generation