Can qgraphicsscene be conveted to a pixmap? - qgraphicsscene

I want to convert a QGraphicsScene to a pixmap, so I can add it to a listwidget as a QGraphicsPixmapItem. I wonder is it possible?
In another word, what I want to get is just like a thumb of a QGraphicsScene.

Yes, but not directly.
You can convert a QGraphicsView into a pixmap, using the static function QPixmap::grabWidget(). Create a graphics view, attach your scene to the view, and then convert the widget.

Related

Vulkan Image View Feature Flags

I get this validation message
If a VkSampler created with magFilter or minFilter equal to VK_FILTER_LINEAR and compareEnable equal to VK_FALSE is used to sample a VkImageView as a result of this command, then the image view's format features must contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
But I can't see how to set the image view format features. Any ideas?
The message is telling you that you're using a linear sampler (magFilter or minFilter is VK_FILTER_LINEAR) to sample from an image view whose format doesn't have the VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT feature.
There are two ways to fix this:
Use a different sampler. If you don't need linear filtering, you can use a point sampler instead.
Use a different image view format. If you need linear filtering, you can use a format that supports it.

Tree view with floating window

When I move my mouse to a row in tree view and stay here for a second, I want to see a floating window. (Like in developer mode.)
How Can I solve it? Any idea?
When you declare your field or fields that get rendered on a listview make sure you give to the __init__ method the help='My Floating Test' argument. That will cause a floating window to be shown when you hover on that field.
For example check:
addons/account/models/account.py
tag_ids = fields.Many2many('account.account.tag', 'account_account_account_tag', string='Tags', help="Optional tags you may want to assign for custom reporting")
The string on the help attribu will be shown on all the views that render this field upon hovering on it and pausing for 1 second.
If you want to modify the window that is shown, you can extend the
t-name="WidgetLabel.tooltip" template that is located in addons/web/static/src/xml/base_common.xml

Export MFC CView into vectorial format

With my MFC application, I am able to print my CDocument on screen using the CView class.
Basically, I use the CDC class to write text and draw polygons on screen to provide a view representation of my document.
Now let's say I would like to use that output view in Microsoft Word.
From a user point a view and without anymore developer work, I can :
copy-paste my drawing to word : this produces a raster BMP file which I am able to paste in Word
print my drawing and use a PDF exporter : this produces a vectorial PDF file which is light and zoom-able, but not easy to reuse in Word.
These two effortless solutions are great because I can keep the exact layout of my view, but have cons (raster or format)
Another way to solve my problem would be to write SVG or VML but I would not get the same layout and this would require a lot of work.
Is there a library to do the same kind of PDF export / print mechanism into a standard format ?
What would you suggest ? Thanks a lot.
To draw your view into a Enhanced Meta File, first read the documentation # MSDN:
http://msdn.microsoft.com/en-us/library/427wezx1%28v=VS.80%29.aspx
Here is an example, how this works:
CMetaFileDC MFDC;
CRect rect(0,0,width,height);
MFDC.CreateEnhanced(NULL,NULL,rect,NULL);
MFDC.SetBkMode(TRANSPARENT);
MFDC.SetMapMode(MM_HIMETRIC);
CDC tempDC;
tempDC.CreateCompatibleDC(&MFDC);
MFDC.SetAttribDC(tempDC.m_hDC);
// now you draw into the DC like it was your original view
HENHMETAFILE hEnhMetaFile = MFDC.CloseEnhanced();
HENHMETAFILE hEMF = NULL;
hEMF = CopyEnhMetaFile(hEnhMetaFile,"C:\\Temp\\Test.emf");
DeleteEnhMetaFile(hEMF);
DeleteEnhMetaFile(hEnhMetaFile);

How do I use multiple different UIFonts in a UILabel?

I have an UILabel in my UIView. The text of my label is dynamic: it's a web service call which returns to me the text that I will put in my label. Here's an example of the content of the label:
"this is an example of my text/nthis is the second line".
I would like to put the first line in a specific font (Helvetica-Bold 12px for example) and the second line in another font (Helvetica 15px for example). How i can do this?
Thanks for your answers.
Honestly I'd recommend using two separate UILabel instances, take your text and get an array via [string componentsSeparatedByString:#"\n"], then place object at index 0 in the first one, and if you have a second object, put it in the second label.
You could go for a static UIWebView and simply wrap your text into HTML+CSS. This will be much easier than doing all the layout in code.
Maybe what you are looking for is NSAttributedString.
Here is a example: iphone/ipad: How exactly use NSAttributedString?

actionscript 2.0 referencing main timeline form movie clip

Trying to edit as 2 file and stuck on how to tell a movie clip to gotoAndPlay the main time line.
The animation contains several tweens and I need to add a temporary tween.
I created a movie clip with tween.
Once the it gets to the Movie Clip(frame 10), I inserted the stop command so the the movieclip can run its tween.
The problem I am having is how to tell flash to resume the animation from frame 11.
I put
parent.gotoAndPlay(11);
but doesn't work...
Thanks,
Rexon
You could try to create a _global ref to the movie you'd like to control.
(I try to avoid using _global, but sometimes ...)
The real problem is why "parent" doesn't reference the object you expect. You could try to debug and see what the current tree is.
Another way is to pass the ref to the parent to the "to-be-caller" on creation.
It should be _parent instead of parent.
And if that doesn't work try to trace(_parent) like Milo suggested. That should give you the path to your the clips parent, and you should be able to count how many _parent._parent you should use to hit the right clip.
I tried to use this as well, but it did not work:
parent.gotoAndPlay(11);
So instead try to use the keyword _root:
_root.gotoAndPlay(11);
This worked for me.