Okay I'm resetting this whole post because I guess I didn't have enough " Minimal, Complete, and Verifiable example " which really is the entirety of my question, because I am just so LOST on slots and signals.. so here's 2nd attempt, I will leave out flower.cpp, but know it has a function in there
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickView>
#include <QtQuick>
#include <QNetworkAccessManager>
#include <iostream>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
#include <QNetworkReply>
#include <QObject>
#include "flower.h"
void Flower::onClicked(){
//code i've been trying to test all day
}
flower.h (my header for the class flower (the function))
#ifndef FLOWER_H
#define FLOWER_H
#include <QObject>
class Flower
{
private slots:
void onClicked();
};
#endif // FLOWER_H
main.cpp (this is where my app QML is started from, and I'm trying to setup the connection of signal and slot there)
QQuickView home;
home.setSource(QUrl::fromLocalFile("main.qml"));
home.show();
QObject *homePa = home.rootObject();
QObject *buttF = homePa->findChild<QObject*>("buttFObject");
QObject::connect(buttF, SIGNAL(qmlClick()), buttF,
SLOT(Flower.onClicked()));
this is the navmenu with the mousearea that I want to have the onClicked: command attached
Rectangle {
signal qmlClick();
id: navMenu
color: "#00000000"
radius: 0
anchors.fill: parent
z: 3
visible: false
border.width: 0
transformOrigin: Item.Center
MouseArea {
id: buttFArea
objectName: buttFObject
anchors.fill: parent
onClicked: navMenu.qmlClick()
}
}
When I try to run right now I receive this error "W libAHDP.so: QObject::connect: Cannot connect (null)::qmlClick() to (null)::Flower.onClicked()"
Apologies for my first post being very misleading and mixed up I hope this is more clear on what my issue is