How to filter out shortcut from translations - c++

In QT I have an item named tr("&Output") (where the & indicates a short-cut).
Now I want to use the same text without the shortcut - i.e. just "Output" translated to what-ever language, and I could not find this in the documentation.
Added: The reason for doing this is to tell the user to select a menu entry in this case "Output". So if the translation gets out of sync we might have a menu entry "Ausgabe" and telling the user to press "Ausgang", which isn't good. It could be that there is a completely different way of resolving this.
Obviously I can do tr("Output") - but that creates the need for additional translation, and the risk that they are inconsistent.
I can also do tr("&Output").replace("&", "") - but it seems like a hack. (And would need additional code to handle actual "&" in the text.)
I assume Qt has some internal mechanism for this, but is there a standardized way of accessing it?

Related

QtLineEdit placeholder: how to have the user replace chars 1 by 1 in insert mode

QtLineEdit - C++/Qt Creator 4.9/ Qt 5.12 / Windows widget app
tldr: Is there a way to prevent the placeholder text from being instantaneously wiped on user input, and instead have it being replaced character by character, in INSERT mode.
Example:
[ ******** ]
[ a******* ]
[ ab****** ]
It's a hard one to research because I get a lot of results about completely different problems with the same keywords.
To provide some context, in case maybe someone has a good but different approach to go around the problem:
The program is a personalized public address generator for a cryptocurrency.
The user designs the desired address prefix or suffix by editing the placeholder. Since it becomes exponentially harder to generate a corresponding private key, the GUI design has to discourage replacing more placeholder characters than reasonable. But I want it to be possible to decide which character positions you want to edit.
Examples of valid user input (there's more to it but you get the idea)
[test****************test]
[testest*****************]
[*****************testest]
This would make the desired output easier to visualize
Thanks!
In this case, you may want to subclass QLineEdit and override one of its input handling functions. In particular, you could create an overriding implementation of keyPressEvent(QKeyEvent *event) that adjusts the QLineEdit text. The placeholder text cannot be used persistently, as it is handled separately from the model text.

Nested tables in livecycle fall apart on email

I have a form here with a nested table - where each table can dynamically grow, i.e., the inner table (w/ Transit No and Account No) and the outer table (Accounts by ID No). Here is an example:
(Behind the buttons:
Add - $.parent.tbl.Row.instanceManager.addInstance();
Remove - $.parent.instanceManager.removeInstance(this.parent.index); (In
production I make sure there is at least one row to remove...)
In the definition for each table I do not have checked 'Repeat Table for Each Data Item'. This works great. However I did try with that checked and the outcome was the same.
Now, when I email the form and open the attachment, this is what I see:
You can see that the second table didn't make it, and apparently a row was added to the inner table in the first, without any data.
Any ideas on what's going wrong here? And what I can do about it?
Unfortunately I'm not sure what's wrong with your form but I have made a similar form that works - so I can show you how I did it and list a few things that I can think of that can cause problems.
This is what my form looks like and when I e-mail it, it comes out exactly the way it is:
(It has repeatable parent- and childsubforms like yours)
I did it entirely with JS though, no FormCalc and Dollar $igns :D
When a button is pressed I call a function from a Scriptobject.
These are the main parts of my script inside my functions:
Adding a Subform:
var oNewInstance = subform.instanceManager.addInstance(1);
Deleting a Subform:
if (subform.instanceManager.count > subform.instanceManager.occur.min)
{
subform.instanceManager.removeInstance(subform.index);
}
And these are my subforms' properties (in German, but you can figure it out :P):
Your problem might also have completely other reasons though, make sure you don't have any changes in an initialize,docReady, preSubmit and similar actions that occur between sending and opening the sent PDF.
Also before sending it as an e-mail you have to save it in Acrobat as a Reader Extended PDF:
Besides that I've noticed that sometimes problems can occur due to the target version (Selectable in LCD under File > Form Properties > Defaults).
It helped me sometimes to set it to the newest one.

python tkinter radiobutton state

How do you get the state of a Button (clicked or unclicked)? This is a button state and not a question about variables set by the button. How do I tell if an object in a Frame is selected using i.winfo_class() to identify a Radiobutton.
i.e.
for i in a.winfo_children():
if i.winfo_class() == "Radiobutton":
i.get()
Radiobuttons have no get attribute so this will never work, but the logic is the same. I've looked through documentation without success.
The only solution is to get the value of the associated variable and compare it to the value of the radiobutton. If they are the same, that radiobutton is selected.
Found the solution. ttk.Radiobutton has more functionality than the tkinter.Radiobutton.
Please make note there there are major issues with all methods and values dereferences by Radiobuttons even now. Sometimes you get a pointer, sometimes you get a string and need to dereference yourself. This makes Radiobuttons a more difficult Widget to deal with than most of the others I've been working with. There are many documents on this and they are fixing this, but it is something to note.
For my purposes, tkinter.Radiobutton has no instate which means there is no simple way to check if it is clicked. I was getting pointer after pointer and dereferencing was far too tedious and complex to code for a dynamic gui.
The code I've ended up with is as follows:
for i in a.winfo_children():
if i.winfo_class() == "TRadiobutton" and i.instate(['selected']) is True:
return i.cget('value')
Also make note that TRadioButton string is used instead of RadioButton, the object type returned is not the same between ttk and tkinter implementations of Radiobutton.

What is the best way to indicate that a substitution needs a confirmation dialogue?

I often invoke functions from my menu
Many have double entries:
- one for normal substitution
- one for subsitution with confirmation dialog (gc)
p.e.:
vnoreme 20.900 &Edit.Delete\ All\ but\ 1st\ Doubles\ :<C-U>call <SID>DeleteD("'<,'>","confirm-no")<CR>
vnoreme 20.901 &Edit.Delete\ All\ but\ 1st\ Doubles\ (gc)\ :<C-U>call <SID>DeleteD("'<,'>","confirm-yes")<CR>
Is there no better way then the one I use above to indicate a confirmation dialog?
(and to avoid all these double entries)
P.e. when a function invokes an inputdialog box, I would like to have a checkbox added where I can indicate (checking it) to add a dialog confirmation after every substitution, but unfortunately they don't exist and there is no way (as in autohotkey) to create an inputdialog GUI myself.
Well, you could change your Delete() function to ask you, whether you'd like to have each substitution being confirmed. Something like this:
fu! Delete(range)
let confirm = confirm("confirm each change?", "&yes\n&no", 1)
let cmd=printf("%ss/foobar/foobaz/g%s", a:range, confirm ? 'c' : '')
exe cmd
endfu
(this is just an example, you probably want to change at least the search and replace criteria)
Or, if you are using a simple substitution, learn to use the :ex command :promptrepl,
e.g. :promptrepl foobar will open a search/replace dialog where the search field will be set to 'foobar' and you only need to enter the replacement part and hit the buttons you like.

Always display flagged messages in mutt

In mutt, I'd like to keep track of important messages which I need to answer, pretty much like I did in GMail before. The problem is that I tend to forget that I have such important messages, and so, never run the macro which makes flagged messages appear (in case they are too old to appear in the index). So, I'd like that the flagged messages always appear in the main index, no matter how old they are. This setting, along with the fact that the flagged messages appear in a different color (they already do), should be enough to prevent me to forgetting answering old - but important - messages. Is that possible ?
Thanks in advance!
The ordering of messages cannot be changed arbitrarily outside the scope of sort and sort_aux. However, you can limit the messages in your index to specific kinds of mail and bind everything neatly to macros, like so:
macro index .i "<limit>(~N|~F)<Enter>" "view new/flag"
macro index .a "<limit>~A<Enter>" "view all"
The first macro .i will limit messages in the index to only flagged (starred) and new ones, whereas the latter .a will remove any limit and show all messages, again.
You can automatically apply one of these views when entering a mail folder by utilizing a folder-hook.
folder-hook */INBOX push .i
Just alter the regular expression following the hook to whatever folder(s) you want to apply the macro to. Simply press .a at any point in the index to show all messages, again.
For further details consult the manpage, as it is fairly comprehensive.
That's a great hint and it works, I only had to change folder-hook to point to /var/mail/username (Linux INBOX).
I only wonder if the "push" (or maybe even the macro itself) could be made conditional, that is to work only if there are any new/flagged messages. As it is now, if there are no such messages, one gets empty list and has to manually execute ".a" macro.