<commit_before>/*
 * 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
=========================================================================*/

/*========================================================================
 !!! WARNING for those who want to contribute code to this file.
 !!! If you use a commercial edition of Qt, you can modify this code.
 !!! If you use an open source version of Qt, you are free to modify
 !!! and use this code within the guidelines of the GPL license.
 !!! Unfortunately, you cannot contribute the changes back into this
 !!! file.  Doing so creates a conflict between the GPL and BSD-like VTK
 !!! license.
=========================================================================*/

#if !defined(_DEBUG)
# if !defined(QT_NO_DEBUG)
#  define QT_NO_DEBUG
# endif
#endif

#include "Q4VTKWidgetPlugin.h"

#include "qobject.h"
#include "QVTKWidget.h"
#include "QVTKWidget.xpm"

#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkSphereSource.h"
#include "vtkDataSetMapper.h"
#include "vtkPolyData.h"
#include "vtkElevationFilter.h"
#include "vtkActor.h"

// macro for debug printing
#define qDebug(a)
//#define qDebug(a) printf(a)

QVTKWidgetPlugin::QVTKWidgetPlugin()
{
  qDebug("QVTKWidgetPlugin instantiated\n");
}

QVTKWidgetPlugin::~QVTKWidgetPlugin()
{
  qDebug("QVTKWidgetPlugin destructed\n");
}
    
//! return the name of this widget
QString QVTKWidgetPlugin::name() const
{
  qDebug("QVTKWidgetPlugin::name\n");
  return "QVTKWidget";
}

QString QVTKWidgetPlugin::domXml() const
{
  return QLatin1String("<widget class=\"QVTKWidget\" name=\"qvtkWidget\"></widget>");
}

QWidget* QVTKWidgetPlugin::createWidget(QWidget* parent)
{
  qDebug("QVTKWidgetPlugin::createWidget\n");
  QVTKWidget* widget = new QVTKWidget(parent);
  // gotta make a renderer so we get a nice black background in the designer
  vtkRenderer* ren = vtkRenderer::New();
  widget->GetRenderWindow()->AddRenderer(ren);

  // also for fun, let's make a cylinder and put it in the window
  // this REALLY lets the user know that a QVTKWidget works in the designer
  vtkSphereSource* cyl = vtkSphereSource::New();
  vtkElevationFilter* ele = vtkElevationFilter::New();
  ele->SetLowPoint(0.0, -0.5, 0.0);
  ele->SetHighPoint(0.0, 0.5, 0.0);
  ele->SetInput(cyl->GetOutput());
  vtkDataSetMapper* mapper = vtkDataSetMapper::New();
  mapper->SetInput(ele->GetOutput());
  ele->Delete();
  cyl->Delete();
  vtkActor* actor = vtkActor::New();
  actor->SetMapper(mapper);
  mapper->Delete();<commit_msg>BUG: Fix for display in Qt 4.0.1 designer during interaction (from <NAME>).<commit_after>/*
 * 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
=========================================================================*/

/*========================================================================
 !!! WARNING for those who want to contribute code to this file.
 !!! If you use a commercial edition of Qt, you can modify this code.
 !!! If you use an open source version of Qt, you are free to modify
 !!! and use this code within the guidelines of the GPL license.
 !!! Unfortunately, you cannot contribute the changes back into this
 !!! file.  Doing so creates a conflict between the GPL and BSD-like VTK
 !!! license.
=========================================================================*/

#if !defined(_DEBUG)
# if !defined(QT_NO_DEBUG)
#  define QT_NO_DEBUG
# endif
#endif

#include "Q4VTKWidgetPlugin.h"

#include "qobject.h"
#include "QVTKWidget.h"
#include "QVTKWidget.xpm"

#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkSphereSource.h"
#include "vtkDataSetMapper.h"
#include "vtkPolyData.h"
#include "vtkElevationFilter.h"
#include "vtkActor.h"

// macro for debug printing
#define qDebug(a)
//#define qDebug(a) printf(a)

QVTKWidgetPlugin::QVTKWidgetPlugin()
{
  qDebug("QVTKWidgetPlugin instantiated\n");
}

QVTKWidgetPlugin::~QVTKWidgetPlugin()
{
  qDebug("QVTKWidgetPlugin destructed\n");
}
    
//! return the name of this widget
QString QVTKWidgetPlugin::name() const
{
  qDebug("QVTKWidgetPlugin::name\n");
  return "QVTKWidget";
}

QString QVTKWidgetPlugin::domXml() const
{
  return QLatin1String("<widget class=\"QVTKWidget\" name=\"qvtkWidget\">\n"
                       " <property name=\"geometry\">\n"
                       "  <rect>\n"
                       "   <x>0</x>\n"
                       "   <y>0</y>\n"
                       "   <width>100</width>\n"
                       "   <height>100</height>\n"
                       "  </rect>\n"
                       " </property>\n"
                       "</widget>\n");
}

QWidget* QVTKWidgetPlugin::createWidget(QWidget* parent)
{
  qDebug("QVTKWidgetPlugin::createWidget\n");
  QVTKWidget* widget = new QVTKWidget(parent);
  // gotta make a renderer so we get a nice black background in the designer
  vtkRenderer* ren = vtkRenderer::New();
  widget->GetRenderWindow()->AddRenderer(ren);

  // also for fun, let's make a cylinder and put it in the window
  // this REALLY lets the user know that a QVTKWidget works in the designer
  vtkSphereSource* cyl = vtkSphereSource::New();
  vtkElevationFilter* ele = vtkElevationFilter::New();
  ele->SetLowPoint(0.0, -0.5, 0.0);
  ele->SetHighPoint(0.0, 0.5, 0.0);
  ele->SetInput(cyl->GetOutput());
  vtkDataSetMapper* mapper = vtkDataSetMapper::New();
  mapper->SetInput(ele->GetOutput());
  ele->Delete();
  cyl->Delete();
  vtkActor* actor = vtkActor::New();
  actor->SetMapper(mapper);
  mapper->Delete();
{'fraction_non_alphanumeric': 0.20444104134762633, 'fraction_numerical': 0.010260336906584993, 'mean_word_length': 4.318403908794788, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4104743', 'n_tokens_mistral': 2033, 'n_tokens_neox': 1945, 'n_words': 580}