File indexing completed on 2024-05-05 17:04:28
0001 /* This file is part of the KDE project 0002 * Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2013 0003 * 0004 * This program is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU General Public License as published by 0006 * the Free Software Foundation; either version 2 of the License, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0017 */ 0018 0019 #ifndef TOUCHDECLARATIVEVIEW_H 0020 #define TOUCHDECLARATIVEVIEW_H 0021 0022 #include <QQuickView> 0023 #include <QPointer> 0024 0025 /** 0026 * @brief The SketchDeclarativeView class overrides QGraphicsView's drawBackground 0027 */ 0028 class TouchDeclarativeView : public QQuickView 0029 { 0030 Q_OBJECT 0031 0032 Q_PROPERTY(bool drawCanvas READ drawCanvas WRITE setDrawCanvas NOTIFY drawCanvasChanged); 0033 Q_PROPERTY(QWidget* canvasWidget READ canvasWidget WRITE setCanvasWidget NOTIFY canvasWidgetChanged); 0034 0035 public: 0036 explicit TouchDeclarativeView(QWindow *parent = 0); 0037 TouchDeclarativeView(const QUrl &url, QWindow *parent = 0); 0038 virtual ~TouchDeclarativeView(); 0039 0040 QWidget* canvasWidget() const; 0041 void setCanvasWidget(QWidget *canvasWidget); 0042 0043 bool drawCanvas() const; 0044 void setDrawCanvas(bool drawCanvas); 0045 0046 Q_SIGNALS: 0047 void canvasWidgetChanged(); 0048 void drawCanvasChanged(); 0049 0050 protected: 0051 // void resizeEvent(QResizeEvent *event); 0052 // virtual bool event(QEvent* event); 0053 // virtual bool eventFilter(QObject* watched, QEvent* e); 0054 0055 // void drawBackground(QPainter *painter, const QRectF &rect); 0056 0057 private: 0058 bool m_drawCanvas; 0059 QPointer<QWidget> m_canvasWidget; 0060 bool m_GLInitialized; 0061 Q_SLOT void resetInitialized(); 0062 }; 0063 0064 #endif // TOUCHDECLARATIVEVIEW_H