How to avoid QWidget from going out of sight - qwidget

Is there a way to avoid a QWidget from going out of sight?
I've got a line connecting some points; every point shows a widget (always the same) with some values; if I move the mouse over a point close to the right margin of the monitor, the QWidget will be shown just partially (a part will be out of the monitor).
How can I force the widget to be fully shown when needed, maybe on the left of the mouse?
Thanks to all.

you can compare the QWidgets boundingRect() and the QDesktopWidgets boundingRect() if outside, move the widget back ;)

Related

Move Insertion point of an NSTextView and make the written content visible

I am working on one Mac app. In which I want to play few tricks with insertion point of an NSTextView.
![NSTextView with overlay on it][2]
What am I doing is, I have an NSTextView (The whole image screen is of NSTextView) and above that I have placed one overlay (as you can see at the bottom of the image). There are two Labels at the extreme Left and Right end and has a white gradient view too. All these three I have placed above NSTextView.
Now when User types in, textview gets scrolled and at one point, typed letters goes below the overlay.
I have to manage this stuff only. I want to keep track that user has reached to the overlay border and if yes, I want to move the insertion point to little upside so that user can see the content which he/she is writing.
Will anyone suggest me, how to make this possible ?
I have tried many things, but its not working. Kindly help.

Blender points moving each other

I am making a model of a boat in Blender. However, whenever I try to move just one point, all of the points near it are moving too. What setting do I need to change to fix this?
BTW, Whenever I click one point, a circle appears around where I clicked, and stays put, does this have anything to do with my problem?
I have tried
Selecting and deselecting all points
Restarting Blender
Comparing my sidebar to a project that doesn't act this way
None of these worked. As I am still relatively new to Blender I have no Idea what the any of the real functions are or how to change them so any answer needs to be simplified to near caveman level.
Thanks
there is a icon, on the right side of the selection of vertex, edge, faces.. called Proportional editing. Press O to toggle it.
Make sure this is disabled.

How to make an object invisible at a particular keyframe without moving it in Blender (2.59)?

