reference to connect is ambiguous QQuickItem QMainWindow

I am trying to use QCustomPlot's example of the following folder, in my program:

/examples/plots

and at the same time I want it accessible from QML. So, I added <QQuickItem> and it resulted in the error stated in the title.

The code:

#include <QQuickItem>
#include <QMainWindow>
#include <QTimer>
#include "../../qcustomplot.h" 

namespace Ui {
class MainWindow;
}

class MainWindow :  public QQuickItem, public QMainWindow
{
  Q_OBJECT

What should I do to make it accessible from QML and solve the error too?

Answers


There are Qt Widgets applications and there are Qt Quick applications. Choose one.

QCustomPlot lets you create widgets for a Qt Widgets application.

You can not embed a QWidget in a Qt Quick (=QML) application. The only thing you can do to some extend is to embed QML in your Qt Widgets application. In this case your MainWindow inherits QMainWindow only and contains a QQuickView (see http://www.ics.com/blog/combining-qt-widgets-and-qml-qwidgetcreatewindowcontainer).


Need Your Help

Drawing with OpenGL in OOP

qt opengl opengl-3 particle-system multi-agent

I try to code an OpenGL project with Qt (v5.1.1) on OS X 10.9, in the manner of the modern pipeline implementation. The program is supposed to be a multi-agent based system or particle system. Howe...

PyDev and Django: how to restart dev server?

python django eclipse pydev devserver

I'm new to Django. I think I'm making a simple mistake.