Skip to content
QtWS25 Call for Papers
  • 0 Votes
    1 Posts
    851 Views
    No one has replied
  • 0 Votes
    6 Posts
    36k Views
    M

    Glad it worked! You can add [Solved] - in the title of this post to mark it has solved ;)

  • 0 Votes
    5 Posts
    2k Views
    mrjjM

    @Yaseen
    Well there are many samples and I stumbled on this one a day where I typed
    Widget in the search field to see all samples for Desktop / not Qt Quick . :)

  • 0 Votes
    13 Posts
    7k Views
    McLionM

    Further debugging shows that it works in my project on Windows but not when I compile for eLinux.
    Must be something that does not work with Qt 4.6.3 with DFB 1.4.3 and Fusion on eLinux.

  • 0 Votes
    1 Posts
    657 Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    S

    thanks again, sorry if my question was dumb

  • 0 Votes
    6 Posts
    6k Views
    SGaistS

    Do you have Qt configured to use that display ?

  • 0 Votes
    28 Posts
    14k Views
    WingsW

    Okay, so I studied @Chris-Kawa's answer again. And what hit me like a bolt of lightning is that what I was dreaming of doing is virtually nonsensical. Now I really understand what he was saying.

    This is what I wished to make happen (when I was naive :D):

    The background timer's timeout event, issues an update() command which draws immediately into the screen (like magic), which in turn, triggers a ~17ms single-shot timer. When that timer's timeout occurs, the text shown on the screen is cleared immediately (again magic). This keeps on looping till the user stops the background timer.

    This is what actually happens:

    Issue an update() command that "draws" the text (text is NOT shown yet). The single-shot timer (@~17ms) is triggered.
    ...probably some milliseconds elapsed (let this be x ms). At the vertical refresh moment, text becomes visible on screen. (this is damn fast, so I'm ignoring this interval)
    ...probably some milliseconds elapsed (let this be y ms) The single-shot timer has ended after ~(x+y) ms and a command to clear the text has been issued.
    ...probably some milliseconds elapsed (let this be z ms). At the vertical refresh moment, text is cleared from the screen. (ignoring this interval again)

    So, the user sees the text for about (x+y+z+k) ms where, k is the sum of the additional milliseconds used in actually doing that stuff. Now, x+y+z+k ms is almost always not equal to the desired interval.
    That's why, this process sucks, big time.

    Now, this is the best that can happen:

    Wait for the background timer to end. After it ends, as soon as a refresh cycle occurs, issue the command to draw the text. At the next refresh cycle, the text will be drawn to the screen. After the text is drawn, start the single-shot timer. After the timer has ended, issue the command to remove the text. Wait for the next refresh cycle. At the next refresh cycle, the text will be removed from the screen. Now, start the background time. Now go to the first step.

    Visualizing the process,
    please enable images

    Now, it is evident that showing the text exactly for 15ms is impossible using the previous method. But at least we can make sure that we don't show that more than ~32ms. And that's good news. At least in my case.

    Now, the point is how to achieve that. I don't know. But I'll find you and I'll kill you, nay implement you.

  • 0 Votes
    20 Posts
    7k Views
    SurajS

    Thank all for your replay,
    I solve my problem by using Phonon: :video player

    Steps:-

    i. Add Phonon::Video Player in ui file. I rename its programing name as "Video Player"
    ii. Add one button in that ui file and go to that button slot and adding following code in it:-
    // For getting system date and time for video name
    time_t now = time(0);
    struct tm tstruct;
    char buf[80];
    tstruct = *localtime(&now);

    strftime(buf, sizeof(buf), "%d_%m_%y_%H_%M", &tstruct); qDebug() << "Date and Time: "<<buf;

    // For getting static path where video will be stored
    QString a = "/home/Working_QT/BackupErrorWorking/DeviceTestVersion1/video/";
    a.append(buf);
    a.append(".avi");
    qDebug() << "a: "<<a;

    // For giving comlete command as it is accepted as a QString and converted into char(Because konsole command is accepted only char it shows error so we convert it)
    QString command = "ffmpeg -f video4linux2 -i /dev/video0 -vcodec mpeg4 -b 500k -r 25 -t 00:01:30 ";
    command.append(a);
    qDebug() << "Command: "<<command;
    char x[200];
    strcpy( x, command.toStdString().c_str());

    // Commaand to sysytem
    system(x);
    qDebug() << "Command given to system to capture video and name it according to that particular date and time: "<<x;

    // For playing video through Phonon VideoPlayer
    qDebug("Before video recording display");
    ui->VideoPlayer->play(Phonon::MediaSource(a));
    qDebug("After video recording display");

    iii. Included #include <time.h> // Required for giving video file name according to date and time
    and #include <qdebug.h>
    iv. Make changes in .pro file

    QT += phonon

  • 0 Votes
    12 Posts
    5k Views
    ealioneE

    PixmapItem indeed seems to have been created for that exact purpose, whereas ProxyWidget is more useful (as the name implies) for embedding a widget inside the scene. One drawback though, I did not knew about its existence while implementing the interactive pointer. Plus it will take me a while to implement it because I cannot directly take textPointer and use it as is in a PixmapItem. I definitely want to implement it later on though, probably as soon as I finish with undo/redo functionality.

    I am glad you did not see the delete statement because that way I learned something new. Not to mention that the code is more simple this way.

  • 0 Votes
    7 Posts
    28k Views
    J

    @Jeff-Andle No effect from any alterations to this. I could do the processing in a thread but the effort of mutexing all the variables that would be shared far exceeds the need to do this.

  • 0 Votes
    2 Posts
    1k Views
    Chris KawaC

    Hi, welcome to devnet.

    Here's one way:
    Override mousePressEvent. Inside check if the cursor is near the edge (use pos and rect for that). If it is then check which one and setOverrideCursor to something suitable. Remember the edge (or corner) that was pressed. Next, in the mouseMoveEvent setGeometry accordingly and handle mouseReleaseEvent to restoreOverrideCursor.