私には2つの関数があり、そのうちの1つは他の関数を呼び出します。それらの 1 つをプッシュボタンの clicked() シグナルのスロットとして使用したいので、ここに私の planevolume.h コードの一部を示します。
#ifndef PLANEVOLUME_H
#define PLANEVOLUME_H
#include <QMainWindow>
namespace Ui {
class planevolume;
}
//more stuff here
class planevolume : public QMainWindow {
Q_OBJECT
public:
planevolume(QWidget *parent = 0);
~planevolume();
protected:
void changeEvent(QEvent *e);
private:
Ui::planevolume *ui;
//more stuff here
public slots:
void AlignXAxis(int xmin, int xmax, vtkImagePlaneWidget* planeX);
void AlignCamera(vtkImagePlaneWidget* current_widget);
};
#endif // PLANEVOLUME_H
そして、私のplanevolume.cppの一部をここに置いて、後で発生するエラーが何であるかを理解できるようにします。
#include <qwidget.h>
#include <qaction.h>
#include <qobject.h>
//more includes
// Define AlignCamera
void planevolume::AlignCamera(vtkImagePlaneWidget* current_widget)
{
//regular statements of a function
vtkCamera *camera=ren->GetActiveCamera();
camera->SetViewUp(vx, vy, vz);
camera->SetFocalPoint(cx, cy, cz);
camera->SetPosition(px, py, pz);
camera->OrthogonalizeViewUp();
ren->ResetCameraClippingRange();
renWin->Render();
}
// Define the action of AlignXAxis
void planevolume::AlignXAxis(int xmin, int xmax, vtkImagePlaneWidget* planeX)
{
//regular statements of a function
vtkImagePlaneWidget *current_widget= planeX;
ui->horizontalScrollBar->setValue(slice_number);
ui->horizontalScrollBar->setMinimum(xmin);
ui->horizontalScrollBar->setMaximum(xmax);
AlignCamera(current_widget);//here I call the other one
}
planevolume::planevolume(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::planevolume)
{
ui->setupUi(this);
//regular stuff
//I think here is the problem when i make the connect
connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(AlignXAxis(int, int, vtkImagePlaneWidget)));
// Start the initialization and rendering
renWin->Render();
//iren->Initialize();
//iren->Start();
// Assign the rendering window to the qvtkwidget
ui->qvtkWidget->SetRenderWindow(renWin);
}
so them it compiles ok, but when i clicked in the pushbutton it just shows this on the output of the application:
Object::connect: No such slot planevolume::AlignXAxis(int, int, vtkImagePlaneWidget) in planevolume.cpp:386 Object::connect: (sender name: 'pushButton') Object::connect: (receiver name: 'planevolume')
so if someone knows what I'm doing wrong please give me some hint or something because this is driving me crazy. :)