Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Gui Application cannot locate QGeometryData namepsace
Forum Updated to NodeBB v4.3 + New Features

Qt Gui Application cannot locate QGeometryData namepsace

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    janine6192
    wrote on last edited by
    #1

    For some reason, my Qt5.0 is not locating the QGeometryData namespace

    it displays the following error:

    c:\users\jcastillo\documents\convexhull\mainwindow.h:4: error: C1083: Cannot open include file: 'QGeometryData': No such file or directory

    I have attached my main, mainwindow.h and .cpp

    @//mainwindow.h
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QGeometryData>
    #include <QMainWindow>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void ComputeUpperHull();

    private:
    Ui::MainWindow *ui;
    QGeometryData top;
    };

    #endif // MAINWINDOW_H
    @
    @//mainwindow.cpp
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QGeometryData>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::ComputeUpperHull()
    {
    top.appendVertex(QVector3D(0.0, 0.0, 0.0));
    top.appendVertex(QVector3D(6.0, 3.6, 0.0)); // (v1 - v0).length() = 7.0
    top.appendVertex(QVector3D(10.0, 0.6, 0.0)); // (v2 - v1).length() = 5.0
    top.appendVertex(QVector3D(13.0, 3.24, 0.0)); // (v3 - v2).length() = 4.0

     // generate x (Qt::Horizontal) texture coordinates over the primitive
     top.generateTextureCoordinates();              // spread over 7 + 5 + 4 = 16
    
     // make a copy translated down, the copy has y texture coordinates all 0
     QGeometryData bottom = top.translated(QVector3D(0, 0, -1));
    
     // now modify the top so its y texture coordinates are all 1
     for (int i = 0; i < top.count(); ++i)
         top.texCoordRef(QGL::TextureCoord0).setY(1.0);
    
     displayList->addQuadsZipped(top, bottom);
    

    }

    @

    @//main.cpp
    #include <QtGui/QApplication>
    #include "mainwindow.h"

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    MainWindow w;
    w.ComputeUpperHull();
    w.show();
    
    return a.exec&#40;&#41;;
    

    }

    @

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved