QDoubleSpinBox prefix position - user-interface

I'm making a financial program with qt.
I just added a QDoubleSpinBox to my dialog, in this spin box the user must insert the price of some products, so I set the prefix to my currency symbol.
Now I wanted to ask if there's a way to put the prefix to left and the numbers to right.

The prefix is prepended to the start of the displayed value, suffix is appended to the end of the displayed value.
As you can see the prefix is indeed at the left of the numbers. Anyways why would you need to change the prefix position? If you need to append a string to the end of the value just change the suffix, not the prefix.
Or perhaps I didn't understand the question correctly. If what you need is to align the prefix to the left and the numbers to the right like this:
You can visually adjust it by adding tab characters at the end of the prefix.
e.g. doubleSpinBox->setPrefix(tr("[prefix]\t"));

Related

How to add Notifications

I am searching for the Option where i can Show the messages in the Menu. e.g. below.
Create an item that will hold your numeric value, compute it, and substitute it in the label of the menu item surrounded with square brackets
Assignees [&F_ASSIGNEE_CNT.]

Display paired lists

I want to display two paired lists with an input -> output setup. For example, list one might be (a,b,c,d,e) and the second might be (1,2,3,4,5). The user should be able to scroll both lists at once. That way the user can see which pairs match up. It would be nice if the user could drag and drop to sort the list, but that isn't a requirement, I can make do without it.
I tried Taifun's sortable list, but I can't scroll two of those lists together.
I have also tried two list views inside a horizontal arrangement inside a vertical scroll, with the list view heights as automatic, so they are as tall as the elements inside so that the vertical scroll can move up and down instead. The problem with that is when the list view height is set to automatic, it doesn't change sizes to fit its elements.
Does anyone know how to do this?
I decided to use the following setup, and I am pretty happy with how it turned out.
When the user presses "Add item", they can enter an input (segment) and output (replacement). The items show up on a sortable list view, separated by a special dash character so I can break them back up into two paired lists. If someone tries to use that dash, theirs is replaced with a normal hyphen (-). Because the list view trims spaces, the first leading and the last trailing spaces (if any) are replaced with a caret and converted back when saving (^). When the user presses delete, a normal list view appears where the user can click on a pair and is prompted to delete it. The Settings button in the screenshot is just a back button to the main settings menu.
I hope this helps anyone looking for a way to display two paired lists together while avoiding the problems of scrolling and an overly complicated UI.

How to convince NSTextView that text starts at the bottom?

I will append some strings to NSTextView, but I want them to start at the bottom. New appended string should go underneath the last appended string.
In Java or C#, one can set VerticalAligment = bottom, but I can't find any appropriate way to achieve this in Cocoa... Any thoughts?
EDIT:
I guess I didn't specify precisely enough what I want, so I'll append two pictures. First is what it looks now, second one is what I want. Basically, the newest string is always at the bottom and the older ones gets pushed up. Makes sense now?

Conventions for the behavior of double or triple "click to select text" features?

Almost any mature program that involves text implements "double click to select the word" and, in some cases, "triple click to select additional stuff like an entire line" as a feature. I find these features useful but they are often inconsistent between programs.
Example - some programs' double clicks do not select the ending space after a word, but most do. Some recognize the - character as the end of a word, others do not. SO likes to select the entire paragraph as I write this post when I triple click it, VS web developer 2005 has no triple click support, and ultra-edit 32 will select one line upon triple clicking. We could come up with innumerable inconsistencies about how double and triple click pattern matching is implemented across programs.
I am concerned about how to implement this behavior in my program if nobody else has achieved a convention about how the pattern matching should work.
My question is, does a convention (conventions? maybe an MS or Linux convention?) exist that dictates how these features are supposed to behave to the end user? What, if any, are they?
I don’t believe there is a standard to the level of specification you want, and there probably shouldn’t be. Apple Human Interface Guidelines are the most complete. With respect to selecting content (as opposed to controls or discrete data objects), they say:
Double-clicking is most commonly used as a shortcut for other actions, such as… to select a word. Triple-clicking selects the next logical unit, as defined by the application. In a word-processing document, triple-clicking in a word selects the paragraph containing the word…. Double-clicking within a word selects the word. The selection should provide “smart” behavior; if the user deletes the selected word, for example, the space after the word should also be deleted… In some contexts—in a programming language, for example—it may be appropriate to allow users to select both the left and right parentheses (or braces or brackets) in a pair, as well as all the characters between them, by double-clicking either one of them.” (p115-116)
Apple is quite specific about what characters are and aren’t included in a word.
Microsoft’s Windows User Interaction Experience Guidelines say:
For some types of selectable objects, each click expands the effect of the click. For example, single-clicking in a text box sets the input location, double-clicking selects a word, and triple-clicking selects a sentence or paragraph. (p430)
Java Swing Look and Feel Design Guidelines say:
Double-clicking (clicking a mouse button twice in rapid succession without moving the mouse) is used to select larger units (for example, to select a word in a text field)…. Triple-clicking (clicking a mouse button three times in rapid succession without moving the mouse) is used to select even larger units (for instance, to select an entire line in a text field)…. A triple click in a line of text deselects any existing selection and selects the line.
The Gnome Human Interface Guidelines don’t say much about what double- and triple-clicking should do.
This gives you the freedom to choose whatever is best for your users. Double and tripling clicking are expert shortcuts, so their behavior should aim to maximize efficiency. Consider why the user is selecting something and design to make that easiest and fastest.
For example, apparently the rationale behind including the trailing space when double-clicking a word is that users usually select a word in order to copy or paste it in another position in the text. This implies you automatically include the trailing space in order keep the user from having to manually delete a remaining extra space at the source and add a word-separating space at the destination.
Likewise if users are selecting a line of code or paragraph to copy or move it somewhere else, then you probably want to include the newline characters so the user isn’t left with an empty line at the source and force to manually add a newline at the destination (assuming they didn’t want to take the line/paragraph and combine it with another line/paragraph.
If selection is for something other than copying and moving text in sentences, then none of this may apply and you don’t necessarily want to include trailing spaces or newlines. That’s why there shouldn’t be a standard.
An alternative is to do what Apple calls Intelligent Cut and Paste (see the Human Interface Guidelines), or Microsoft Word’s Smart Cut and Paste, where spaces, newlines and other adjustment are algorithmically figured out when cutting, copying, pasting, and deleting, not when selecting.
In my perfect world I would have it work like this.
Double click on a word selects the word only (a word according to the grammar rules of the locale), no trailing space (this is for easier copying between programs so that I would not need to remove any spaces when pasting)
If I remove the selected word my text editor is aware of my content and removes any additional spaces left over
A triple click selects a line with no trailing newlines. (A paragraph is a long line that has been wrapped)
In Windows, Linux and OS X double-click selects the word under cursor triple-click selects the entire line of text (single line only, i.e., wrapped line)
Finding answers and come up with a alternative solution:
I like to write code or command in text, and copy them to shell prompt without the ending \n
1. use notepad
2. surround each line with ()
3. use ctrl + double click.
Fine...

nstableview + cannot show partial file names

I am using Table View Control. In the control, I show File/Folders details, if I reduce the size of file/folder name column, it does not show partial file/folder name (whatever characters can be shown in the Column).
If a file name has multiple words in it, if enough space is not there to show a word then that word does not get shown at all, instead of showing some characters in that word (Either a word gets shown completely, or not at all)
I want to know how to resolve this issue.
Thanks so much.
Set the line break mode of the column's text cell, using either the Attributes inspector in IB or a setLineBreakMode: message to the cell.

Resources