I am trying to make my JavaFX media players reset when it finishes? I can't set autorepeat because I want them to randomly switch when one ends.
Related
I need to creat an app that shows the primary stage to the user, and if the user closes the stage, instead of finishing the application, it should just hide the stage for later use.
On swing we could just call setVisible(false) to a JFrame or JDialog, but how to do it on JavaFX?
Once the JavaFX toolkit has started, by default it will close down when the last visible window is closed.
To prevent this, you can call
Platform.setImplicitExit(false);
You typically do this in your start(...) method, though it can be called from any thread.
To exit the application, you would then need to call
Platform.exit();
(as the application no longer exits automatically).
I’m developijng a QT UI application. where in, The main Screen is shown on the launch of QT application. And later on button press event the Second Screen has to be shown and so on.
But to switch the screens from Screen 1 to Screen 2 the scrolling effects has to be show to the user, the scrolling effect can be from moving first to second from left to right(or from right to left).
As of now i have implemented using QT animation framework.
can any one please suggest me If there is any other way to achive this ?
Any help on this is highly appreciated.
Thanks in Advance
Varun
Basically, I have a multiThreaded application UI Thread with higher priority and Worker thread with NormalPriority. The Worker thread continuously listens to the events from other applications throught out the life time.
When i start an animation of switching the screen by setting the animation duration of setDuration(1500); the animation happens smoothly in the UI thread. only if the worker thread does not receive any events. And I can see the chocking effect in the animation if the worker thread receives any event form other applications during the animation.
The reason is, While the UI thread is animating it switches to the worker thread if the worker thread receives an event resulting in chocking effect in the UI.
If i use the scrolling of widgets instead of animation. than in this case the UI thread does not switch to the worker thread untill it process all the events in its event queue. resulting in smooth scrolling. To achive this I’m scrolling 10 pixel ever time in a event loop. so that i can see the smooth scrolling.
Please do suggest me if you have any other scenarios(or other way) which i can try ? So that i can see smooth animation with out chocking effects.
I´am trying to create my own custom list component in a Flex mobile Project which fires an Event when the user touches a listitem and holds the finger down for a given time.
Some kind of "longTouch"-Event like its implemented on native android listitems to edit the entry for example.
I tried to listen for the MOUSE_DOWN Event to start a timer and dispatch an event when the timer finished. But this approach failed because i cant get the listitem that was pressed by the user because the List component updates the "selectedItem"-property only after the user lifts his finger from the list.
thanks in advance
Andre Uschmann
There is no longTouch (or longPress) event exposed through the Flash Player Native APIs.
One option is to roll your own using TOUCH_BEGIN, TOUCH_END, and a timer.
Basically:
When user starts the touch, start the timer.
When the touch_End event fires; check the timer to see how long it has been running using currentCount. If it is long enough to be considered a "long touch", then dispatch your custom longPress event. If not; then stop the timer and ignore.
This could all happen inside the renderer; so you'd know exactly what item was pressed.
I expect this would be more solid than using mouse events, which seem to be inconsistent on touch based devices
Im using Qt framework , and i looking for the best method to show the user im processing something
how in Qt i can:
put the main window in the background and pop up window to the foreground with
for example " processing " massage
until its done processing the " processing " window will close and the main window returns to the foreground .
Use QProgressDialog. It is designed for that kind of use. You can use the QProgressDialog as a modal dialog thus preventing any user interaction to your main window. QProgressDialog also gives you an easy way to present the progress of your processing and an optional pushbutton to abort processing.
Edit:
QProgressBar can be used in two states: progressing in steps or just showing busy state.
QProgressDialog's progress bar cannot be used showing busy state because that would require setting QProgressDialog's min and max values to 0, which immediately closes the progress dialog. However, you can give the QProgressDialog a new progress bar using setBar()-function. Then you can set this progress bar's min, max and value to 0 and then getting the busy look.
QProgressDialog progressDialog("Processing...", "Abort", 0, INT_MAX, this);
QProgressBar* bar = new QProgressBar(&progressDialog);
bar->setRange(0, 0);
bar->setValue(0);
progress.setBar(bar);
progressDialog.setMinimumWidth(350);
progressDialog.setMinimumDuration(1000);
progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setValue(0);
// Do your time consuming processing here, but remember to change
// the progress dialog's value a few times per second.
// That will keep the busy indicator moving.
progressDialog.setValue(progressDialog.value() + 1);
// And check if the user has cancelled the processing
if (progressDialog.wasCanceled())
break or return or whatever necessary
// When your processing is done, close the dialog.
progressDialog.close();
You can try that:
In the function that call the pop-up just hide the main window once the process pop-up displayed.
Connect the end processing signal to the main window slot Show(). If you have not predefined signal for that, create one and emit it.
emit NameOfSignal;
Hope that helps
Edit:
For disabling the main window use setDisabled instead of hide and setEnabled instead of show.
You can give your "Processing"-window the Qt::WindowStaysOnTopHint to make it stay on top of your disabled main window.
If it's not to fancy for you, you can blur your main window using QGraphicsBlurEffect while the processing window is on top. That way the user gets the impression of the main window to be not accessable until your processing is done.
I use the last Qt version for a projet and QProcess. I want to lauch program from my application by using QProcess. I want to display a QGraphicsView transparent on full screen over the launched program.
For the moment: I hide the view, launch the program, sleep during 5 seconds and show the view. I want that my view keep the focus and stay on the top level? Is there any better way to do that? A custom setting for the QGraphicsView?
Create your QGraphicsView (or the window that contains it) with the Qt::WindowStaysOnTopHint flag
Once you run a program in QProcess, you have limited control over it. Qt does not provide details about other applications that are running, you won't know where the launched application is being displayed unless it tells you explicitly.
If you have access to the code of the application you're running, it is possible put a transparent overlay on top a given widget, or widgets, that could then record mouse clicks and other interactions. It's also possible to override events and record basic information about the application's use.