/usr/include/vtk-7.1/QVTKWidget.h is in libvtk7-qt-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | /*=========================================================================
Program: Visualization Toolkit
Module: QVTKWidget.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
Copyright 2004 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
license for use of this work by or on behalf of the
U.S. Government. Redistribution and use in source and binary forms, with
or without modification, are permitted provided that this Notice and any
statement of authorship are reproduced on all copies.
=========================================================================*/
/*========================================================================
For general information about using VTK and Qt, see:
http://www.trolltech.com/products/3rdparty/vtksupport.html
=========================================================================*/
// .NAME QVTKWidget - Display a vtkRenderWindow in a Qt's QWidget.
// .SECTION Description
// QVTKWidget provides a way to display VTK data in a Qt widget.
#ifndef Q_VTK_WIDGET_H
#define Q_VTK_WIDGET_H
#include "vtkGUISupportQtModule.h" // For export macro
#include "QVTKInteractor.h"
#include <QWidget>
#include <QTimer>
class QVTKInteractorAdapter;
class vtkRenderWindow;
#include <vtkConfigure.h>
#include <vtkToolkits.h>
class vtkImageData;
#include "vtkTDxConfigure.h" // defines VTK_USE_TDX
#ifdef VTK_USE_TDX
class vtkTDxDevice;
#endif
#if defined(Q_WS_MAC)
# if defined(QT_MAC_USE_COCOA) && defined(VTK_USE_COCOA)
# define QVTK_USE_COCOA
# elif defined(VTK_USE_COCOA)
# error "VTK configured to use Cocoa, but Qt configured to use Carbon"
# endif
#endif
#include "QVTKWin32Header.h"
//! QVTKWidget displays a VTK window in a Qt window.
class VTKGUISUPPORTQT_EXPORT QVTKWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(bool automaticImageCacheEnabled
READ isAutomaticImageCacheEnabled
WRITE setAutomaticImageCacheEnabled)
Q_PROPERTY(double maxRenderRateForImageCache
READ maxRenderRateForImageCache
WRITE setMaxRenderRateForImageCache)
Q_PROPERTY(bool deferRenderInPaintEvent
READ deferRenderInPaintEvent
WRITE setDeferRenderInPaintEvent)
public:
//! constructor
QVTKWidget(QWidget* parent = NULL, Qt::WindowFlags f = 0);
//! destructor
virtual ~QVTKWidget();
// Description:
// Set the vtk render window, if you wish to use your own vtkRenderWindow
virtual void SetRenderWindow(vtkRenderWindow*);
// Description:
// Get the vtk render window.
virtual vtkRenderWindow* GetRenderWindow();
// Description:
// Get the Qt/vtk interactor that was either created by default or set by the user
virtual QVTKInteractor* GetInteractor();
// Description:
// Enum for additional event types supported.
// These events can be picked up by command observers on the interactor
enum vtkCustomEvents
{
ContextMenuEvent = QVTKInteractor::ContextMenuEvent,
DragEnterEvent = QVTKInteractor::DragEnterEvent,
DragMoveEvent = QVTKInteractor::DragMoveEvent,
DragLeaveEvent = QVTKInteractor::DragLeaveEvent,
DropEvent = QVTKInteractor::DropEvent
};
// Description:
// Enables/disables automatic image caching. If disabled (the default),
// QVTKWidget will not call saveImageToCache() on its own.
virtual void setAutomaticImageCacheEnabled(bool flag);
virtual bool isAutomaticImageCacheEnabled() const;
// Description:
// If automatic image caching is enabled, then the image will be cached
// after every render with a DesiredUpdateRate that is less than
// this parameter. By default, the vtkRenderWindowInteractor will
// change the desired render rate depending on the user's
// interactions. (See vtkRenderWindow::DesiredUpdateRate,
// vtkRenderWindowInteractor::DesiredUpdateRate and
// vtkRenderWindowInteractor::StillUpdateRate for more details.)
virtual void setMaxRenderRateForImageCache(double rate);
virtual double maxRenderRateForImageCache() const;
// Description:
// Returns the current image in the window. If the image cache is up
// to date, that is returned to avoid grabbing other windows.
virtual vtkImageData* cachedImage();
// Description:
// Handle showing of the Widget
virtual void showEvent(QShowEvent*);
virtual QPaintEngine* paintEngine() const;
// Description:
// Use a 3DConnexion device. Initial value is false.
// If VTK is not build with the TDx option, this is no-op.
// If VTK is build with the TDx option, and a device is not connected,
// a warning is emitted.
// It is must be called before the first Render to be effective, otherwise
// it is ignored.
void SetUseTDx(bool useTDx);
bool GetUseTDx() const;
// Description:
// When set to true (default is false), paintEvent() will never directly trigger
// a render on the vtkRenderWindow (via vtkRenderWindowInteractor::Render()).
// Instead, it starts a timer that then triggers the render on idle. This, in
// general is a good strategy for cases where Render may take a while with
// applications wanting to report progress and consequently trigger paint
// events on other widgets like progress bars, etc.
// There is one caveat: when paintEvent() is called using a redirected paint device,
// then this flag is ignored and the paintEvent() will trigger
// vtkRenderWindowInteractor::Render(), if needed.
void setDeferRenderInPaintEvent(bool val);
bool deferRenderInPaintEvent() const;
Q_SIGNALS:
// Description:
// This signal will be emitted whenever a mouse event occurs
// within the QVTK window
void mouseEvent(QMouseEvent* event);
// Description:
// This signal will be emitted whenever the cached image goes from clean
// to dirty.
void cachedImageDirty();
// Description:
// This signal will be emitted whenever the cached image is refreshed.
void cachedImageClean();
public Q_SLOTS:
// Description:
// This will mark the cached image as dirty. This slot is automatically
// invoked whenever the render window has a render event or the widget is
// resized. Your application should invoke this slot whenever the image in
// the render window is changed by some other means. If the image goes
// from clean to dirty, the cachedImageDirty() signal is emitted.
void markCachedImageAsDirty();
// Description:
// If the cached image is dirty, it is updated with the current image in
// the render window and the cachedImageClean() signal is emitted.
void saveImageToCache();
// Description:
// Receive notification of the creation of the TDxDevice.
// Only relevant for Unix.
#ifdef VTK_USE_TDX
void setDevice(vtkTDxDevice *device);
#endif
protected Q_SLOTS:
// Description:
// Request to defer a render call i.e. start the mDeferedRenderTimer. When the
// timer times out, it will call doDeferredRender() to do the actual
// rendering.
virtual void deferRender();
// Description:
// Called when the mDeferedRenderTimer times out to do the rendering.
virtual void doDeferredRender();
protected:
// overloaded resize handler
virtual void resizeEvent(QResizeEvent* event);
// overloaded move handler
virtual void moveEvent(QMoveEvent* event);
// overloaded paint handler
virtual void paintEvent(QPaintEvent* event);
// overloaded mouse press handler
virtual void mousePressEvent(QMouseEvent* event);
// overloaded mouse move handler
virtual void mouseMoveEvent(QMouseEvent* event);
// overloaded mouse release handler
virtual void mouseReleaseEvent(QMouseEvent* event);
// overloaded key press handler
virtual void keyPressEvent(QKeyEvent* event);
// overloaded key release handler
virtual void keyReleaseEvent(QKeyEvent* event);
// overloaded enter event
virtual void enterEvent(QEvent*);
// overloaded leave event
virtual void leaveEvent(QEvent*);
#ifndef QT_NO_WHEELEVENT
// overload wheel mouse event
virtual void wheelEvent(QWheelEvent*);
#endif
// overload focus event
virtual void focusInEvent(QFocusEvent*);
// overload focus event
virtual void focusOutEvent(QFocusEvent*);
// overload Qt's event() to capture more keys
bool event( QEvent* e );
// overload context menu event
virtual void contextMenuEvent(QContextMenuEvent*);
// overload drag enter event
virtual void dragEnterEvent(QDragEnterEvent*);
// overload drag move event
virtual void dragMoveEvent(QDragMoveEvent*);
// overload drag leave event
virtual void dragLeaveEvent(QDragLeaveEvent*);
// overload drop event
virtual void dropEvent(QDropEvent*);
// method called in paintEvent() to render the image cache on to the device.
// return false, if cache couldn;t be used for painting. In that case, the
// paintEvent() method will continue with the default painting code.
virtual bool paintCachedImage();
// the vtk render window
vtkRenderWindow* mRenWin;
bool UseTDx;
// the paint engine
QPaintEngine* mPaintEngine;
// set up an X11 window based on a visual and colormap
// that VTK chooses
void x11_setup_window();
#if defined(Q_OS_WIN)
bool winEvent(MSG* msg, long* result);
#if QT_VERSION >= 0x050000
bool nativeEvent(const QByteArray& eventType, void* message, long* result);
#endif
#endif
protected:
vtkImageData* mCachedImage;
bool cachedImageCleanFlag;
bool automaticImageCache;
double maxImageCacheRenderRate;
QVTKInteractorAdapter* mIrenAdapter;
bool mDeferRenderInPaintEvent;
private:
//! unimplemented operator=
QVTKWidget const& operator=(QVTKWidget const&);
//! unimplemented copy
QVTKWidget(const QVTKWidget&);
unsigned long renderEventCallbackObserverId;
// Description:
// Callback called on every vtkCommand::RenderEvent fired by the
// vtkRenderWindow.
void renderEventCallback();
QTimer mDeferedRenderTimer;
};
#endif
|