<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[‘vtkEventQtSlotConnect’ does not name a type]]></title><description><![CDATA[<p dir="auto">I am building a project with cmake .<br />
The project is to read DICOM by vtk.<br />
I meet a error: ‘vtkEventQtSlotConnect’ does not name a type.<br />
Here is my code ```<br />
<a href="//ReadDICOM.cpp" target="_blank" rel="noopener noreferrer nofollow ugc">//ReadDICOM.cpp</a><br />
#include "ReadDICOMQt.h"<br />
#include "ui_ReadDICOMQt.h"<br />
#include &lt;QFileDialog&gt;</p>
<p dir="auto">ReadDICOMQt::ReadDICOMQt(QWidget *parent) : QMainWindow(parent), ui(new Ui::ReadDICOMQt) {<br />
ui-&gt;setupUi(this);<br />
reader = vtkSmartPointer&lt;vtkDICOMImageReader&gt;::New();<br />
viewer = vtkSmartPointer&lt;vtkImageViewer&gt;::New();</p>
<pre><code>m_Connections = vtkEventQtSlotConnect::New();
m_Connections-&gt;Connect(m_QVTKWidget-&gt;GetRenderWindow()-&gt;GetInteractor(),
             vtkCommand::MouseMoveEvent,
             this,
             SLOT(updateCoords(vtkObject*)));
</code></pre>
<p dir="auto">//vtkNew&lt;vtkGenericOpenGLRenderWindow&gt; renderWindow;<br />
//vtkNew&lt;vtkRenderer&gt; renderer;<br />
//vtkNew&lt;vtkImageSlice&gt; imageSlice;<br />
//vtkNew&lt;vtkImageResliceMapper&gt; mapper;<br />
//vtkNew&lt;vtkInteractorStyleImage&gt; interactorStyle;<br />
}</p>
<p dir="auto">ReadDICOMQt::~ReadDICOMQt() {<br />
delete ui;<br />
}</p>
<p dir="auto">void ReadDICOMQt::openDICOMFile() {<br />
QString fileNameDICOM = QFileDialog::getOpenFileName(this, tr("Select DICOM File"), QDir::currentPath());<br />
drawDICOMImage(fileNameDICOM.toUtf8().constData());<br />
}<br />
void ReadDICOMQt::updateCoords(int <em>obj){<br />
// 获取交互器<br />
vtkRenderWindowInteractor</em> iren = vtkRenderWindowInteractor::SafeDownCast(obj);</p>
<pre><code>// 获取鼠标的当前位置
int event_pos[2];
iren-&gt;GetEventPosition(event_pos);

QString str;
str.sprintf("x=%d : y=%d", event_pos[0], event_pos[1]);
m_StatusBar-&gt;showMessage(str);
</code></pre>
<p dir="auto">}<br />
void ReadDICOMQt::drawDICOMImage(std::string fileDICOM) {<br />
// 获取DICOM图像的文件夹<br />
reader-&gt;SetFileName(fileDICOM.c_str());<br />
reader-&gt;Update();<br />
// 将输入与viewer结合起来<br />
viewer-&gt;SetInputConnection(reader-&gt;GetOutputPort());<br />
// 将widght 链接到viewer<br />
ui-&gt;qvtkWidget-&gt;SetRenderWindow(viewer-&gt;GetRenderWindow());<br />
//向viewer添加interactor<br />
viewer-&gt;SetupInteractor(ui-&gt;qvtkWidget-&gt;GetInteractor());<br />
// init<br />
viewer-&gt;Render();</p>
<p dir="auto">// 更新GUI label<br />
ui-&gt;labelFileName-&gt;setText(QString::fromStdString(fileDICOM));</p>
<p dir="auto">}</p>
<p dir="auto">void ReadDICOMQt::on_buttonOpenFile_clicked() {<br />
openDICOMFile();<br />
}<br />
<a href="//ReadDICOM.h" target="_blank" rel="noopener noreferrer nofollow ugc">//ReadDICOM.h</a><br />
#ifndef READDICOMQT_H<br />
#define READDICOMQT_H</p>
<p dir="auto">#include &lt;QMainWindow&gt;<br />
#include &lt;vtkSmartPointer.h&gt;<br />
#include &lt;vtkDICOMImageReader.h&gt;<br />
#include &lt;vtkImageViewer.h&gt;</p>
<p dir="auto">namespace Ui {<br />
class ReadDICOMQt;<br />
}</p>
<p dir="auto">class ReadDICOMQt : public QMainWindow {<br />
Q_OBJECT</p>
<p dir="auto">public:<br />
explicit ReadDICOMQt(QWidget *parent = 0);<br />
~ReadDICOMQt();</p>
<p dir="auto">private slots:<br />
void openDICOMFile();<br />
void drawDICOMImage(std::string fileDICOM);<br />
void on_buttonOpenFile_clicked();<br />
void updateCoords(vtkObject* obj);</p>
<p dir="auto">private:<br />
Ui::ReadDICOMQt <em>ui;<br />
vtkSmartPointer&lt;vtkDICOMImageReader&gt; reader;<br />
vtkSmartPointer&lt;vtkImageViewer&gt; viewer;<br />
vtkEventQtSlotConnect</em> m_Connections;<br />
};<br />
#endif // READDICOMQT_H</p>
<pre><code>The error occurred  when I make the makefile</code></pre>
]]></description><link>https://forum.qt.io/topic/139335/vtkeventqtslotconnect-does-not-name-a-type</link><generator>RSS for Node</generator><lastBuildDate>Fri, 23 Oct 2026 07:55:27 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139335.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 15 Sep 2022 09:13:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ‘vtkEventQtSlotConnect’ does not name a type on Fri, 16 Sep 2022 19:23:09 GMT]]></title><description><![CDATA[<p dir="auto">No, it's unrelated to cmake. You need to include the header in the file where you use an instance of the class.</p>
]]></description><link>https://forum.qt.io/post/729067</link><guid isPermaLink="true">https://forum.qt.io/post/729067</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 16 Sep 2022 19:23:09 GMT</pubDate></item><item><title><![CDATA[Reply to ‘vtkEventQtSlotConnect’ does not name a type on Fri, 16 Sep 2022 02:20:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> thanks a lot . You are so nice man.</p>
]]></description><link>https://forum.qt.io/post/728903</link><guid isPermaLink="true">https://forum.qt.io/post/728903</guid><dc:creator><![CDATA[lyccyl1]]></dc:creator><pubDate>Fri, 16 Sep 2022 02:20:09 GMT</pubDate></item><item><title><![CDATA[Reply to ‘vtkEventQtSlotConnect’ does not name a type on Fri, 16 Sep 2022 01:48:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> said in <a href="/post/728883">‘vtkEventQtSlotConnect’ does not name a type</a>:</p>
<blockquote>
<p dir="auto">Hi and welcome to devnet</p>
</blockquote>
<p dir="auto">sorry. Is it  means that  though I uses CMAKE I should define that class?</p>
]]></description><link>https://forum.qt.io/post/728900</link><guid isPermaLink="true">https://forum.qt.io/post/728900</guid><dc:creator><![CDATA[lyccyl1]]></dc:creator><pubDate>Fri, 16 Sep 2022 01:48:27 GMT</pubDate></item><item><title><![CDATA[Reply to ‘vtkEventQtSlotConnect’ does not name a type on Thu, 15 Sep 2022 18:34:03 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">You are missing the include that defines that class. See its <a href="https://vtk.org/doc/nightly/html/classvtkEventQtSlotConnect.html" target="_blank" rel="noopener noreferrer nofollow ugc">documentation</a>.</p>
]]></description><link>https://forum.qt.io/post/728883</link><guid isPermaLink="true">https://forum.qt.io/post/728883</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 15 Sep 2022 18:34:03 GMT</pubDate></item></channel></rss>