Qt 4.8
qdeclarativeview.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 QtDeclarative 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 
42 #include "qdeclarativeview.h"
43 
44 #include <qdeclarative.h>
45 #include <qdeclarativeitem.h>
46 #include <qdeclarativeengine.h>
47 #include <qdeclarativecontext.h>
48 #include <qdeclarativeglobal_p.h>
49 #include <qdeclarativeguard_p.h>
50 
51 #include <private/qdeclarativedebugtrace_p.h>
52 #include <private/qdeclarativeinspectorservice_p.h>
53 
54 #include <qscriptvalueiterator.h>
55 #include <qdebug.h>
56 #include <qtimer.h>
57 #include <qevent.h>
58 #include <qdir.h>
59 #include <qcoreapplication.h>
60 #include <qfontdatabase.h>
61 #include <qicon.h>
62 #include <qurl.h>
63 #include <qlayout.h>
64 #include <qwidget.h>
65 #include <qgraphicswidget.h>
66 #include <qbasictimer.h>
67 #include <QtCore/qabstractanimation.h>
68 #include <private/qgraphicsview_p.h>
69 #include <private/qdeclarativeitem_p.h>
70 #include <private/qabstractanimation_p.h>
71 #include <private/qdeclarativeitemchangelistener_p.h>
72 
74 
75 DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE)
76 
78 {
79 public:
80  QDeclarativeScene(QObject *parent = 0);
81 
82 protected:
83  virtual void keyPressEvent(QKeyEvent *);
84  virtual void keyReleaseEvent(QKeyEvent *);
85 
86  virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *);
87  virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
88  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
89 };
90 
92 {
93 }
94 
96 {
98 
100 }
101 
103 {
105 
107 }
108 
110 {
112 
114 }
115 
117 {
119 
121 }
122 
124 {
126 
128 }
129 
131 {
133 public:
135  : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0),
136  resizeMode(QDeclarativeView::SizeViewToRootObject), initialSize(0,0) {}
137  ~QDeclarativeViewPrivate() { delete root; delete engine; }
138  void execute();
139  void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
140  void initResize();
141  void updateSize();
142  inline QSize rootObjectSize() const;
143 
147 
149 
153 
157 
158  void init();
159 };
160 
162 {
164  if (root) {
165  delete root;
166  root = 0;
167  }
168  if (component) {
169  delete component;
170  component = 0;
171  }
172  if (!source.isEmpty()) {
173  component = new QDeclarativeComponent(engine, source, q);
174  if (!component->isLoading()) {
175  q->continueExecute();
176  } else {
177  QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute()));
178  }
179  }
180 }
181 
182 void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry)
183 {
185  if (resizeItem == root && resizeMode == QDeclarativeView::SizeViewToRootObject) {
186  // wait for both width and height to be changed
187  resizetimer.start(0,q);
188  }
189  QDeclarativeItemChangeListener::itemGeometryChanged(resizeItem, newGeometry, oldGeometry);
190 }
191 
266  : QGraphicsView(*(new QDeclarativeViewPrivate), parent)
267 {
270  d->init();
271 }
272 
279  : QGraphicsView(*(new QDeclarativeViewPrivate), parent)
280 {
283  d->init();
284  setSource(source);
285 }
286 
288 {
290  engine = new QDeclarativeEngine();
291  q->setScene(new QDeclarativeScene(q));
292 
293  q->setOptimizationFlags(QGraphicsView::DontSavePainterState);
294  q->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
295  q->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
296  q->setFrameStyle(0);
297 
298  // These seem to give the best performance
299  q->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
300  q->scene()->setItemIndexMethod(QGraphicsScene::NoIndex);
301  q->viewport()->setFocusPolicy(Qt::NoFocus);
302  q->setFocusPolicy(Qt::StrongFocus);
303 
304  q->scene()->setStickyFocus(true); //### needed for correct focus handling
305 
306 #ifdef QDECLARATIVEVIEW_NOBACKGROUND
307  q->setAttribute(Qt::WA_OpaquePaintEvent);
308  q->setAttribute(Qt::WA_NoSystemBackground);
309  q->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
310  q->viewport()->setAttribute(Qt::WA_NoSystemBackground);
311 #endif
312 
314 }
315 
320 {
322 }
323 
348 {
350  d->source = url;
351  d->execute();
352 }
353 
360 {
361  Q_D(const QDeclarativeView);
362  return d->source;
363 }
364 
370 {
371  Q_D(const QDeclarativeView);
372  return d->engine;
373 }
374 
383 {
384  Q_D(const QDeclarativeView);
385  return d->engine->rootContext();
386 }
387 
422 {
423  Q_D(const QDeclarativeView);
424  if (!d->component)
425  return QDeclarativeView::Null;
426 
427  return QDeclarativeView::Status(d->component->status());
428 }
429 
435 {
436  Q_D(const QDeclarativeView);
437  if (d->component)
438  return d->component->errors();
439  return QList<QDeclarativeError>();
440 }
441 
461 {
463  if (d->resizeMode == mode)
464  return;
465 
466  if (d->declarativeItemRoot) {
467  if (d->resizeMode == SizeViewToRootObject) {
469  static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(d->declarativeItemRoot));
471  }
472  } else if (d->graphicsWidgetRoot) {
473  if (d->resizeMode == QDeclarativeView::SizeViewToRootObject) {
474  d->graphicsWidgetRoot->removeEventFilter(this);
475  }
476  }
477 
478  d->resizeMode = mode;
479  if (d->root) {
480  d->initResize();
481  }
482 }
483 
485 {
487  if (declarativeItemRoot) {
490  static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(declarativeItemRoot));
492  }
493  } else if (graphicsWidgetRoot) {
495  graphicsWidgetRoot->installEventFilter(q);
496  }
497  }
498  updateSize();
499 }
500 
502 {
504  if (!root)
505  return;
506  if (declarativeItemRoot) {
508  QSize newSize = QSize(declarativeItemRoot->width(), declarativeItemRoot->height());
509  if (newSize.isValid() && newSize != q->size()) {
510  q->resize(newSize);
511  }
513  if (!qFuzzyCompare(q->width(), declarativeItemRoot->width()))
514  declarativeItemRoot->setWidth(q->width());
515  if (!qFuzzyCompare(q->height(), declarativeItemRoot->height()))
516  declarativeItemRoot->setHeight(q->height());
517  }
518  } else if (graphicsWidgetRoot) {
520  QSize newSize = QSize(graphicsWidgetRoot->size().width(), graphicsWidgetRoot->size().height());
521  if (newSize.isValid() && newSize != q->size()) {
522  q->resize(newSize);
523  }
525  QSizeF newSize = QSize(q->size().width(), q->size().height());
526  if (newSize.isValid() && newSize != graphicsWidgetRoot->size()) {
527  graphicsWidgetRoot->resize(newSize);
528  }
529  }
530  }
531  q->updateGeometry();
532 }
533 
535 {
536  QSize rootObjectSize(0,0);
537  int widthCandidate = -1;
538  int heightCandidate = -1;
539  if (root) {
540  QSizeF size = root->boundingRect().size();
541  widthCandidate = size.width();
542  heightCandidate = size.height();
543  }
544  if (widthCandidate > 0) {
545  rootObjectSize.setWidth(widthCandidate);
546  }
547  if (heightCandidate > 0) {
548  rootObjectSize.setHeight(heightCandidate);
549  }
550  return rootObjectSize;
551 }
552 
554 {
555  Q_D(const QDeclarativeView);
556  return d->resizeMode;
557 }
558 
563 {
566 
567  if (d->component->isError()) {
568  QList<QDeclarativeError> errorList = d->component->errors();
569  foreach (const QDeclarativeError &error, errorList) {
570  qWarning() << error;
571  }
573  return;
574  }
575 
576  QObject *obj = d->component->create();
577 
578  if(d->component->isError()) {
579  QList<QDeclarativeError> errorList = d->component->errors();
580  foreach (const QDeclarativeError &error, errorList) {
581  qWarning() << error;
582  }
584  return;
585  }
586 
587  setRootObject(obj);
589 }
590 
595 {
597  if (d->root == obj || !scene())
598  return;
599  if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem *>(obj)) {
600  scene()->addItem(declarativeItem);
601  d->root = declarativeItem;
602  d->declarativeItemRoot = declarativeItem;
603  } else if (QGraphicsObject *graphicsObject = qobject_cast<QGraphicsObject *>(obj)) {
604  scene()->addItem(graphicsObject);
605  d->root = graphicsObject;
606  if (graphicsObject->isWidget()) {
607  d->graphicsWidgetRoot = static_cast<QGraphicsWidget*>(graphicsObject);
608  } else {
609  qWarning() << "QDeclarativeView::resizeMode is not honored for components of type QGraphicsObject";
610  }
611  } else if (obj) {
612  qWarning() << "QDeclarativeView only supports loading of root objects that derive from QGraphicsObject";
613  if (QWidget* widget = qobject_cast<QWidget *>(obj)) {
616  if (layout() && layout()->count()) {
617  // Hide the QGraphicsView in GV mode.
618  QLayoutItem *item = layout()->itemAt(0);
619  if (item->widget())
620  item->widget()->hide();
621  }
622  widget->setParent(this);
623  if (isVisible()) {
624  widget->setVisible(true);
625  }
626  resize(widget->size());
627  }
628  }
629 
630  if (d->root) {
631  d->initialSize = d->rootObjectSize();
632  if (d->initialSize != size()) {
633  if (!(parentWidget() && parentWidget()->layout())) {
634  resize(d->initialSize);
635  }
636  }
637  d->initResize();
638  }
639 }
640 
650 {
652  if (!e || e->timerId() == d->resizetimer.timerId()) {
653  d->updateSize();
654  d->resizetimer.stop();
655  }
656 }
657 
660 {
662  if (watched == d->root && d->resizeMode == SizeViewToRootObject) {
663  if (d->graphicsWidgetRoot) {
664  if (e->type() == QEvent::GraphicsSceneResize) {
665  d->updateSize();
666  }
667  }
668  }
669  return QGraphicsView::eventFilter(watched, e);
670 }
671 
680 {
681  Q_D(const QDeclarativeView);
682  QSize rootObjectSize = d->rootObjectSize();
683  if (rootObjectSize.isEmpty()) {
684  return size();
685  } else {
686  return rootObjectSize;
687  }
688 }
689 
694 {
695  Q_D(const QDeclarativeView);
696  return d->initialSize;
697 }
698 
703 {
704  Q_D(const QDeclarativeView);
705  return d->root;
706 }
707 
717 {
719  if (d->resizeMode == SizeRootObjectToView) {
720  d->updateSize();
721  }
722  if (d->declarativeItemRoot) {
723  setSceneRect(QRectF(0, 0, d->declarativeItemRoot->width(), d->declarativeItemRoot->height()));
724  } else if (d->root) {
725  setSceneRect(d->root->boundingRect());
726  } else {
727  setSceneRect(rect());
728  }
729  emit sceneResized(e->size());
731 }
732 
737 {
739 
742 
743  int time = 0;
744  if (frameRateDebug())
745  time = d->frameTimer.restart();
746 
748 
750 
751  if (frameRateDebug())
752  qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time;
753 
754 #if QT_SHOW_DECLARATIVEVIEW_FPS
755  static QTime timer;
756  static int frames;
757 
758  if (frames == 0) {
759  timer.start();
760  } else if (timer.elapsed() > 5000) {
761  qreal avgtime = timer.elapsed() / (qreal) frames;
762  qDebug("Average time per frame: %f ms (%i fps)", avgtime, int(1000 / avgtime));
763  timer.start();
764  frames = 0;
765  }
766  ++frames;
767  scene()->update();
768 #endif
769 
770 }
771 
QDeclarativeContext * rootContext() const
This function returns the root of the context hierarchy.
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse release...
double d
Definition: qnumeric_p.h:62
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items...
Status
Emitted after component "startup" has completed.
The QKeyEvent class describes a key event.
Definition: qevent.h:224
virtual QLayoutItem * itemAt(int index) const =0
Must be implemented in subclasses to return the layout item at index.
double qreal
Definition: qglobal.h:1193
QDeclarativeView(QWidget *parent=0)
Constructs a QDeclarativeView with the given parent.
QUrl source() const
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
QSize size() const
QPointer< QWidget > widget
void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
QDeclarativeGuard< QGraphicsWidget > graphicsWidgetRoot
virtual void paintEvent(QPaintEvent *event)
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
virtual ~QDeclarativeView()
Destroys the view.
static void addEvent(EventType)
ResizeMode
This enum specifies how to resize the view.
QDeclarativeGuard< QDeclarativeItem > declarativeItemRoot
void start()
Sets this time to the current time.
Definition: qdatetime.cpp:2070
virtual void setRootObject(QObject *obj)
bool isVisible() const
Definition: qwidget.h:1005
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse release...
qreal width() const
Returns the width.
Definition: qsize.h:284
#define error(msg)
#define SLOT(a)
Definition: qobjectdefs.h:226
qreal height() const
Returns the height.
Definition: qsize.h:287
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
QList< QDeclarativeError > errors() const
Return the list of errors that occurred during the last compile or create operation.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
virtual bool eventFilter(QObject *watched, QEvent *e)
static Q_DECL_CONSTEXPR bool qFuzzyCompare(double p1, double p2)
Definition: qglobal.h:2030
void addItem(QGraphicsItem *item)
Adds or moves the item and all its childen to this scene.
EventLoopTimerRef timer
static QDeclarativeInspectorService * instance()
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse press e...
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:281
QDeclarativeScene(QObject *parent=0)
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
virtual void keyPressEvent(QKeyEvent *event)
This event handler, for event keyEvent, can be reimplemented in a subclass to receive keypress events...
#define Q_D(Class)
Definition: qglobal.h:2482
The QElapsedTimer class provides a fast way to calculate elapsed times.
Definition: qelapsedtimer.h:53
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
#define Q_Q(Class)
Definition: qglobal.h:2483
void setWidth(int w)
Sets the width to the given width.
Definition: qsize.h:132
virtual void mousePressEvent(QGraphicsSceneMouseEvent *)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse press e...
Q_CORE_EXPORT void qDebug(const char *,...)
#define SIGNAL(a)
Definition: qobjectdefs.h:227
virtual void timerEvent(QTimerEvent *)
If the QTimerEvent {timer event} e is this view&#39;s resize timer, sceneResized() is emitted...
The QTime class provides clock time functions.
Definition: qdatetime.h:148
virtual void keyReleaseEvent(QKeyEvent *event)
This event handler, for event keyEvent, can be reimplemented in a subclass to receive key release eve...
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual void keyReleaseEvent(QKeyEvent *)
This event handler, for event keyEvent, can be reimplemented in a subclass to receive key release eve...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
The QDeclarativeComponent class encapsulates a QML component definition.
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse move ev...
The QDeclarativeItem class provides the most basic of all visual items in QML.
void resizeEvent(QResizeEvent *event)
Reimplemented Function
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 addItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types)
QGraphicsObject * rootObject() const
Returns the view&#39;s root QGraphicsObject {item}.
static bool init
#define emit
Definition: qobjectdefs.h:76
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
void setResizeMode(ResizeMode)
Q_CORE_EXPORT void qWarning(const char *,...)
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Definition: qcoreevent.h:346
#define DEFINE_BOOL_CONFIG_OPTION(name, var)
The QDeclarativeError class encapsulates a QML error.
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
static qreal component(const QPointF &point, unsigned int i)
virtual void itemGeometryChanged(QDeclarativeItem *, const QRectF &, const QRectF &)
QRect rect() const
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991
void hide()
Hides the widget.
Definition: qwidget.h:501
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qobject.cpp:1375
void update(qreal x, qreal y, qreal w, qreal h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static void endRange(RangeType)
static void startRange(RangeType)
QDeclarativeGuard< QGraphicsObject > root
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
void removeItemChangeListener(QDeclarativeItemChangeListener *, ChangeTypes types)
int elapsed() const
Returns the number of milliseconds that have elapsed since the last time start() or restart() was cal...
Definition: qdatetime.cpp:2123
bool event(QEvent *event)
Reimplemented Function
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
void setSource(const QUrl &)
Sets the source to the url, loads the QML component and instantiates it.
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
void setSceneRect(const QRectF &rect)
Status status() const
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
The QDeclarativeEngine class provides an environment for instantiating QML components.
ResizeMode resizeMode() const
QDeclarativeEngine * engine() const
Returns a pointer to the QDeclarativeEngine used for instantiating QML Components.
const QSize & size() const
Returns the new size of the widget.
Definition: qevent.h:355
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse move ev...
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
void sceneResized(QSize size)
This signal is emitted when the view is resized to size.
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:123
The QDeclarativeContext class defines a context within a QML engine.
static const QGraphicsItemPrivate * get(const QGraphicsItem *item)
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QSize initialSize() const
Returns the initial size of the root object.
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
Definition: qgraphicsview.h:64
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
The QBasicTimer class provides timer events for objects.
Definition: qbasictimer.h:55
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
void paintEvent(QPaintEvent *event)
Reimplemented Function
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void statusChanged(QDeclarativeView::Status)
This signal is emitted when the component&#39;s current status changes.
QDeclarativeView::ResizeMode resizeMode
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
Definition: qsize.h:120
Status
Specifies the loading status of the QDeclarativeView.
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
#define class
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
QDeclarativeComponent * component
The QGraphicsObject class provides a base class for all graphics items that require signals...
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
QGraphicsScene * scene() const
Returns a pointer to the scene that is currently visualized in the view.
virtual void resizeEvent(QResizeEvent *)
This function handles the QResizeEvent {resize event} e.
QSize sizeHint() const
Preferred size follows the root object geometry.
virtual void keyPressEvent(QKeyEvent *)
This event handler, for event keyEvent, can be reimplemented in a subclass to receive keypress events...
QDeclarativeEngine * engine
The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene.