Seite 1 von 1

QAbstractItemView

Verfasst: 7. Februar 2006 12:28
von ogre
hallo,

hat jemand eine ahnung, wie man „QAbstractItemView“ vererbt und objekte bilden kann, genauer welchen funktionen man imlementieren muss?
thx

Code: Alles auswählen

// PieView.cpp
PieView::PieView(QWidget *parent) : QAbstractItemView(parent)
{
    
}

Code: Alles auswählen


// PieView.h
class PieView : public QAbstractItemView
{
    Q_OBJECT

public:
    PieView(QWidget *parent = 0);

}

Code: Alles auswählen

//main

//..

pieChart = new PieView;

//…

Verfasst: 7. Februar 2006 18:47
von Querdenker
Hi,

Konstruktor auch aufrufen ;)


wrong:
//main

//..

pieChart = new PieView;

//…


so vielleicht:

//main

//..

pieChart = new PieView();

//…

Verfasst: 7. Februar 2006 19:00
von upsala
Überladen muß alles werden, was in der Dokumentation als [pure virtual] deklariert ist (=0)

Das wären:
virtual QModelIndex indexAt ( const QPoint & point ) const = 0
virtual void scrollTo ( const QModelIndex & index, ScrollHint hint = EnsureVisible ) = 0
virtual QRect visualRect ( const QModelIndex & index ) const = 0
virtual bool isIndexHidden ( const QModelIndex & index ) const = 0
virtual QModelIndex moveCursor ( CursorAction cursorAction, Qt::KeyboardModifiers modifiers ) = 0
virtual void setSelection ( const QRect & rect, QItemSelectionModel::SelectionFlags flags ) = 0
virtual int verticalOffset () const = 0
virtual QRegion visualRegionForSelection ( const QItemSelection & selection ) const = 0

Und weitere Funktionen nach Bedarf, aber dafür denke ich sind die Doku & Beispiele eigentlich ausreichend...

Verfasst: 9. Februar 2006 09:04
von ogre
Das war schon was ich wissen wollte.
thx
:lol: