MVivonetto
6th January 2017, 17:53
Hello Everyone!
Im having an issue that is most likely easy to solve but I'm not getting it. I have created a QPushButton in Creator and have developed functions that run perfectly fine using the release() slot. It works flawlessly! My problem now is I want to connect a QTimeLine to the already created release slot. My overall goal is that I have PixMaP Array of acquired images and i want to play them back in My QGraphicsView at variable speeds...basically creating an animation of captured frames...
I am almost finished and can send any single frame at a time to my GraphicsView, change them and so on...but now i would like to animate them by showing all 600 frames in the graphics view one at a time every 150 ms creating a 4 sec animation that is displayed almost in real time since my camera grabs 150 frame per second. Originally i thought a for loop was needed but come to find out the QtimeLine creates the loop which is really cool! Just for ease of understanding..instead of changing frames im just going to get the currentFrame count to display to console..if i can understand and get something as simple as that to work i can take care of the rest.
I am posting my code below..as of now my program tells me:
"QMetaObject::connectSlotsByName: No matching signal for on_play_released(int)"
"QObject::connect: No such slot QPushButton::released(int counting) in ..\mainwindow.cpp:57"
"QObject::connect: (receiver name: 'play')"
As if it does not exist and I'm using Q_Object in my header file as well...
// Namespace for using cout.
using namespace Pylon;
using namespace std;
using namespace Basler_UsbCameraParams;
using namespace cv;
using namespace std;
QVector<QImage> ImageArr;
QVector<QPixmap> PixMapArr;
QTimeLine *timeLine = new QTimeLine(150);
int counting = 0;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QGraphicsScene *Begin = new QGraphicsScene();
QGraphicsTextItem *startScene = new QGraphicsTextItem;
startScene->setPos(150,70);
startScene->setScale(2);
startScene->setPlainText("Please Ready Camera Position or Begin Acquisition");
Begin->addItem(startScene);
ui->graphicsView->setScene(Begin);
timeLine->setFrameRange(0, 600);
QObject::connect(timeLine, SIGNAL(frameChanged(int)), ui->play, SLOT(on_play_released(int counting)));
QObject::connect(ui->play, SIGNAL(released()), timeLine, SLOT(start()));
}
void MainWindow::on_play_released(int counting)
{
cout << timeLine->currentFrame() << endl;
}
Thank you all who can lend any advice!!!
Im having an issue that is most likely easy to solve but I'm not getting it. I have created a QPushButton in Creator and have developed functions that run perfectly fine using the release() slot. It works flawlessly! My problem now is I want to connect a QTimeLine to the already created release slot. My overall goal is that I have PixMaP Array of acquired images and i want to play them back in My QGraphicsView at variable speeds...basically creating an animation of captured frames...
I am almost finished and can send any single frame at a time to my GraphicsView, change them and so on...but now i would like to animate them by showing all 600 frames in the graphics view one at a time every 150 ms creating a 4 sec animation that is displayed almost in real time since my camera grabs 150 frame per second. Originally i thought a for loop was needed but come to find out the QtimeLine creates the loop which is really cool! Just for ease of understanding..instead of changing frames im just going to get the currentFrame count to display to console..if i can understand and get something as simple as that to work i can take care of the rest.
I am posting my code below..as of now my program tells me:
"QMetaObject::connectSlotsByName: No matching signal for on_play_released(int)"
"QObject::connect: No such slot QPushButton::released(int counting) in ..\mainwindow.cpp:57"
"QObject::connect: (receiver name: 'play')"
As if it does not exist and I'm using Q_Object in my header file as well...
// Namespace for using cout.
using namespace Pylon;
using namespace std;
using namespace Basler_UsbCameraParams;
using namespace cv;
using namespace std;
QVector<QImage> ImageArr;
QVector<QPixmap> PixMapArr;
QTimeLine *timeLine = new QTimeLine(150);
int counting = 0;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QGraphicsScene *Begin = new QGraphicsScene();
QGraphicsTextItem *startScene = new QGraphicsTextItem;
startScene->setPos(150,70);
startScene->setScale(2);
startScene->setPlainText("Please Ready Camera Position or Begin Acquisition");
Begin->addItem(startScene);
ui->graphicsView->setScene(Begin);
timeLine->setFrameRange(0, 600);
QObject::connect(timeLine, SIGNAL(frameChanged(int)), ui->play, SLOT(on_play_released(int counting)));
QObject::connect(ui->play, SIGNAL(released()), timeLine, SLOT(start()));
}
void MainWindow::on_play_released(int counting)
{
cout << timeLine->currentFrame() << endl;
}
Thank you all who can lend any advice!!!