libqutim  0.3.1.0
declarativeview.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** qutIM - instant messenger
4 **
5 ** Copyright © 2012 Aleksey Sidorov <gorthauer87@yandex.ru>
6 **
7 *****************************************************************************
8 **
9 ** $QUTIM_BEGIN_LICENSE$
10 ** This program is free software: you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License as published by
12 ** the Free Software Foundation, either version 3 of the License, or
13 ** (at your option) any later version.
14 **
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 ** See the GNU General Public License for more details.
19 **
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program. If not, see http://www.gnu.org/licenses/.
22 ** $QUTIM_END_LICENSE$
23 **
24 ****************************************************************************/
25 
26 #ifndef QUTIM_SDK_0_3_DECLARATIVEVIEW_H
27 #define QUTIM_SDK_0_3_DECLARATIVEVIEW_H
28 #include <QGraphicsView>
29 #include "libqutim_global.h"
30 
31 class QDeclarativeEngine;
32 class QDeclarativeContext;
33 class QDeclarativeItem;
34 class QUrl;
35 
36 namespace qutim_sdk_0_3 {
37 
38 class DeclarativeViewPrivate;
39 
40 class LIBQUTIM_EXPORT DeclarativeView : public QGraphicsView
41 {
42  Q_OBJECT
43  Q_DECLARE_PRIVATE(DeclarativeView)
44 
45  Q_PROPERTY(Status status READ status NOTIFY statusChanged)
46  Q_PROPERTY(QUrl source READ source WRITE setSource DESIGNABLE true)
47  Q_ENUMS(Status ResizeMode)
48 public:
49  explicit DeclarativeView(QWidget *parent = 0);
50  virtual ~DeclarativeView();
51 
52  static void setEngine(QDeclarativeEngine *engine);
53  static QDeclarativeEngine *engine();
54 
55  void setSource(const QUrl &source);
56  QUrl source() const;
57  QDeclarativeContext *rootContext() const;
58  QObject *rootObject() const;
59  enum Status { Null, Ready, Loading, Error };
60  Status status() const;
61  enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView };
62  ResizeMode resizeMode() const;
63  void setResizeMode(ResizeMode);
64 signals:
65  void sceneResized(const QSize &size);
66  void statusChanged(qutim_sdk_0_3::DeclarativeView::Status);
67 protected:
68  virtual void resizeEvent(QResizeEvent *event);
69  virtual void setRootObject(QObject *object);
70  virtual bool eventFilter(QObject *obj, QEvent *ev);
71 
72  QScopedPointer<DeclarativeViewPrivate> d_ptr;
73 private:
74  Q_PRIVATE_SLOT(d_func(), void _q_updateView())
75  Q_PRIVATE_SLOT(d_func(), void _q_continueExecute())
76 };
77 
78 } // namespace qutim_sdk_0_3
79 
80 #endif // QUTIM_SDK_0_3_DECLARATIVEVIEW_H

Generated by Doxygen