New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QWidget: Cannot create a QWidget without QApplication #1

Closed
vishnucool220 opened this Issue Aug 6, 2015 · 14 comments

Comments

Projects
None yet
2 participants
@vishnucool220

vishnucool220 commented Aug 6, 2015

Hi,
I followed all your steps and addition to it i have added to my pro file.
MAKE_CXXFLAGS += -std=c++11
QT += qml quick
QT += widgets
QT += printsupport
but still it says QWidget: Cannot create a QWidget without QApplication. Any idea where i went wrong? Thanks

@vishnucool220 vishnucool220 reopened this Aug 6, 2015

@vishnucool220 vishnucool220 changed the title from module "QlLinePlotItem" is not installed to QWidget: Cannot create a QWidget without QApplication Aug 6, 2015

@vishnucool220

This comment has been minimized.

Show comment
Hide comment
@vishnucool220

vishnucool220 Aug 6, 2015

I changed QGuiApplication in main.cpp to QApplication.Then it worked but i want to work with QGuiApplication. Please tell me how can i do that.Thanks

vishnucool220 commented Aug 6, 2015

I changed QGuiApplication in main.cpp to QApplication.Then it worked but i want to work with QGuiApplication. Please tell me how can i do that.Thanks

@ncp1402

This comment has been minimized.

Show comment
Hide comment
@ncp1402

ncp1402 Aug 6, 2015

Owner

QApplication inherits QGuiApplication, and supports functionality needed for QWidget-based applications. Read more in docs: http://doc.qt.io/qt-5/qapplication.html#details

Owner

ncp1402 commented Aug 6, 2015

QApplication inherits QGuiApplication, and supports functionality needed for QWidget-based applications. Read more in docs: http://doc.qt.io/qt-5/qapplication.html#details

@vishnucool220

This comment has been minimized.

Show comment
Hide comment
@vishnucool220

vishnucool220 Aug 6, 2015

so you mean to say that the problem is not with QApplication? If so any idea what might be causing " Qwdiget cannot create a Qwidget without QApplications" ?
P.S: Did you test with Qt5.4 using QGuiApplication? Thanks a lot

vishnucool220 commented Aug 6, 2015

so you mean to say that the problem is not with QApplication? If so any idea what might be causing " Qwdiget cannot create a Qwidget without QApplications" ?
P.S: Did you test with Qt5.4 using QGuiApplication? Thanks a lot

@ncp1402

This comment has been minimized.

Show comment
Hide comment
@ncp1402

ncp1402 Aug 6, 2015

Owner

try to use QApplication instead of QGuiApplication

Owner

ncp1402 commented Aug 6, 2015

try to use QApplication instead of QGuiApplication

@vishnucool220

This comment has been minimized.

Show comment
Hide comment
@vishnucool220

vishnucool220 Aug 6, 2015

Its works with QApplication but the application i have developed so far is using QguiApplication. when i replace in my project it is creating problem. That's y i am requesting you is there any other way to draw graph?

vishnucool220 commented Aug 6, 2015

Its works with QApplication but the application i have developed so far is using QguiApplication. when i replace in my project it is creating problem. That's y i am requesting you is there any other way to draw graph?

@ncp1402

This comment has been minimized.

Show comment
Hide comment
@ncp1402

ncp1402 Aug 6, 2015

Owner

qcustomplot based on QWidget.
QGuiApplication do not support QWidget, so qcustomplot object can't be used in QGuiApplication.
Maybe there are methods to overcome this, I don't know...

Owner

ncp1402 commented Aug 6, 2015

qcustomplot based on QWidget.
QGuiApplication do not support QWidget, so qcustomplot object can't be used in QGuiApplication.
Maybe there are methods to overcome this, I don't know...

@vishnucool220

This comment has been minimized.

Show comment
Hide comment
@vishnucool220

vishnucool220 Aug 6, 2015

