1

I'm Qt beginner and have a problem: I'm using QT(4.8.4) with C++ using QTCreator(2,72). When I attempt to compile the program I get:

expected primary-expression before ')' token  on Line 26.

My main.cpp: Part/Section of the program

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include "view.h"

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{

ui->setupUi(this);
createActions();
createMenus();

//Fenster für Visualisierung
ui->dockWidget->setWidget(view); //ERROR Line 26
ui->dockWidget->setWindowTitle("Visualisierung");
ui->dockWidget->setGeometry(20,200,300,300);
}

My view.cpp:

#include "view.h"
#include <QtGui>
#include <GL/glu.h>
#include <QtOpenGL/QGLWidget>

extern QVector<QMatrix4x4> T_tracked_Point_Cam;
extern QVector<QMatrix4x4> T_approx_Point_Cam;

// Konstruktor
view::view(QWidget *parent) :
QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
xRot = 0;
yRot = 0;
zRot = 0;
zoom = 0;
virtuellerAbstand = 0;
xT = 0;
yT = 0;
trackPoint = false;
laserPoint = false;
laserOrients = false;
gitterPoint = true;
Cam_Koo_Trans_X = 0;
Cam_Koo_Trans_Y = 0;
Cam_Koo_Trans_Z = 0;
}

// Destruktor
view::~view()
{}

main.h:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDebug>
#include <QMessageBox>

namespace Ui {

class MainWindow;
}

class MainWindow : public QMainWindow

{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

private slots:
void openDCMFile();
void drawDICOMImg(std::string fileDICOM);

private:
Ui::MainWindow *ui;
void createActions();
void createMenus();

    QMenu *fileMenu;
    QAction *openAct;

signals:
    void AnzeigeGetracktePunkte(bool);
    void AnzeigeLaserPunkte(bool);
    void AnzeigeLaserOrients(bool);
    void AnzeigeGitterPunkte(bool);
    void update_view();
 };

#endif // MAINWINDOW_H

vieh.h:

#ifndef VIEW_H
#define VIEW_H

#include <QtOpenGL/QGLWidget>
class view : public QGLWidget
{
Q_OBJECT
public:
view(QWidget *parent = 0);
~view();

QSize minimumSizeHint() const;
QSize sizeHint() const;

double x_max, y_max, z_max;
double x_min, y_min, z_min;

void Zeichnen_getrackte_Punkte();
void Zeichnen_Laserpunkte();
void Zeichnen_Laserorients();

signals:

public slots:
....
protected:
.....
private:
.....  
 };

#endif // VIEW_H

Thanks for the help in advance.

4

1 回答 1

2

view只是一种类型的名称。您可能想要传递它的一个实例:

ui->dockWidget->setWidget(view());
//                            ^^
于 2013-08-12T12:57:51.300 回答