I'm quite new to blender, and I'm doing some experiments with it.
I've been searching for a way to make an object disappear from sight at a particular key-frame, without moving it out of the camera view. E.g. at frame 1, cube is there, at (0, 0, 0) and at frame 2, it's not visible anymore, but still there at position (0,0,0), at frame 3 it gets visible again.
After searching the web, I came upon this page which suggests to move the object to another layer, but since it applies to blender 2.49, it seems the software has changed since then: I'm unable to find the 'Layer' option when inserting a key-frame.
I've found some other sites but either they suggest to use a technique similar to the one linked above, or they suggest to change the alpha of the texture, which I'm not interested in.
So, what's the preferred method to make an object invisible in blender 2.59?
Additional information (not relevant for the answer I'm expecting, IMO):
I'm using blender to make models for Unity.
I'm using 2.59 because that's the one that works with the unity version that I have.
There are lots of ways to achieve this effect.
The easiest way is to keyframe the visibility of the object.
To do this, you simply go to the outliner, and click the little eyeball next to your object name, then hover over the closed eyeball and hit "i" to keyframe. The eye will then turn yellow to indicate it's keyframed. Do the same with the camera icon (so that your render behaves the same way). Then go to the point where you want the object to appear, and click the eyball and camera again to make them reappear, then hit "i" again over each to keyframe them... Isn't blender a wonderful program? I love being able to keyframe just about everything! :D
There are also these less easy, but variously useful methods, which you may also use in case you want some sort of transition in your vanishing/appearing:
My perferred way is to just move the opbejct off the screen, keyframe position, then set the animation (in the Graph Editor) curve type to "constant" (Key -> Interpolation Mode -> Constant), and move the object into place and set the keyframe where you want it to appear. It will thus instantaneously appear.
Set the material properties of the object to Transparent, and choose "Z-Transparency" and set alpha to 0. Then simply keyframe the alpha (hover mouse over Alpha value and hit "i"), then go to where you want it to appear, change the alpha value to 1, and keyframe again. This will make it fade in over time, or you can change the curve to constant in the Graph editor, as described in method 1.
If you want to mask the object while it is still in place, you could make a cube around it, set the cube material transparency to "mask", and then move the cube off camera to unmask the object, rather than moving the object. This is handy for when you want to partially unmask something in the course of the animation. For example, if you are creating a text overlay for a video, where you want text to appear as if it's coming out of your hand, you can animate the masked object to follow the contour of your hand as it pulls away to reveal the text.
In Blender 2.65, you can animate the objects visibility toggle in your Outliner panel.
Next to your scene objects there will be three icons: an eye, a cursor, and a camera.
Follow these steps to animate viewport visibility:
Find the object you wish to animate in the Outliner Panel
Mouse over the eye icon and hit "i" on your keyboard to set a keyframe.
Go to the next frame and turn the eye off, then hit "i" moused over it again.
Do the same thing with the camera icon to animate render visibility. I will usually keyframe both the viewport and render visibility icons in tandem so as not to forget to have these toggled when its time to render.
In version 2.9 the eye icon cannot be used to set a keyframe. I've found the best way for me is to use the Object Properties tab and under Transform set the three scale values (X,Y,Z) to zero for invisibility. You can then click the diamond to the right to set the keyframe. To make the object re-appear return the scale values to their original and click on the diamond keyframe icon again.
Obviously you can make it a lot easier for yourself by applying scale to the objects first then just switch them between 0 and 1.
AFAIK there is no easy way to directly set an object invisible in your case. Although the visibility can be animated in Blender (in outline view mive your cursor on the eye and press i) Unity3D doesn't recognise it.
Possible workarounds:
Move it to (1000, 0, 0)
Scale it by a very small value
A more elaborated approach could be to use a driver like when turning FK/IK animation on and off dynamically via a variable.
I found out (today!) that, in Blender 2.8 (& presumably beyond), you can control visibility of objects in animations either in viewports and/or renders. Select the object and, in the Object Properties, open the Visibility section. You will see a dot beside the Viewports and Renders options. Click on the dot in either Viewports or Renders (or both). The relevant boxes should turn green. Either make the object visible or invisible by checking or clearing its box and then click 'i' to insert a keyframe. Repeat the process in other keyframes.
Another way to do this is to make a cube around it and add a boolean modifier to the object you want to disappear, set the operation to difference and select the cube as the modifier's object target. Then turn off the cube's visibility and animate the visibility of the modifier.

Possible bug in Interface Builder?

I've a window with a horizontal split view. On the bottom pane of the split view, I have a nssegmentedcontrol, aligned to the center. On the bottom of the nssegmentedcontrol I have 5 tabs that are controlled by the segmented control - click in one of the cells and the corresponding tab opens.
My problem is, if I completely minimize the bottom pane, to the point where the dividing line touches the bottom of the window, the segmented control gets pushed on top of the table header and never goes back to its original place.
I've tried fiddling with IB to get this to work, but no luck. Has anyone experienced this?
Following what's on the comments, I replaced the default split view with the one found in BWToolkit that allows for the definition of minimum and maximum height of each view.
BWTookit is a no go, the framework leakes a lot.
You should use RBSplitView (google it), it also gives you option for min and max height
and I started using it because of a bug in the split view as well, I used it for a chat window
but the split view didn't autosave as it should, every time it got like 2px smaller,
RBSplitView is great, and doesn't leak.

Rectangles & Parsing in vb.net

This is kinda....a two part question. The first one is much more important than the second one, both of these are in the same project, and in vb.net.
How can I constrain the bounds of a rectangle object, which is controlled by a mouse, so it cannot be drawn outside a PictureBox? It is kindof a standard lasso control, the user can click and drag and it will draw a box from the initial click point to the mouse's current location. The starting point is at (rectX,rectY), and the box is drawn to the bottom right using rectDimX and rectDimY (to set the width and height) to see how much of a change has occurred with the mouse. Basically, its what you get with a click and drag on a Windows desktop. The issue here is that the rectangle is able to be drawn outside the PictureBox it is being drawn on, and the next part of the code attempts to reference this location, and then fails with an OutOfMemory exception. This leads me to my second question:
How can I make the rectangle draw in more than the fourth quadrant, which is only positive numbers? If it goes anywhere else, it does not show the rectangle, though it does still have the correct values. I know i could code this four times based on starting location and mouse location, but that would be a huge hassle and a rewrite of the whole rectangle code.
Is there an easy solution for either of these? The first one is a much bigger hassle, as it will be very time consuming if there is no easy way.
Thanks for the help!
For the first part of your question, even if the user drags the mouse beyond the edge of your picture box, you don't have to use those coordinates for your drawing routine. Simply do something like
If (DrawingPoint.X > PictureBox.Right)
DrawingPoint.X = PictureBox.Right // Right-hand limit of picture box
End If
And similar for the Y direction.
As for the negative numbers while drawing, you want to translate screen coordinates to client area coordinates. Have a look at ScreenToClient and ClientToScreen.