Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Signals and slots or whatever



  • // cModule is of type CccModule*
    connect(cModule, &CccModule::paletteChanged, this, [=](int index, uint32_t palette)->void{
    m_ui->textBrowser->append(QStringLiteral("Palette changed. Index %1, Palette: %2").arg(index).arg(palette));
    });
    


  • I'm pretty sure that I declared it correctly but I am getting back:

    119:13: error: use of undeclared identifier 'cModule'

    and now I'm getting back:

    mainwindow.cpp:123: error: no matching function for call to 'MainWindow::connect(CccModule*&, void (CccModule::*)(int, uint32_t), MainWindow* const, MainWindow::MainWindow(int, char**, QWidget*)::__lambda0)'
         });
          ^
    
    mainwindow.cpp:123: error: template argument for 'template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType)' uses local type 'MainWindow::MainWindow(int, char**, QWidget*)::__lambda0'
         });
          ^
    
    mainwindow.cpp:123: error: template argument for 'template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0) && (! QtPrivate::FunctionPointer<Func2>::IsPointerToMemberFunction)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType)' uses local type 'MainWindow::MainWindow(int, char**, QWidget*)::__lambda0'
         });
          ^
    
    mainwindow.cpp:123: error: template argument for 'template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == (-1)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType)' uses local type 'MainWindow::MainWindow(int, char**, QWidget*)::__lambda0'
         });
          ^
    


  • @jrod2much said in Signals and slots or whatever:

    use of undeclared identifier 'cModule'

    yes, that's just a name I used, you have to change it to the one of your instance of CccModule

    @jrod2much said in Signals and slots or whatever:

    and now I'm getting back:
    mainwindow.cpp:123: error: no matching function for call to 'MainWindow::connect(CccModule*&, void (CccModule::)(int, uint32_t), MainWindow const

    MainWindow const ? how are you passing the 3rd argument? [edit, it was just bad formatting by the forum]

    You are calling the connect from a const method. That's a problem as a connection alters the objects



  • I really apologize for having to ask these kinds of questions, but, how do I check what "my instance of CccModule" are. I added this in above the connect and in the header of CccModule.cpp in public:

    CccModule* cModule;
    

    Also, I don't know how to fix the const issue.



  • Ok big step back.

    I added this in above the connect and in the header of CccModule.cpp in public:
    CccModule* cModule;

    No, undo that


    • do you use CccModule anywhere else inside your MainWindow?
    • where did you put that connect statement?


  • No, I do not use CccModule anywhere else in the Mainwindow.

    I put the connect in the Mainwindow.cpp

    MainWindow::MainWindow(int argc, char *argv[], QWidget *parent) :
        QMainWindow(parent),
        m_ui(new Ui::MainWindow)
    {
        QCoreApplication::setOrganizationName(PIXYMON_COMPANY);
        QCoreApplication::setApplicationName(PIXYMON_TITLE);
    
        qRegisterMetaType<Device>("Device");
    
        m_ui->setupUi(this);
        setWindowTitle(PIXYMON_TITLE);
    
    
        m_interpreter = NULL;
        m_flash = NULL;
        m_pixyConnected = false;
        m_pixyDFUConnected = false;
        m_configDialog = NULL;
        m_fwInstructions = NULL;
        m_fwMessage = NULL;
        m_versionIncompatibility = false;
        m_testCycle = false;
        m_waiting = WAIT_NONE;
    
        parseCommandline(argc, argv);
    
        m_settings = new QSettings(QSettings::NativeFormat, QSettings::UserScope, PIXYMON_COMPANY, PIXYMON_TITLE);
        m_console = new ConsoleWidget(this);
        m_video = new VideoWidget(this);
    
        m_ui->imageLayout->addWidget(m_video);
        m_ui->imageLayout->addWidget(m_console);
    
        // hide console
        m_showConsole = m_testCycle;
        m_console->setVisible(m_testCycle);
        m_ui->actionConsole->setChecked(m_testCycle);
    
        m_ui->toolBar->addAction(m_ui->actionPlay_Pause);
    
        m_ui->actionDefault_program->setIcon(QIcon(":/icons/icons/home.png"));
        m_ui->toolBar->addAction(m_ui->actionDefault_program);
    
        m_ui->actionRaw_video->setIcon(QIcon(":/icons/icons/raw.png"));
        m_ui->toolBar->addAction(m_ui->actionRaw_video);
    
        m_ui->actionConfigure->setIcon(QIcon(":/icons/icons/config.png"));
        m_ui->toolBar->addAction(m_ui->actionConfigure);
    
        m_ui->menuProgram->setToolTipsVisible(true);
    
        m_status = new QLabel;
        // give the status a little of a left margin
        m_ui->statusBar->setContentsMargins(6, 0, 0, 0);
        m_ui->statusBar->addPermanentWidget(m_status, 1);
        updateButtons();
    
        m_parameters.add("Pixy start command", PT_STRING, "",
            "The command that is sent to Pixy upon initialization");
    
        // start looking for devices
        m_connect = new ConnectEvent(this);
        if (m_connect->getConnected()==NONE)
            error("No Pixy devices have been detected.\n");
    
    
    
    
        connect(cModule, &CccModule::paletteChanged, this, [=](int index, uint32_t palette)->void{
        m_ui->textBrowser->append(QStringLiteral("Palette changed. Index %1, Palette: %2").arg(index).arg(palette));
        });
    
    }
    
    MainWindow::~MainWindow()
    {
        if (m_connect)
            delete m_connect;
    
        DBG("deleting mainWindow");
        // we don't delete any of the widgets because the parent deletes it's children upon deletion
    
        delete m_settings;
    }
    
    


  • @jrod2much said in Signals and slots or whatever:

    I put the connect in the Mainwindow.cpp

    Ok, this is correct

    I do not use CccModule anywhere else in the Mainwindow.

    So where are you using that class?



  • So here is the entire CccModule.cpp source file:

    #include <QPainter>
    #include <QString>
    #include <stdio.h>
    #include "cccmodule.h"
    #include "interpreter.h"
    #include "renderer.h"
    #include "qqueue.h"
    #include "colorlut.h"
    #include "calc.h"
    
    // declare module
    MON_MODULE(CccModule);
    
    
    
    CccModule::CccModule(Interpreter *interpreter) : MonModule(interpreter)
    {
        int i;
    
        m_crc = 0;
        m_qvals = new uint32_t[0x8000];
        m_numQvals = 0;
    
    
        for (i=0; i<CL_NUM_SIGNATURES; i++)
            m_palette[i] = Qt::black;
    }
    
    CccModule::~CccModule()
    {
        delete [] m_qvals;
    }
    
    bool CccModule::render(uint32_t fourcc, const void *args[])
    {
        if (fourcc==FOURCC('C', 'C', 'B', '1'))
        {
            renderCCB1(*(uint8_t *)args[0], *(uint16_t *)args[1], *(uint32_t *)args[2], *(uint32_t *)args[3], (uint8_t *)args[4]);
            return true;
        }
        else if (fourcc==FOURCC('C', 'C', 'B', '2'))
        {
            renderCCB2(*(uint8_t *)args[0], *(uint16_t *)args[1], *(uint32_t *)args[2], *(uint32_t *)args[3], (uint16_t *)args[4], *(uint32_t *)args[5], (uint16_t *)args[6]);
            return true;
        }
        else if (fourcc==FOURCC('C','C','Q','F'))
        {
            renderCCQF(*(uint8_t *)args[0], *(uint16_t *)args[1], *(uint16_t *)args[2]);
            return true;
        }
        else if (fourcc==FOURCC('C','C','Q','S'))
        {
            renderCCQS(*(uint32_t *)args[0], (uint32_t *)args[1]);
            return true;
        }
        return false;
    }
    
    bool CccModule::command(const QStringList &argv)
    {
        return false;
    }
    
    uint16_t convert10to8(uint32_t signum)
    {
        uint16_t res=0;
        uint32_t q;
    
        q = signum/10000;
        if (q)
        {
            res += q*8*8*8*8;
            signum -= q*10000;
        }
        q = signum/1000;
        if (q)
        {
            res += q*8*8*8;
            signum -= q*1000;
        }
        q = signum/100;
        if (q)
        {
            res += q*8*8;
            signum -= q*100;
        }
        q = signum/10;
        if (q)
        {
            res += q*8;
            signum -= q*10;
        }
        if (signum)
            res += signum;
    
        return res;
    }
    
    void CccModule::paramChange()
    {   
        CccModule* cModule
        QString m_paletteOne;
        int i;
        QVariant val;
        char id[128];
        uint32_t sigLen;
        uint8_t *sigData;
        QByteArray ba;
        bool setPalette;
    //Maybe something to do with signatures
    
        // check to see if any signatures have changed
        for (i=0, setPalette=false; i<CL_NUM_SIGNATURES; i++)
        {
            sprintf(id, "signature%d", i+1);
            if (pixyParameterChanged(id, &val))
            {
                ba = val.toByteArray();
                Chirp::deserialize((uint8_t *)ba.data(), val.toByteArray().size(), &sigLen, &sigData, END);
                if (sigLen==sizeof(ColorSignature))
                {
                    memcpy(m_signatures+i, sigData, sizeof(ColorSignature));
    
    
                    //m_palette[i] = m_signatures[i].m_rgb;
    
    
    //THIS IS THE CODE YOU HAD ME INSERT
                    if(m_palette[i] != m_signatures[i].m_rgb)
                    {
                        m_palette[i] = m_signatures[i].m_rgb;
                        m_paletteOne = QString::number(m_signatures[i].m_rgb);
                        paletteChanged(i,m_palette[i]);
                    }
    
    
    
                    //I want to send m_palette[i]
                    //to the textBrowser in the Mainwindow
    
                    QString print = "HINT(";
                    setPalette = true;
                }
            }
        }
        if (setPalette)
            m_renderer->setPalette(m_palette);
    
        // create label dictionary
        Parameters &params = m_interpreter->m_pixyParameters.parameters();
        QStringList words;
        uint32_t signum;
        m_labels.clear();
       // go through all parameters and find labels
        for (i=0; i<params.length(); i++)
        {
            if (params[i].id().startsWith("Signature label"))
            {
                words = params[i].id().split(QRegExp("\\s+"));
                if (words.length()<3) // bogus!
                    continue;
                signum = words[2].toUInt();
                m_labels.push_back(QPair<uint16_t, QString>(convert10to8(signum), params[i].value().toString().remove(QRegExp("^\\s+")))); // remove leading whitespace
            }
        }
    }
    
    
    QString CccModule::lookup(uint16_t signum)
    {
        int i;
    
        for (i=0; i<m_labels.length(); i++)
        {
            if (m_labels[i].first==signum)
                return m_labels[i].second;
        }
        return "";
    }
    
    
    
    void CccModule::renderCCQF(uint8_t renderFlags, uint16_t width, uint16_t height)
    {
        if (renderFlags&RENDER_FLAG_START)
            m_numQvals = 0;
        else
            m_renderer->renderCCQ1(renderFlags, width, height, m_numQvals, m_qvals);
    }
    
    void CccModule::renderCCQS(uint32_t numVals, uint32_t *vals)
    {
        uint32_t i;
    
        for (i=0; i<numVals && m_numQvals<0x8000; i++)
            m_qvals[m_numQvals++] = vals[i];
    }
    
    int CccModule::renderCCB1(uint8_t renderFlags, uint16_t width, uint16_t height, uint32_t numBlobs, uint8_t *blobs)
    {
        float scale = (float)m_renderer->m_video->activeWidth()/width;
        QImage img(width*scale, height*scale, QImage::Format_ARGB32);
    
        if (renderFlags&RENDER_FLAG_BLEND) // if we're blending, we should be transparent
            img.fill(0x00000000);
        else
            img.fill(0xff000000); // otherwise, we're just black
    
        numBlobs /= sizeof(BlobC);
        renderBlobsC(renderFlags&RENDER_FLAG_BLEND, &img, scale, (BlobC *)blobs, numBlobs);
    
        m_renderer->emitImage(img, renderFlags, "CCC Blobs");
    
        return 0;
    }
    
    int CccModule::renderCCB2(uint8_t renderFlags, uint16_t width, uint16_t height, uint32_t numBlobs, uint16_t *blobs, uint32_t numCCBlobs, uint16_t *ccBlobs)
    {
        float scale = (float)m_renderer->m_video->activeWidth()/width;
        QImage img(width*scale, height*scale, QImage::Format_ARGB32);
    
        if (renderFlags&RENDER_FLAG_BLEND) // if we're blending, we should be transparent
            img.fill(0x00000000);
        else
            img.fill(0xff000000); // otherwise, we're just black
    
        numBlobs /= sizeof(BlobA2)/sizeof(uint16_t);
        numCCBlobs /= sizeof(BlobA2)/sizeof(uint16_t);
        renderBlobsA(renderFlags&RENDER_FLAG_BLEND, &img, scale, (BlobA2 *)blobs, numBlobs);
        renderBlobsA(renderFlags&RENDER_FLAG_BLEND, &img, scale, (BlobA2 *)ccBlobs, numCCBlobs);
    
        m_renderer->emitImage(img, renderFlags, "CCC Blobs");
    
        return 0;
    }
    
    void CccModule::renderBlobsA(bool blend, QImage *image, float scale, BlobA2 *blobs, uint32_t numBlobs)
    {
        QPainter p;
        QString str, modelStr;
        uint x, y, w, h, i;
    
        p.begin(image);
    
        for (i=0; i<numBlobs; i++)
        {
            if (blobs[i].m_model==0)
                continue;
            x = scale*blobs[i].m_left;
            y = scale*blobs[i].m_top;
            w = scale*blobs[i].m_right - x;
            h = scale*blobs[i].m_bottom - y;
    
            //DBG("%d %d %d %d", left, right, top, bottom);
            if (blend || blobs[i].m_model>CL_NUM_SIGNATURES+1)
                Renderer::drawRect(&p, QRect(x, y, w, h), QColor(Qt::white), 0x40);
            else
                Renderer::drawRect(&p, QRect(x, y, w, h), m_palette[blobs[i].m_model-1], 0xff);
            // color code
            if (blobs[i].m_model>CL_NUM_SIGNATURES+1)
            {
                if ((str=lookup(blobs[i].m_model))=="")
                {
                    modelStr = QString::number(blobs[i].m_model, 8);
                    str = "s=" + modelStr + ", " + QChar(0xa6, 0x03) + "=" + "0";//QString::number(blobs[i].m_angle);
                }
                else
                    str += QString(", ") + QChar(0xa6, 0x03) + "=" + "0"; //QString::number(blobs[i].m_angle);
    
            }
            else if ((str=lookup(blobs[i].m_model))=="")
                str = str.sprintf("s=%d", blobs[i].m_model);
    
           Renderer::drawText(&p, x+w/2, y+h/2, str);
        }
        p.end();
    }
    
    void CccModule::renderBlobsC(bool blend, QImage *image, float scale, BlobC *blobs, uint32_t numBlobs)
    {
        QPainter p;
        QString str, modelStr;
        uint x, y, w, h, i;
    
        p.begin(image);
    
        for (i=0; i<numBlobs; i++)
        {
            if (blobs[i].m_model==0)
                continue;
            w = scale*blobs[i].m_width;
            h = scale*blobs[i].m_height;
            x = scale*blobs[i].m_x-w/2;
            y = scale*blobs[i].m_y-h/2;
    
            //DBG("%d %d %d %d", left, right, top, bottom);
            if (blend || blobs[i].m_model>CL_NUM_SIGNATURES+1)
                Renderer::drawRect(&p, QRect(x, y, w, h), QColor(Qt::white), 0x40);
            else
                Renderer::drawRect(&p, QRect(x, y, w, h), m_palette[blobs[i].m_model-1], 0xff);
            // color code
            if (blobs[i].m_model>CL_NUM_SIGNATURES+1)
            {
                if ((str=lookup(blobs[i].m_model))=="")
                {
                    modelStr = QString::number(blobs[i].m_model, 8);
                    str = "s=" + modelStr + ", " + QChar(0xa6, 0x03) + "=" + QString::number(blobs[i].m_angle);
                }
                else
                    str += QString(", ") + QChar(0xa6, 0x03) + "=" + QString::number(blobs[i].m_angle);
    
            }
            else if ((str=lookup(blobs[i].m_model))=="")
                str = str.sprintf("s=%d", blobs[i].m_model);
    
           Renderer::drawText(&p, x+w/2, y+h/2, str);
        }
        p.end();
    }
    
    
    

    If I search the entire project, 'CccModule' only comes up in this file and its header.



  • So how does the palette change if it's never even used?



  • Welcome to my world haha. I don't know how it changes, but it does because I set a printf statement to print it every time the program runs through that section of code and it changes.

    Can't we just make it emit the value? I'm not sure I understand anything about the emit function but it sounds like it might work.


  • Moderators

    @jrod2much
    ok, you'll need to know where CccModule is instantiated, for you be able to listen/connect to signals that are emitted.

    Do you know where that happens? If not and, you 're using QtCreator, you can simply right-click on the constructor and click on find uses that will list all places where the an instance of that class is created, even when it's done in a ui file.

    Than you can use QObject:connect to connect that instance with your textbrowser



  • I think I found it:
    cccmodule.h

    class CccModule : public MonModule
    {
    public:
        CccModule(Interpreter *interpreter);
        ~CccModule(); //Is this the constructor?
    
        virtual bool render(uint32_t fourcc, const void *args[]);
        virtual bool command(const QStringList &argv);
        virtual void paramChange();
    
    

    There are no instantiations in the ui file


  • Moderators

    @jrod2much
    you should refresh your c++ skills

    https://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm

    what you're pointing out is the destructor.

    Also, to use QObject::connet your class needs to be a sublass of QObject somewhere. I don't know the context of MonModule but make sure that QObject is somere the baseclass in the hirachy.

    Also you should add the Q_Object macro in the header filke, as you're planning to use signals.



  • @J.Hilk Alright, I have added the Q_OBJECT macro to the header. I found the header and source of MonModule if you'd like to take a look.
    monmodule.h

    #define MAX_MONMODULES 0x40 // this should be way more than neeeded....
    
    class MonModule;
    class Interpreter;
    class Parameter;
    class Renderer;
    
    typedef MonModule *(*NewMonModuleFunc)(Interpreter *);
    typedef QList <MonModule *> MonModules;
    
    
    #define MON_MODULE(module) \
        MonModule *newFunc ## module(Interpreter *interpreter) {\
            return new module(interpreter); } \
        MonModuleUtil g_register ## module(newFunc ## module);
    
    
    class MonModule
    {
    public:
        MonModule(Interpreter *interpreter);
        virtual ~MonModule();
    
        virtual bool render(uint32_t fourcc, const void *args[]);
        virtual bool command(const QStringList &argv);
        virtual void paramChange();
    
    protected:
        bool pixyParameterChanged(const QString &id, QVariant *val=NULL);
        bool pixymonParameterChanged(const QString &id, QVariant *val=NULL);
        QVariant pixyParameter(const QString &id);
        QVariant pixymonParameter(const QString &id);
    
        Interpreter *m_interpreter;
        Renderer *m_renderer;
    };
    
    
    struct MonModuleUtil
    {
        MonModuleUtil(NewMonModuleFunc func)
        {
            m_modules[m_index++] = func;
        }
    
        static void createModules(MonModules *modules, Interpreter *interpreter)
        {
            for (uint i=0; i<m_index; i++)
                modules->push_back((*m_modules[i])(interpreter));
        }
    
        static void destroyModules(MonModules *modules)
        {
            // delete modules in reverse order
            for (int i=modules->size()-1; i>=0; i--)
                delete (*modules)[i];
        }
    
        static NewMonModuleFunc m_modules[MAX_MONMODULES];
        static uint m_index;
        static Interpreter *m_interpreter;
    };
    
    void cprintf(const char *format, ...);
    
    

    monmodule.cpp

    NewMonModuleFunc MonModuleUtil::m_modules[MAX_MONMODULES];
    unsigned int MonModuleUtil::m_index = 0;
    Interpreter *MonModuleUtil::m_interpreter = NULL;
    
    
    
    MonModule::MonModule(Interpreter *interpreter)
    {
        m_interpreter = interpreter;
        m_renderer = m_interpreter->m_renderer;
        MonModuleUtil::m_interpreter = interpreter;
    
    }
    
    MonModule::~MonModule()
    {
    }
    
    bool MonModule::render(uint32_t fourcc, const void *args[])
    {
        return false;
    }
    
    bool MonModule::command(const QStringList &argv)
    {
        return false;
    }
    
    void MonModule::paramChange()
    {
    }
    
    bool MonModule::pixyParameterChanged(const QString &id, QVariant *val)
    {
        QMutexLocker lock(m_interpreter->m_pixyParameters.mutex());
        Parameter *param = m_interpreter->m_pixyParameters.parameter(id);
        if (param && val)
            *val = param->value();
        if (param && param->dirty())
            return true;
        return false;
    }
    
    bool MonModule::pixymonParameterChanged(const QString &id, QVariant *val)
    {
        QMutexLocker lock(m_interpreter->m_pixymonParameters->mutex());
        Parameter *param = m_interpreter->m_pixymonParameters->parameter(id);
        if (param && val)
            *val = param->value();
        if (param && param->dirty())
            return true;
        return false;
    }
    
    QVariant MonModule::pixyParameter(const QString &id)
    {
        return m_interpreter->m_pixyParameters.value(id);
    }
    
    QVariant MonModule::pixymonParameter(const QString &id)
    {
        return m_interpreter->m_pixymonParameters->value(id);
    }
    
    
    void cprintf(const char *format, ...)
    {
        char buffer[256];
        va_list args;
        va_start(args, format);
        vsnprintf(buffer, 256, format, args);
        MonModuleUtil::m_interpreter->cprintf(buffer);
        va_end(args);
    }
    
    


  • @jrod2much said in Signals and slots or whatever:

    I set a printf statement to print it every time the program runs through that section of code and it changes.

    Ok, baby steps. Can you put a breakpoint in that section of code and post us the stack trace you see when it gets hit?



  • @VRonin
    So, I have placed many breakpoints in many places and the program does not terminate at all. The value of m_palette[i] only prints to the output once I manually exit the application running.
    The good part is that if I make many changes to m_palette[i], then they all print out in list form. The bad part is that for some reason, the break points Arent being triggered. I took the time to read up on breakpoint implementation so I don't think I am doing it wrong, but nothing is triggering the breakpoints.



  • @jrod2much said in Signals and slots or whatever:

    if I make many changes to m_palette[i]

    How are you making that change?



  • @VRonin So the application is made to run a camera that detects objects. For instance, you can shoot a live video feed, then create a "signature" by selecting the signature option, the frame freezes, and you can use your mouse to highlight an area on the video feed, lets say a red rubber ball. Then the application stores that data and any time a red rubber ball comes into the live video feed, the application tracks it. The application is capable of storing up to 7 different signatures. Hence the m_palette[i]. If you want to read more on it, the camera is called PixyCam 2 and the application it comes with is called PixyMon.

    What I have done here and for the last 2 weeks is tried to take the open source application code that is built on Qt, and add a textBrowser that can display the current signature RGB code. I have found the data variable for the first signature (m_palette[0]). But the application is very complex for a beginner like me and frankly, I thought it would be easier of a task so that I can continue with my project.

    So when I 'make changes' I am just setting a new Signature 1 on the application as it runs.



  • ok, one last try, add Q_ASSERT(false); after the m_palette[i] = m_signatures[i].m_rgb;. this will force your program to crash, when it does, look at the stack trace and post it here please



  • @VRonin You are going to hate me Ronin. I have searched all over the internet, I am 99% sure that Qt Creator does not have a stack trace. There are a bunch of forums saying I have to add a huge amount of code to the debug library in order to create a stack trace and I don't think I am skilled enough to do this.

    Here is the Application Output if that is what you mean by stack trace, but it does not seem helpful:
    09:51:55: Starting C:\Users\rodriguez\Desktop\pixy2-master\src\host\build-pixymon-Desktop_Qt_5_2_1_MinGW_32bit-Debug\debug\PixyMon...
    ASSERT: "false" in file ..\pixymon\cccmodule.cpp, line 155
    QObject::killTimers: timers cannot be stopped from another thread
    09:52:01: C:/Users/rodriguez/Desktop/pixy2-master/src/host/build-pixymon-Desktop_Qt_5_2_1_MinGW_32bit-Debug/debug/PixyMon exited with code 3

    The Q_ASSERT(false); did work. In fact, it worked instantly. It closes the program as soon as the program opens and loads without me pressing anything.

    Honestly, I did not think that such a simple thing as printing a value to the UI would be so difficult. I'm baffled. Is there any way around this that you can think of. I tried to make a global variable to carry the data of m_palette[0] to the Mainwindow.cpp but obviously even that is drawing an error…



  • @jrod2much said in Signals and slots or whatever:

    I am 99% sure that Qt Creator does not have a stack trace.

    The one in the red rectangle is the stack trace
    0_1538124038320_Capture.PNG

    @jrod2much said in Signals and slots or whatever:

    I did not think that such a simple thing as printing a value to the UI would be so difficult.

    It is not. Sorry to be brutal but it's your inexperience with the language and the tools that is making this difficult. The good news is that once you do it once and you understand it, the next time it will be a breeze



  • @VRonin I hope so haha

    Okay so take a look, nothing is writing to the stack trace but I did notice that for the breakpoints we have different icons.

    0_1538124554988_130b2d24-b263-4289-93aa-3cdc02a08f44-image.png



  • Did you start the debugger? it's the play button with a bug on it. Just above the hammer in the bottom left corner



  • @VRonin Still nothing and I got this warning

    0_1538125162731_7c6b217c-a778-4921-8074-7f46ba78314e-image.png

    Would this warning effect the stack trace? I can take a moment to try and fix it if so. It says that the breakpoints are failing because of it.



  • Tools->options->Kits->select the kit that you are using

    Can you take a screenshot of the page?



  • @VRonin
    0_1538125910939_c9fdcb63-f48e-4c91-9c6e-ce928e37541e-image.png

    Yeah, as you can imagine, the process of getting the project to build was a nightmare for me as a person with no experience so i probably did something wrong. Hence the yellow warnings.



  • The fact that it says "no compiler" and you are compiling makes me think you didn't select the correct kit. If I had to bet I'd say you are using the MinGW kit.

    P.S.
    Qt 5.2 has not been supported for a long while. Any reason why you are not updating?



  • @VRonin :( On the pixyMon website, the forum people said that 5.2 is the only one that works, I could try other versions but it would take me hours. I don't mind doing that though if you think it would be lucrative.



  • @jrod2much said in Signals and slots or whatever:

    5.2 is the only one that works

    Nevermind then, focus on the main point i.e. the screenshot of the kit you are actually using


  • Moderators

    @jrod2much said in Signals and slots or whatever:

    @VRonin :( On the pixyMon website, the forum people said that 5.2 is the only one that works, I could try other versions but it would take me hours. I don't mind doing that though if you think it would be lucrative.

    If the authors found that Qt 5.2 is most stable, then it's best to stick to Qt 5.2.

    An important point from http://cmucam.org/projects/cmucam5/wiki/Building_PixyMon : The authors used the MinGW compiler, not the MSVC compiler. So, close Qt Creator, launch MaintenanceTool.exe (found in the root folder of your Qt installation) and:

    • Remove (Uninstall) all the MSVC-based versions of Qt.
    • Add (Install) Tools > MinGW 4.8 (this is the version of MinGW that goes with Qt 5.2)

    Some questions for sanity checks:

    1. How did you install Qt in the first place?
    2. How/Why did you create the "Desktop" and "Qt Version 1" kits?


  • @VRonin Here is a picture of the correct kit. The breakpoints are still not working. @JKSH This picture was taken after I followed the steps you gave me.
    0_1538380476205_ea478f89-ecc7-42c0-b82c-159ab3fd4d61-image.png

    I downloaded Qt using the Qt installer, but when I first tried to build the project, the default installation "Tools" was not enough at first so I experimented by downloading many different versions. As for the "Desktop" and "Qt version" kits, if I could tell you how I did it or even why, I wouldn't be on this forum with the type of questions I've been asking Lmao.

    Here is the caution error message attached to the kit if it is helpful:

    0_1538380936038_16febb11-1878-4612-b1f6-42b179591112-image.png


  • Moderators

    @jrod2much said in Signals and slots or whatever:

    I downloaded Qt using the Qt installer, but when I first tried to build the project, the default installation "Tools" was not enough at first so I experimented by downloading many different versions. As for the "Desktop" and "Qt version" kits, if I could tell you how I did it or even why, I wouldn't be on this forum with the type of questions I've been asking Lmao.

    Fair enough :)

    Here is the caution error message attached to the kit if it is helpful:

    It looks like the auto-detector glitched and picked CDB to your debugger. CDB doesn't work with MinGW, I think.

    1. Select your MinGW kit (just like your screenshot) and click Clone.
    2. Change the Debugger to GNU GDB (if it doesn't appear, go to the Debuggers tab and add it -- it should be in the same folder as your MinGW compiler)
    3. Set the C compiler to MinGW 4.8 too (I don't think this is strictly needed, but it can't hurt)
    4. Give your kit a name, save it, then make it Default.
    5. Close Qt Creator.
    6. Go to your project folder and delete the *.pro.user file.
    7. Launch Qt Creator again and open your project. Make sure you use your new kit from Step #4.


  • Alright so a few things have happened. I followed all the sets but on step 2, I did not find any debugger saying exactly GNU GDB. Here is what I set the debugger to, for sake of trying anything remotely close:
    0_1538385651003_cf87e7ff-ac2f-47f1-b873-1a83844ac3eb-image.png

    Now, the program is actually just crashing which has never happened before (This is happening without any breakpoints):
    0_1538385699871_21be4ad3-2aa2-4191-9b0e-e018e34ca913-image.png
    Do I have to download the GNU GDB?


  • Moderators

    @jrod2much said in Signals and slots or whatever:

    I did not find any debugger saying exactly GNU GDB. Here is what I set the debugger to, for sake of trying anything remotely close:
    0_1538385651003_cf87e7ff-ac2f-47f1-b873-1a83844ac3eb-image.png

    Yep, you've correctly picked GNU GDB.

    Now, the program is actually just crashing which has never happened before (This is happening without any breakpoints):
    0_1538385699871_21be4ad3-2aa2-4191-9b0e-e018e34ca913-image.png

    What do you get when you run the debugger? (Don't click the Run arrow. Instead, click the button below it, which is the Run arrow plus a with the Bug icon -- see #4 at http://doc.qt.io/qtcreator/creator-quick-tour.html )





  • @JKSH Alright I fixed it, I had to copy a dll file to the executable file and BOOM. I finally got somewhere. @VRonin It seems like the interpreter code is the one that handles the parameter changes… What should be my next step?

    0_1538395209701_a7347f5c-881d-4faf-ad0f-70a9fdffcf37-image.png



  • @jrod2much said in Signals and slots or whatever:

    What should be my next step?

    Make the interpreter a QObject if it's not already and declare a signal identical to the one in CccModule.
    Now wherever the interpreter creates the CccModule connect() the 2 signals together

    The following step is finding out how interpreter gets created (by MainWindow?) it might be tricky as it's in a secondary thread but try and have a look



  • @VRonin Alright so I found different data to connect to the textBrowser, and after many attempts and much research, I am still unable to do it. Here are update images:
    0_1538477163306_51c1562a-a99c-4069-99b4-e5697211dd24-image.png
    0_1538477337855_ca3e47b9-7c89-4c5b-b74d-aa0b5397747d-image.png
    0_1538476458867_56c78a7d-687e-4960-9dd3-e63237487074-image.png

    0_1538476502705_156732dc-1477-4eb0-af2f-453173d4e892-image.png I don't know the coding lingo, but I' think I found the creation of the render class object or whatever. It is in this Interpret class that is then made an object in the mainwindow
    0_1538476593015_878a794f-1605-47cd-ab3c-4c1d33e8f002-image.png

    I am showing you any pieces of code that could possibly be related to what I am trying to do. Unfortunately, there are no examples, tutorials, or explanations on how to connect to a textBrowser, no matter where I search on the internet. Most tutorials about connections lazily explain elementary connections between buttons and sliders that are preformatted anyway. I would like to give it one more try before changing my direction from the possibilty of a UI that can display data values to just using printf functions and continuing my project. If you see any way you can help me, I would greatly appreciate it.


  • Lifetime Qt Champion

    @jrod2much said in Signals and slots or whatever:

    Most tutorials about connections lazily explain elementary connections

    connect() always work the same way no matter what you're connecting to what. You can't expect tutorials for everything.
    What is the problem now?
    It doesn't compile?
    Are your slots in "slots" section and signals in "signals" section in your classes? Are those classes derived from QObject?



  • @jsulm Yes connect() always works the same but what I mean by lazy tutorials is that many of the tutorials show how to use preformatted connect()'s. In my case, I have create every aspect of the connection. I don't know what goes in the four arguments of the connect and when I try to use the m_render for the first argument, it does not recognize.


Log in to reply