Qt 4.8
qscriptdebuggerstackwidget.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtSCriptTools module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
44 
45 #include <QtCore/qdebug.h>
46 #include <QtGui/qheaderview.h>
47 #include <QtGui/qtreeview.h>
48 #include <QtGui/qboxlayout.h>
49 
51 
54 {
56 public:
59 
60  // private slots
62 
64 };
65 
67 {
68 }
69 
71 {
72 }
73 
75 {
77  emit q->currentFrameChanged(index.row());
78 }
79 
82 {
84  d->view = new QTreeView();
85  d->view->setEditTriggers(QAbstractItemView::NoEditTriggers);
86  d->view->setAlternatingRowColors(true);
87  d->view->setRootIsDecorated(false);
88  d->view->setSelectionBehavior(QAbstractItemView::SelectRows);
89  d->view->header()->setDefaultAlignment(Qt::AlignLeft);
90 // d->view->header()->setResizeMode(QHeaderView::ResizeToContents);
91 
92  QVBoxLayout *vbox = new QVBoxLayout(this);
93  vbox->setMargin(0);
94  vbox->addWidget(d->view);
95 }
96 
98 {
99 }
100 
105 {
107  return d->view->model();
108 }
109 
114 {
116  d->view->setModel(model);
117  QObject::connect(d->view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
118  this, SLOT(_q_onCurrentChanged(QModelIndex)));
119  d->view->header()->resizeSection(0, 50);
120 }
121 
126 {
128  return d->view->currentIndex().row();
129 }
130 
135 {
137  d->view->setCurrentIndex(d->view->model()->index(frameIndex, 0));
138 }
139 
141 
142 #include "moc_qscriptdebuggerstackwidget_p.cpp"
double d
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define SLOT(a)
Definition: qobjectdefs.h:226
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_D(Class)
Definition: qglobal.h:2482
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void setCurrentFrameIndex(int frameIndex)
Reimplemented Function
The QTreeView class provides a default model/view implementation of a tree view.
Definition: qtreeview.h:58
int row() const
Returns the row this model index refers to.
void _q_onCurrentChanged(const QModelIndex &index)
#define emit
Definition: qobjectdefs.h:76
The QAbstractItemModel class provides the abstract interface for item model classes.
void setStackModel(QAbstractItemModel *model)
Reimplemented Function
int currentFrameIndex() const
Reimplemented Function
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
QAbstractItemModel * stackModel() const
Reimplemented Function
The QModelIndex class is used to locate data in a data model.
quint16 index
QObject * parent
Definition: qobject.h:92
The QVBoxLayout class lines up widgets vertically.
Definition: qboxlayout.h:149
void setMargin(int)
Definition: qlayout.cpp:464