I have the following simple code. I just start writing my application and get stuck on this problem: Qt Creator tells me, that QPolygon file or directory doesn't exists. I checked it with QT Documentation and it says, ther is.
#include <QPolygon>
class IHledani
{
public:
virtual IHledani();
virtual ~IHledani();
virtual QPolygon najdiKonturu(IObraz image, int startx, int starty);
};
Thank you
Related
QT version: 5.12.0
OpenGL version: 4.5 core
Development environment: VS 2017
pro file:
QT += widgets
...
I have already add the glad.c file into my project, and ensure that the glad.h is included at the first place in every file.
But while I compile my project, all the other classes that using OpenGL functions are normal, except the class inherited from QOpenGLWidget.
MappingView.h
#include <glad/glad.h>
...
class MappingView : public QOpenGLWidget {
Q_OBJECT
public:
MappingView(QWidget * parent = nullptr);
~MappingView();
virtual void initializeGL();
virtual void resizeGL(int w, int h);
virtual void paintGL();
...
GLuint m_pointer_texture;
}
MappingView.cpp
MappingView::MappingView(QWidget * parent) : QOpenGLWidget(parent) {
}
MappingView::~MappingView() {
glDeleteTextures(1, &m_pointer_texture);
}
void MappingView::initializeGL() {
// load glad
if (!gladLoadGL()) {
return;
}
glGenTextures(1, &m_pointer_texture);
}
Compile error: C3861, cann't find glDeleteTextures.
When I click to the definition of glDeleteTextures in VS, it will jump to QOpenGLFunctions, but not glad.h. It seems that the OpenGL in QT and glad is conflicting. But my project doesn't use QOpenGLFunctions.
When I try to add a macro in MappingView.h,
#define QT_NO_OPENGL
all OpenGL functions in MappingView can be successfully found in glad.h, but the base class QOpenGLWidget cannot be found instead, which means that the MappingView class cannot be inherited from QOpenGLWidget any more.
I would be very appreciated if somebody could help me to resolve the problem, thanks!
I am learning MFC programming. In the part of dialog design, I entered a problem.
The resource is IDD_PEN_WIDTH, which is the ID of the dialog. And there is a piece of automatically generated code related to this:
class PenWidthDlg : public CDialogEx
{
DECLARE_DYNAMIC(PenWidthDlg)
public:
PenWidthDlg(CWnd* pParent = NULL); // standard constructor
virtual ~PenWidthDlg();
// Dialog Data
enum { IDD = IDD_PEN_WIDTH };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
int m_nPenWidth;
};
Before I run my program, the IDD_PEN_WIDTH shows "#define IDD_PEN_WIDTH 301" while hovering mouse on IDD_PEN_WIDTH in the code. But when I run it, there is one error says IDD_PEN_WIDTH is an undefined identifier. Then I hover mouse on "IDD_PEN_WIDTH", it also says it's undefined.
I am usually confused in MFC studying, and I will appreciate very much for your detailed explanations. Thanks.
It has to be defined in every cpp file that uses it. Add #include "Resource.h" in those cpp files. Do that #include before the #include of the dialog .h file.
I'm having a problem with Eclipse's indexing. Here's a minimal working example.
I create a header file, Parent.h, in which I define the following virtual class:
class Parent
{
protected:
virtual ~Parent() {}
public:
virtual void OverrideMe() = 0;
};
Then, I create another header file, Child.h:
#include "Parent.h"
class Child : public Parent
{
};
Immediately, Eclipse complains that "Symbol Parent could not be resolved."
The problem magically goes away if I create a source file Parent.cpp and in it put #include "Parent.h". More strangely, it does not reappear if I delete this source file.
There seems to be something crazy going on with Eclipse's indexing? People with similar problems have recommended doing an "Index -> Rebuild". This does not work for me.
Any help is appreciated. Thanks in advance.
I'm trying to compile a gtkmm application that uses cairomm for drawing.
It compiles fine using gtkmm3.0 but when I try to compile it using gtkmm2.4 i get:
error: ‘signal_draw’ was not declared in this scope
I'm using g++.
It seems that there is no signal_draw in gtkmm2.4(Am I wrong?). Is there any function/signal that can be used instead?
Thanks in advance.
Sorry for my bad English.
Some code:
class egclass: public Gtk::DrawingArea
{
public:
egclass();
virtual ~egclass();
virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
};
egclass::egclass()
{
#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
signal_draw().connect(sigc::mem_fun(*this, &egclass::on_draw), false);
#endif
}
The older gtkmm 2.4 has on_expose_event instead:
virtual bool on_expose_event(GdkEventExpose* event);
If you need to create a cairo context for drawing, with the GTK+ C API it goes something like this:
cairo_t *cr;
cr = gdk_cairo_create (event->window);
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
/* do your drawing */
cairo_destroy (cr);
... translating the snippet above to gtkmm is left as an exercise to the reader.
Also see the following links:
Porting from gtkmm-2.4 to gtkmm-3.0
Migrating from GTK+ 2.x to GTK+ 3
example_pixbufs.cc
I'm following a tutorial and it said at one point it should compile, but it errored.
To find out why I just used their code instead of mine and have just pasted all theirs in, however, this is picking up errors. It's in a header file, I've placed the errors below the code
#ifndef _CApp_H_
#define _CApp_H_
#include <SDL.h>
class CApp {
private:
bool Running;
public:
CApp();
int OnExecute();
public:
bool OnInit();
void OnEvent(SDL_Event* Event);
void OnLoop();
void OnRender();
void OnCleanup();
};
#endif
Errors:
Syntax error before CAPP, on line 6.
Syntax error before the first {, on line 6.
Syntax error before : on line 14.
Line 25 before }
All files are declared. I have another error, too, here:
#include "CApp.h"
void CApp::OnCleanup() {
}
Before :. it doesn't give more description than that apart from it's on line 3.
Is the SDL.h file in your include path? Nothing in the example jumps out at me as wrong.
This isn't really a proper answer to your question, but...
I would highly recommend switching to SFML instead of SDL. It's essentially a modernized, object-oriented SFML written in C++. It has many advantages over SDL (such as fully hardware-accelerated 2D drawing). Check it out if you'd like.
It's probably located in a path. Try putting # include "SDL\SDL.h".