libqutim
0.3.2.0
|
00001 /**************************************************************************** 00002 ** 00003 ** qutIM - instant messenger 00004 ** 00005 ** Copyright © 2012 Aleksey Sidorov <gorthauer87@yandex.ru> 00006 ** 00007 ***************************************************************************** 00008 ** 00009 ** $QUTIM_BEGIN_LICENSE$ 00010 ** This program is free software: you can redistribute it and/or modify 00011 ** it under the terms of the GNU General Public License as published by 00012 ** the Free Software Foundation, either version 3 of the License, or 00013 ** (at your option) any later version. 00014 ** 00015 ** This program is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 ** See the GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program. If not, see http://www.gnu.org/licenses/. 00022 ** $QUTIM_END_LICENSE$ 00023 ** 00024 ****************************************************************************/ 00025 00026 #ifndef QUTIM_SDK_0_3_DECLARATIVEVIEW_H 00027 #define QUTIM_SDK_0_3_DECLARATIVEVIEW_H 00028 #include <QGraphicsView> 00029 #include "libqutim_global.h" 00030 00031 class QDeclarativeEngine; 00032 class QDeclarativeContext; 00033 class QDeclarativeItem; 00034 class QUrl; 00035 00036 namespace qutim_sdk_0_3 { 00037 00038 class DeclarativeViewPrivate; 00039 00040 class LIBQUTIM_EXPORT DeclarativeView : public QGraphicsView 00041 { 00042 Q_OBJECT 00043 Q_DECLARE_PRIVATE(DeclarativeView) 00044 00045 Q_PROPERTY(Status status READ status NOTIFY statusChanged) 00046 Q_PROPERTY(QUrl source READ source WRITE setSource DESIGNABLE true) 00047 Q_ENUMS(Status ResizeMode) 00048 public: 00049 explicit DeclarativeView(QWidget *parent = 0); 00050 virtual ~DeclarativeView(); 00051 00052 static void setEngine(QDeclarativeEngine *engine); 00053 static QDeclarativeEngine *engine(); 00054 00055 void setSource(const QUrl &source); 00056 QUrl source() const; 00057 QDeclarativeContext *rootContext() const; 00058 QObject *rootObject() const; 00059 enum Status { Null, Ready, Loading, Error }; 00060 Status status() const; 00061 enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView }; 00062 ResizeMode resizeMode() const; 00063 void setResizeMode(ResizeMode); 00064 signals: 00065 void sceneResized(const QSize &size); 00066 void statusChanged(qutim_sdk_0_3::DeclarativeView::Status); 00067 protected: 00068 virtual void resizeEvent(QResizeEvent *event); 00069 virtual void setRootObject(QObject *object); 00070 virtual bool eventFilter(QObject *obj, QEvent *ev); 00071 00072 QScopedPointer<DeclarativeViewPrivate> d_ptr; 00073 private: 00074 Q_PRIVATE_SLOT(d_func(), void _q_updateView()) 00075 Q_PRIVATE_SLOT(d_func(), void _q_continueExecute()) 00076 }; 00077 00078 } // namespace qutim_sdk_0_3 00079 00080 #endif // QUTIM_SDK_0_3_DECLARATIVEVIEW_H