Render QML without being visible, like a background task - qml

Suppose I have a map, and a few polygons. I want to render them and take a screenshot of each one of them.
If the QQuickView is visible, thats easy.
But, how could I achieve this, with the QQuickView not visible, like a background task?
Any ideas?
I`m using Qt 5.12.

Related

React Native: Making a status indicator. Style a component, or use an image?

I have a list of items that can be active, idle (if the current time doesn't match their active time), or off all together. I want to make a little gem like icon that reflects their current status in the list view.
In web I would just use CSS to make a little shape with green, red, or orange. Are there any disadvantages to just styling an empty view in React Native where I should make them images?
Thank you.
There is nothing wrong in using styles views as simple icons or indicators and this might actually help avoid some overheads( like time to display the image or memory for the images over the top of my head). The only downside I can think of is that it won't give you the same precision as images would.

Change GridViewItem background color when loading

I have a GridView with UserControl as item. When I'm scrolling, the UserControl are loading, the background in my UserControl is tranparent, but when its loading, the color of the background is a dark gray.
Is it possible to change the "loading" color of the background?
Pretty limited information there.
Okay, so your user control could default to a loading color and when it detects the load is complete it changes its own background color to the final color.
Two, you could uses phases to control the rendering order of an item in your list. Making phase 0 your loading color and phase X (whatever is last) your final color. Complex? Yes, but would certainly work.
You would accomplish it using IncrementalUpdate. More here.
Because I don't know more how you might detect that an item is loaded, I can only hope that those first two suggestions will help. I certainly hope they do.
// best of luck

Drawing outside of NSWindow

I understand how to draw inside an NSWindow frame. But I don't understand how to achieve something like this for example:
If I knew, how this is called, I could investigate the matter further, but as I didn't know what to look for, this is impossible.
I appreciate any kind of hint.
Thanks a lot.
The app in the screenshot looks like it's using a customized NSDrawer. Drawers slide out from a side of a window and can display any content.
Take a look at the documentation to see if it's what you want:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Drawers/Drawers.html#//apple_ref/doc/uid/10000001-BABFIBIA
Drawers are easy to set up. However, while you have full control over the content inside a drawer, you don't have much control over how the border looks without using private APIs (e.g., the ragged edges in the screenshot). If you want more control, you can use a borderless child window.
Here's a tutorial that makes a borderless, entirely custom window: http://cocoawithlove.com/2008/12/drawing-custom-window-on-mac-os-x.html
Then, you can "attach" your custom window to the parent window with -[NSWindow addChildWindow:ordered:]. That will allow the child window to follow the parent window as it moves. You will still need to respond to changes to the parent window size, and perhaps some other properties, on your own.

Chaning the background color around a PDF in a UIWebView on Device

I'm using a webview to display a PDF.
The webview displays the PDF at it's actual size which is a little smaller than the size of the webvieww itself, revealing the scroll view underneath it.
I've tried setting the Webview to opaque and setting it's background color to another color, which works fine and dandy in the simulator, but fails to change the color on the device. On the device it changes the color of the background of the view behind the scroll view, this can be seen when the PDF is pulled all the way down.
I've also tried setting all the UIView's backgrounds, by iterating through the subviews but to no avail.
I've updated a diagram to help illustrate which area I'd like to color.
Uploaded Diagram
You really shouldn't mess around with UIWebView's internals.
They can change anytime and your code might just crash on the next version of iOS.
If you need more control about pdf display, you might wanna take a look at other possibilities to show pdf, like using the CGPDFDrawPage* functions. Of course they are pretty low-level and it's a lot of work required until you can get fast page display, zooming, etc all right.

How to display indeterminate NSProgressIndicator in the NSOutlineView?

I need to display a progress of loading of item's children. Please advise how to implement a progress indicator like it's done in Mail application:
(source: quicksnapper.com)
P. S. Here a source code of using indicator sub-views: http://snippets.dzone.com/posts/show/7684
This is harder than it should be, because Apple does not provide an NSProgressIndicatorCell. While table and outline views support the idea of custom cells being displayed within them, they are not set up to easily support custom subviews.
So the trick becomes, how do you get a a complete NSProgressIndicator view to display and animate at the desired spot in your window, without the ability to actually install it in the table view row?
The trick I've used is to literally install the NSProgressIndicator as a subview of the outline or table view itself. To find the location to add the subview, so it looks like it's "in the row", use the frameOfCellAtColumn:row: method. You can then position your progress indicator within that location of the outline view. When you're done spinning the progress indicator, you probably don't want to show it any more, so just remove it from its superview and discard it.
You will want to make sure you set the required autosizing flags on the progress indicator, so that it floats in the correct direction when/if your outline view is resized.
I'm sure there are other hacks like this to achieve the desired end result. I don't think there is any super-clean way to accomplish this trick.
Vienna is an open-source (Apache license) feed reader that has this in its source list. You should look at the Vienna source code to see how they did it.
Viena's implementation is not perfect. Add a feed to a folder then as it is loading and the progress indicator is busy collapse that folder. You will see the progress indicator still running in the same location.