I was working on some other things I left out this part of my program. Anyway, I'm not familiar with the processEvents() can you help me out in a little more detail? Where and how do I implement this? I ended up with this--a lot of errors in my looper.cpp
#include <QtGui>
#include "looper.h"
bool stop;
void mainLoop();
basicLoop
::basicLoop(QWidget *parent
){
setupUi(this); // this sets up GUI
connect( startButton, SIGNAL( clicked() ), this, SLOT( startLoop() ) );
connect( stopButton, SIGNAL( clicked() ), this, SLOT( stopLoop() ) );
}
void basicLoop::startLoop()
{
&stop = false;
mainLoop();
}
void basicLoop::stopLoop()
{
&stop = true;
}
void mainLoop()
{
int i=0;
//check for stop button press
if (stopButton->isChecked) stopLoop();
while(!&stop)
{
textEdit
->append
(QString::number(i
));
i++;
}
}
#include <QtGui>
#include "looper.h"
bool stop;
void mainLoop();
basicLoop::basicLoop(QWidget *parent)
{
setupUi(this); // this sets up GUI
connect( startButton, SIGNAL( clicked() ), this, SLOT( startLoop() ) );
connect( stopButton, SIGNAL( clicked() ), this, SLOT( stopLoop() ) );
}
void basicLoop::startLoop()
{
&stop = false;
mainLoop();
}
void basicLoop::stopLoop()
{
&stop = true;
}
void mainLoop()
{
int i=0;
//check for stop button press
QCoreApplication::processEvents();
if (stopButton->isChecked) stopLoop();
while(!&stop)
{
textEdit->append(QString::number(i));
i++;
}
}
To copy to clipboard, switch view to plain text mode
I'm not sure if this is making sense..I don't know how to connect my stopButton now and how I would call the function stopLoop..
Bookmarks