Unsolved Use Qt Data Visualization with Visual Studio 2015
-
Hi Guys,
I have some Problems using Qt Data visualization with Visual Studio 2015.
I installed Qt Data Visualization at the Installation of Qt.- Problem:
In Qt Creator i include the
#include <QtDataVisualization> and everything worked fine
But in Visual Studio there is no such Lib.
There is only the Folder
#include <QtDataVisualization> with headers like :
#include <QtDataVisualization\qtdatavisualizationversion.h> or
#include <QtDataVisualization\q3dbars.h>
so i'm not really sure which header File i need.
- Problem :
So first i wanted to create only the dialog with Qt Data Visualization and without any Diagram so i used :
Q3DBars *graph = new Q3DBars();
QWidget *container = QWidget::createWindowContainer(graph);in the main Function.
But nothing happens (1.Problem).
Did I forget sth ?
In the Tutorial they say i should add this in the .pro File :
QT += datavisualization
But in Visual Studio there is no .pro FIle... do I have to add sth else ?I hope that sb can Help me.
Thanks !
- Problem:
-
Hi
Did u install the plugin / add in for 2015 ?https://blog.qt.io/blog/2016/08/11/from-visual-studio-add-in-to-qt-vs-tools-beta/
https://marketplace.visualstudio.com/items?itemName=havendv.QtPackageThose provide a .pro generator.
-
Yes I installed the plugin for 2015. Do i have to create a .pro File and insert the line : QT += datavisualization ?
-
@BadHombre
Well that is needed normally.
You should have a .pro file already ? -
If I start a Qt Project with VIsual Studio there is no .pro File. I created a .pro File wiith the Qt Add on and added the line : QT += datavisualization
This is my Code :
#include <QtDataVisualization\q3dbars.h>
using namespace QtDataVisualization;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Q3DBars *graph = new Q3DBars();
newtest w;
w.show();
return a.exec();
}and then i get a lot of Link errors ... see Picture
https://s30.postimg.org/6yhfsytmp/test.png -
Did you make sure to run qmake on the .pro file?
Sorry , I have not use VS with the qt plugin so not sure why it just dont work.
It seems not to link it in.Could you try with Creator so we know QtDataVisualization is installed and working and its just a VS issue ?
-
With the Qt Creator every thing works. Now I imported the Qt lib with the Properties of the Project and i don't get any Errors when i build my Project.
But when I start my Project nothing happens :/
see Picture:
The Problem are caused by the Lines:Q3DBars *graph = new Q3DBars();
QWidget *container = QWidget::createWindowContainer(graph);The Code works perfectly on Qt Creator
-
Why do u need QWidget::createWindowContainer() ?
Is this QML ?
Anyway, same code should work both in VS and Creator.
Did you use the VS compiler in Creator? -
I'm not sure about the QWidget ... i took a QtDataVisualization example ...and copied it..because i works in qtcreator.
Yes iam usin the VS compiler in the Creator
Microsoft visual c++ compiler 14