Answer the question
In order to leave comments, you need to log in
`
Error: undefined reference to `QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool)' when the specified method exists, how to fix??
New to Qml - Qt, I ask for a detailed answer.
I'm trying to link a Qml module created in Qt Design Studio with a C++ implementation.
This error appears in a certain file "qqmldebug.h", which is an embeded Qt file, and therefore I cannot change it without using chmod.
I am attaching the code of my application and the "qqmldebug.h" file, as well as a screenshot of the errors, if it helps
Tachometer.pro:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
RESOURCES += \
$$files(qml/*)
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QObject>
#include <QMainWindow>
#include <QGuiApplication>
#include <QKeyEvent>
#include <QVariant>
#include <QtQuick/QQuickView>
#include <QtQml/QQmlContext>
#include <QtQml/QQmlEngine>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
Q_INVOKABLE void startStopAnimation();
~MainWindow();
private:
Ui::MainWindow *ui;
QObject* root;
QQuickView view;
};
#endif // MAINWINDOW_H
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
view.resize(1920, 1080);
view.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
view.engine()->addImportPath("/opt/Qt/Tools/QtDesignStudio-3.1.0-preview/lib/Qt/qml");
view.setSource(QUrl("/home/y66ask34/QtPojects/qtQuickConv/qml/Qwerty/content/Screen01.ui.qml"));
root = view.rootContext();
view.rootContext()->setContextProperty("window", this);
}
void MainWindow::startStopAnimation()
{
QObject* timeLine = root->findChild<QObject*>("moveTimeLine");
//QObject* timeLineAnimation = timeLine->findChild<QObject*>("TimeLineAnimation");
QObject* monitor = root->findChild<QObject*>("text8");
int counter = 0;
QVariant countFrame = QVariant(6000.0);
while (timeLine->property("currentFrame") != timeLine->property("endFrame"))
{
if (timeLine->property("currentFrame").toInt() >= 6000 and timeLine->property("currentFrame").toInt() <= 10000)
{
monitor->property("Text") = counter;
counter++;
}
}
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question