I am trying to mimic a command-line client. I wish to set the cursor shape to '>', to show messages to user. I don't see that shape in the options provided by QCursor. Is there a way to set custom shapes to widget cursors?
You need to set the QTextEdit's viewport's cursor: http://doc.qt.nokia.com/stable/qtextedit.html
"The shape of the mouse cursor on a QTextEdit is Qt::IBeamCursor by default. It can be changed through the viewport()'s cursor property."
e.g. To hide the cursor completely:
ui.textEdit->viewport()->setCursor(Qt::BlankCursor);
are you talking about mouse's shape
or about the text caret
Check QTextLayout::drawCursor
You may think you want to do this, but you really don't. What will it gain you to change the mouse cursor to '>'? It will certainly confuse the user.
Related
In "Borland" C++ Builder 6, how to change color of button (TButton)?
I've tried in this way
button->Font->Color = clRed;
but it doesn't work.
TButton is a thin wrapper around a standard Win32 BUTTON control, which gets its coloring from the OS, not the VCL. You cannot set the Color for a standard TButton. The Color property exists only because it is inherited from a base class.
That being said, the Win32 BUTTON does support a BS_OWNERDRAW style. You can use SetWindowLong() to enable it, then subclass the button to handle the WM_DRAWITEM message so you can paint the button however you want.
Here is an example component that derives from TButton and implements BS_OWNERDRAW to expose working color properties: TColorButton
Use TPanel, Set Color & Bevel(s) to match button appearance.
Use OnClick Event, voilĂ , it's Color Button ~;O-)
The other option is to use a TBitBtn, which is not a wrapper around a WIN32 control, but is fully drawn by the VCL.
Because it is a graphic control everything will draw as you'd expect.
TBitBtn even receives keyboard focus, so it should work.
TBitBtn does work if you want to change the color of the font caption. The previous answer says it does not receive keyboard focus. I'm not sure what that person is meaning - but I just created a form with several other objects including one BitBtn - set my tab order, and indeed it will focus. I can hit the keyboard's space bar to push the button, and I can add an ALT-hotkey by putting an ampersand [&] in front of the desired letter. For all intents and purposes of a button, it seems to behave just like the Win32 control - but with CoLoR - yeah! And yes, I am using Borland C++ Builder 6.
atomkey -
I am trying to set the text background of the JavaFx label text as green using the following CSS
label.setStyle("-fx-background-color:rgba(85, 255, 68,0.7););
And the unhighlight using the following
label.setStyle("-fx-background-color:rgba(0,0,255,0);");
However these does not work most of the times when it has to be done back to back.
Is there any way to set the style without using CSS i.e. using JavaFx API itself. I found label.textFill(Paint p) for text color but nothing for background colour i.e. the color of the label itself.
Is there any way to set the style without using CSS i.e. using JavaFx API itself.
For some styles (such as the text fill) yes. For background colors, background images, borders, etc API methods will not be available until JavaFX 8 is released (see Public API for Region backgrounds and borders in the JavaFX issue tracker for more information - anybody can sign up for access).
these does not work most of the times when it has to be done back to back.
If you just highlight a label and then unhighlight it again without using something like a PauseTransition to give the user some time to see the highlighted label, then, from the user's perspective nothing is going to happen as all the user will see is an unhighlighted label.
Not sure of your use case, but if you only want to highlight part of the text in a label or let the user highlight the text with a mouse, then you can use a TextField with editable set to false.
Possible Workaround
If the Java 8 preview does not work for you and you are experiencing errors due do bugs in the JavaFX CSS processing, then try placing a Pane then a label inside a StackPane. Set the background color of the Pane to label.setStyle("-fx-background-color:rgba(85, 255, 68,0.7);); Bind the Pane's preferred width and height to the Label's width and height and toggle setVisible on the Pane as appropriate.
Finally I found the workarround. I had to give a PauseTransition to give the system some time between unhighlight and highlight. CSS showed effect only after the pausetransaction if the labels were already highlighted. I think it may be a bug. I will file a jira. The duration of paustransition may be as low as 1 milisecond so that there is not lag from the user's point of view.
How to change cursor when dragging using only CSS?
div:active{
cursor:move;
}
This won't work because it will be automatically changed by the browser to a text cursor when dragging. So how?
http://jsfiddle.net/nick_craver/uZ377/1/
Not sure if it truly solves your problem, but this ( http://jsfiddle.net/garretruh/pJjd4/ ) seems get rid of the text-select cursor by not making text selectable at all. Then again, you might want users to be able to select your text.
I realize this is over a year old, but just change the * selector at the top of that JSFiddle to only match the element that you are dragging around. No Javascript required.
This question is because normally when you want to click a button or link the user expect a HAND in the cursor but in the case of input type="button" you get a cursor arrow , does any know why is this? is cause is inherit from base class input?? and all inputs have pointer cursor?
I Know a simple css lik {cursor:pointer} //make the work... but wait is not make more sense that instead of "cursor:pointer" would be {cursor:hand} //IE support this one.
Hope some have the answer.
It's because it has no defined cursor style so it defaults to default
The "hand" cursor originally arose because of single-click links. And, in a web browser, the <a> element is the link element.
But, in other contexts (Windows forms, etc.), the default cursor (arrow pointer) can click on the buttons, so the browsers are just keeping UI consistent.
A browser could theoretically change the default cursor to a hand for <input type="button"> elements.
But, cursor:pointer; makes more sense for CSS, because it doesn't necessarily have to be a hand image. You can always change your cursors to another image, but the behavior (pointer in this case) defines what you call the cursor, not the image.
I am doing dataTipFunction on Tree in Flex3 Air,
At present the tooltip hides the present node, i need to reposition the tooltip above the node, how can change the x,y position of the tooltip.
Thanks in Advance
The way I did this was to add the toolTipShown listener on the tree itemRenderer, not on the tree. I have a blog post that shows you how to do it, including the code for positioning the tooltip below or above the node.
Hook into the tooltipShow event on the Tree and move the tooltip yourself (a reference to the tooltip is in the event)
tooltipShow
You might need to do a bit of logic to position it correctly, and you'll probably want to check if repositioning it would move it off screen and move it below instead in that case.