Screen class in actionscript provides the latest total screen bounds and available screen bound, but doesn't allow to attach listener to listen for changes on runtime.
is there any way of detecting screen resolution changes on runtime, it is required to size the application whenever screen resolution is changed. e.g. in case when machine display is connected to projector/high resolution monitor and then switched back to normal.
thanks,
There are several solutions:
If your window is maximized, you can listen to any of various RESIZE events (see you comp. events list)
You can create invisible maximized window and listen to it's resize event
You can check screen resolution on timer (e.g. every 1 second). It will not decrease the performance.
Related
I'm still a beginner at Qt (5.15.2) and I'm trying to implement a way to setMaximumWidth of the application MainWindow based on the current screen it's on.
For example: if the application is on screen 1 (1366x768) it should have maximumWidth of 1366, if it goes to screen 2 (1920x1080), then it should have maximumWidth of 1920, and the same logic applies to a N number of screens. Is there a signal that can help me with this? If there is not, is there a good way to simulate a screen change signal?
What I tried:
I've searched for a QScreen::screenChanged signal but I couldn't find one, so I assume it doesn't exist.
I've tried using QGuiApplication::primaryScreenChanged(), but it didn't work because it only works with primary screens, so when I merely change screens the signal doesn't get activated, only if I go to windows and change the primary screen to the one I'm currently on (which is not desirable).
I've also thought of using timeout signal that would activate a function that checks the current screen and sets the maximum width, it probably would work, but it doesn't seem like a good solution performance wise.
Edit: as for what would cause the screen change, it would be the user, either by dragging the window to another screen or using shortcut keys.
I need a fullscreen window in QML. However, it must not be exclusive fullscreen. My application must work with accessible applications such as Windows On-screen Keyboard and Magnifier. If my application runs in exclusive fullscreen, it will stay on top of other accessible applications making them useless.
With QWidget, I can call showFullscreen() and get what I needed (a window that cover the entire screen while letting other accessible applications stay on top of it.
With QML, there are a few few ways to make the window fullscreen. However, all of the methods I've tried result in exclusive fullscreen.
I've tried all answers suggested here. To summarize I've tried setting visibility: "FullScreen". I've tried manually setting the width and height to match the screen resolution.
Can the Chromecast browser allow the iframe Youtube player to be set into full screen mode. Want to use this for a screen saver mode. Normally player not full screen, but if no sessions are doing anything then I want to take it to full screen while the playlist is playing.
I do not want to start it up in full screen, I want to switch to full screen after 3 minutes of inactivity on the chromecast receiver.
I´m trying to do this for 2 days and no success.
One, and only one view (the video record view) I need to force to start in landscape. All the other views must start in portrait. And... Landscape view and the others portrait views must not rotate if the user rotates the device.
I´m trying with stage.setAspectRatio(StageAspectRatio.PORTRAIT) for portrait views and stage.setAspectRatio(StageAspectRatio.LANDSCAPE) for landscape view. Sometimes works... Sometimes not.
Sometimes going from a portrait to landscape works but when I return to the caller portrait view, its rotate to landscape too.
Thanks for some help.
If you didn't already, take a look at this article that should be really useful to you: StageAspectRatio Enhancements in AIR 3.3
You could of course play with setAspectRatio to define starting orientation, but that's only part of the problem.
You can modify the autoOrients property located in your app descriptor file if you want to get rid of the automatic behavior and handle everything manually.
Or you could listen for every orientationChanging event of the Stage object and preventDefault() them to cancel any screen orientation.
Once this is done, you simple have to handle the loading orientation of your views and this should be it.
I have created an application with a screen resolution of 640 x 360 for the nokia n8. It includes a lot of flickables, labels, etc. I want it to run on the nokia e6 with a resolution of 640 x 480.
Up to now I have simply copied the the QML file and modified it for the new resolution but it's getting a little tiresome to do it for each update. I want to know if there is any simple way I can get it to automatically fit the output to any screen resolution? Or if there is something else I can do to simplify my task. I would prefer not to use anchors because it makes it too complicated to design the QML file.
How about using QApplication::desktop()->availableGeometry() to set the geometry of your application window?
From the docs:
QDesktopWidget::availableGeometry()
Returns the available geometry of the screen with index screen. What is available will be subrect of screenGeometry() based on what the platform decides is available (for example excludes the dock and menu bar on Mac OS X, or the task bar on Windows).
Addressing your comment below:
does it re size the entire screen
The const in QDesktopWidget::availableGeometry() const tells you that you can be pretty sure that the function doesn't alter anything. You'll need to do the resizing yourself.
Edit: The QML docs should give you the information you need to automatically change your application geometry. You could either change the geometry of the QML object from C++ or define your available screen geometry as a Q_PROPERTY and access it from QML. I'd recommend the former, as hooking up to the signal QDesktopWidget::workAreaResized might help you on mobile devices where your available geometery may change.
Actually you should avoid hardcoding the interface pixel by pixel and start using anchors. Ther will be some phones that have yet another screen resolution and then you have to create new QML for each of them. With anchors you can let the content fill all available space