PDA

View Full Version : Can I use "Promote to..." with Qwt?



8Observer8
15th August 2014, 03:19
Hello!

Sorry for my English in advance :)

I will have class "Graph" in the file "Graph.h". I want to have a widget which I can "Promote to ..." from Qt Designer, like in the picture:
10556

Must I inherit QwtPlot and QWidget? How to show the plot?


#ifndef GRAPH_H
#define GRAPH_H

#include <QWidget>
#include <qwt_plot.h>

class Graph : public QWidget, QwtPlot
{
public:
Graph()
{

}
};

#endif // GRAPH_H

Uwe
15th August 2014, 09:55
QwtPlot is already derived from QWidget ( your code above doesn't make much sense ) and you can do with it, what you can do with any other QWidget.

Note that you could also install the Qwt designer plugin to customize QwtPlot widgets from the designer or creator.

Uwe

8Observer8
15th August 2014, 12:20
Thank you! I will install plugin later

I cannot run my application. I receive this message in the "Application Output":


Starting D:\Qt\QwtExamples\0007_Line\build-Line-Desktop_Qt_5_3_1_MinGW_32bit-Debug\debug\Line.exe...
The program has unexpectedly finished.
D:\Qt\QwtExamples\0007_Line\build-Line-Desktop_Qt_5_3_1_MinGW_32bit-Debug\debug\Line.exe crashed




#ifndef GRAPH_H
#define GRAPH_H

#include <qwt_plot.h>

class Graph : public QwtPlot
{
public:
Graph( QWidget *widget = 0 ) :
QwtPlot( widget )
{

}
};

#endif // GRAPH_H

8Observer8
15th August 2014, 14:28
What must I show? I don't have more code in this project

8Observer8
16th August 2014, 09:49
Please, it is very important. How to show a graph?

8Observer8
27th August 2014, 07:18
Please, help me! This is my steps:

- I created a MainWindow application
- I added in the .pro file this code:

QWT_LOCATION = c:/Qwt-6.1.0
INCLUDEPATH += $${QWT_LOCATION}/include
LIBS = -L$${QWT_LOCATION}/lib \
-lqwtd

- I create the class "Plot":

Plot.h


#ifndef PLOT_H
#define PLOT_H

#include "qwt_plot.h"

class Plot : public QwtPlot
{
public:
Plot( QWidget *parent = 0 );
};

#endif // PLOT_H


Plot.cpp


#include "Plot.h"

Plot::Plot( QWidget *parent ) :
QwtPlot( parent )
{
}


- I opened the file "MainWindow.ui" and I put on the form the widget "Widget"
- I promoted the "Widget" to "Plot"
- I ran my application and received this message:

The program has unexpectedly finished.

8Observer8
27th August 2014, 11:27
This application doesn't work too:

VerySimple.pro



QT += widgets

INCLUDEPATH += "C:/Qwt-6.1.0/include"
LIBS += "C:/Qwt-6.1.0/lib/libqwtd.a"

SOURCES += \
main.cpp


main.cpp



#include <QApplication>
#include "qwt_plot.h"

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

QwtPlot plot;

plot.show();

app.exec();
}


Output:


The program has unexpectedly finished.


Added after 16 minutes:

I set breakpoint on the line "QApplication app( argc, argv );" I see:
10588

wysota
27th August 2014, 11:34
Please do a search on the forum for "0xc0000135".

8Observer8
28th August 2014, 06:02
I think it is because I built Qwt in Qt5.1.1 and I try to use it in Qt5.3.1