okay bad luck for me :(

vishnucool220 commented Aug 6, 2015

okay bad luck for me :(

@vishnucool220

This comment has been minimized.

Show comment
Hide comment
@vishnucool220

vishnucool220 Aug 7, 2015

hai,
I some how made it work with QApplicatoin thanks for your help. If you don't mind can you please give me an example where i can push the data at run time. for example i get the data from Cpp side throught a signal to QML side now how can i apped the data and plot it for specific time choosen by the user.
Eg: let say user chooses plot for 10 sec. Then i need to plot graph for 10 sec on x axis and the data on y axis.Thanks

vishnucool220 commented Aug 7, 2015

hai,
I some how made it work with QApplicatoin thanks for your help. If you don't mind can you please give me an example where i can push the data at run time. for example i get the data from Cpp side throught a signal to QML side now how can i apped the data and plot it for specific time choosen by the user.
Eg: let say user chooses plot for 10 sec. Then i need to plot graph for 10 sec on x axis and the data on y axis.Thanks

@vishnucool220

This comment has been minimized.

Show comment
Hide comment
@vishnucool220

vishnucool220 Aug 7, 2015

I tried adding data to the graph like this:
plot.addPoints(2,4)
and i got the error
TypeError: Property 'reduceRight' of object 4 is not a function. Can you please throw some example where i can add the data at run time. for example i get the data from Cpp side throught a signal to QML side now how can i apped the data and plot it for specific time choosen by the user.
Eg: let say user chooses plot for 10 sec. Then i need to plot graph for 10 sec on x axis and the data on y axis.Thanks

vishnucool220 commented Aug 7, 2015

I tried adding data to the graph like this:
plot.addPoints(2,4)
and i got the error
TypeError: Property 'reduceRight' of object 4 is not a function. Can you please throw some example where i can add the data at run time. for example i get the data from Cpp side throught a signal to QML side now how can i apped the data and plot it for specific time choosen by the user.
Eg: let say user chooses plot for 10 sec. Then i need to plot graph for 10 sec on x axis and the data on y axis.Thanks

@ncp1402

This comment has been minimized.

Show comment
Hide comment
@ncp1402

ncp1402 Aug 7, 2015

Owner

1st setup graph(s): to add graph call addGraph(name,visible,color,width,style)
to add point(s) call plot.addPoints(x, [y1,y2,...])
y - is array of Y coordinates.

Owner

ncp1402 commented Aug 7, 2015

1st setup graph(s): to add graph call addGraph(name,visible,color,width,style)
to add point(s) call plot.addPoints(x, [y1,y2,...])
y - is array of Y coordinates.

@vishnucool220

This comment has been minimized.

Show comment
Hide comment
@vishnucool220

vishnucool220 Aug 7, 2015

Yeah i have done as you said but still no result.

property var names: ['T1']
 Component.onCompleted: {
            // add new graphs
            //            for (var i=0; i < colors.length; i++)
            addGraph(names[0], true, colors[0], 1, 'solid');
            var y = [3,4,5,6,7]
            addPoints(x,y)
        }

i even tried varies values of x but still no result.May i know what wrong am i doing?

vishnucool220 commented Aug 7, 2015

Yeah i have done as you said but still no result.

property var names: ['T1']
 Component.onCompleted: {
            // add new graphs
            //            for (var i=0; i < colors.length; i++)
            addGraph(names[0], true, colors[0], 1, 'solid');
            var y = [3,4,5,6,7]
            addPoints(x,y)
        }

i even tried varies values of x but still no result.May i know what wrong am i doing?

@vishnucool220

This comment has been minimized.

Show comment
Hide comment
@vishnucool220

vishnucool220 Aug 7, 2015

Is it possible to show me your code the picture you have show as an example . where you have added some data.

vishnucool220 commented Aug 7, 2015

Is it possible to show me your code the picture you have show as an example . where you have added some data.

@ncp1402

This comment has been minimized.

Show comment
Hide comment
@ncp1402

ncp1402 Aug 7, 2015

Owner

addPoints adds points on all graphs, at single X coordinate.
Since You have only one graph, and several (x,y) points, the right sequence is:

addPoints(0,[3]);
addPoints(1,[4]);
addPoints(2,[5]);
addPoints(3,[6]);
addPoints(4,[7]);

Owner

ncp1402 commented Aug 7, 2015

addPoints adds points on all graphs, at single X coordinate.
Since You have only one graph, and several (x,y) points, the right sequence is:

addPoints(0,[3]);
addPoints(1,[4]);
addPoints(2,[5]);
addPoints(3,[6]);
addPoints(4,[7]);

@vishnucool220

This comment has been minimized.

Show comment
Hide comment
@vishnucool220

vishnucool220 Aug 7, 2015

Thanks a lot. now i understood. how it works. If you need help in documenting a bit more i can contribute to this project. Its really nice work you have done.cheers. Let me know.Thanks

vishnucool220 commented Aug 7, 2015

Thanks a lot. now i understood. how it works. If you need help in documenting a bit more i can contribute to this project. Its really nice work you have done.cheers. Let me know.Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment