Hi
I am trying to write my first Qt app. The point of the app is to try to demonstrate a video processing algorithm. I had a look around the documentation, and it seemed like I should apply a QGraphicsEffect to a Phonon::VideoPlayer, but I cannot get the graphicseffect to make any difference, with the video playing normally. To start with, my effect simply does nothing at all (empty function) - the idea being that the video will never be drawn. Maybe at this point I have already gone wrong in my approach to this, in which case please ignore the rest of the post
.
I tried altering my program so that the 'VideoPlayer' object is actually a QLabel with pixmap loaded into it. In this case, everything works as expected - no image is drawn, but if I add the single line: drawSource(painter); to my QGraphicsEffect's overloaded draw() function, the image is drawn correctly. This proves to me that my QGraphicsEffect and general program structure are both set up properly.
Applying the effect to the parent window instead of the video widget makes no difference (except for the parent window being 'corrupt' as the whole window is never actually drawn; it seems to contain random garbage from some graphics memory somewhere). I also tried moving the setGraphicsEffect function to different points in the program (just after the videoPlayer is created, just after the media file is loaded), and this made no difference either.
Any ideas or suggestions would be greatly appreciated.
Here is the relevant section of the widget (derived from QWidget) containing the video. I haven't included my QGraphicsEffect, as it doesn't actually do anything at this point (bear in mind the app does appear to work if VIDEO is not defined):
#ifdef VIDEO
Phonon::VideoPlayer *videoPlayer = new Phonon::VideoPlayer(Phonon::VideoCategory, this);
#else
Pixmap->load("/home/jeff/Examples/logos/logo-edubuntu.png");
videoPlayer->setPixmap(*Pixmap);
#endif //def VIDEO
grid->addWidget(videoPlayer, 1, 0, 3, 1);
cTestFilter *TestFilter = new cTestFilter(this, videoPlayer->size());
#ifdef VIDEO
// load video file
Phonon::MediaSource MediaFile("/home/jeff/Examples/Ubuntu_Free_Culture_Showcase/UbuntuIsHumanity.ogv");
videoPlayer->load(MediaFile);
videoPlayer->play(MediaFile);
#endif //def VIDEO
videoPlayer->setGraphicsEffect(TestFilter);
//this->setGraphicsEffect(TestFilter);
#ifdef VIDEO
Phonon::VideoPlayer *videoPlayer = new Phonon::VideoPlayer(Phonon::VideoCategory, this);
#else
QPixmap *Pixmap = new QPixmap();
Pixmap->load("/home/jeff/Examples/logos/logo-edubuntu.png");
QLabel *videoPlayer = new QLabel();
videoPlayer->setPixmap(*Pixmap);
#endif //def VIDEO
grid->addWidget(videoPlayer, 1, 0, 3, 1);
cTestFilter *TestFilter = new cTestFilter(this, videoPlayer->size());
#ifdef VIDEO
// load video file
Phonon::MediaSource MediaFile("/home/jeff/Examples/Ubuntu_Free_Culture_Showcase/UbuntuIsHumanity.ogv");
videoPlayer->load(MediaFile);
videoPlayer->play(MediaFile);
#endif //def VIDEO
videoPlayer->setGraphicsEffect(TestFilter);
//this->setGraphicsEffect(TestFilter);
To copy to clipboard, switch view to plain text mode
Bookmarks