Preferences is bound to command+, by default. Suppose I want to add an additional key binding so that F2 (for example) also binds to Preferences? It must be possible because a few of the standard commands have alternate keystrokes.
According to the docs this is possible, but only with text commands.
"To add a sequence to an existing one, click the Add (+) button and type the new sequence. This only works for text commands; you cannot assign more than one sequence to a menu command."
You can find that in "Xcode 4.2 Developer Lbrary / Tools & Languages / IDEs / Key Bindings Preferences Help / Customizing Keyboard Shortcuts"
Related
I'm using the Sikuli Library with Robot Framework to run tests for a local windows application. Most solutions online are selenium based but I believe that only to work for web applications.
Entering text has been fine for the empty fields when there isn't a default value concerned.
Currently, I'm dealing with a field that contains a default value of 5000 but I need to change it to 10.
Text Field:
So far I've tried things such as:
Double-clicking the field first to highlight then type over (Input Text single clicks and removes highlight anyway)
Single-Clicking as Input text single clicks itself (Does not happen fast enough to simulate a double click)
I will answer in Sikuli terms. You just execute Ctrl+a to select content of the cell and then type 10
type('a', KeyModifier.CTRL)
type('10)
I am developing an Atom package, and I have certain commands that get executed when I press Ctrl-Shift-Up.
The first time I press Ctrl-Shift-Up, Atom enters a "mode" where things happen differently. Now, I think I know how to do that part. But I don't know how to tell atom to hijack the Escape key.
You can assign a command to Esc through your package keymap.
Example:
'atom-text-editor:not([mini])':
'escape': 'my-package:do-stuff'
If your CtrlShift↑ shortcut creates a custom view, you would want to limit your shortcut to its CSS selector.
Example:
'.my-custom-view':
'escape': 'my-package:do-stuff'
Further reading:
Atom Flight Manual: Keymaps In-Depth
Atom API: KeymapManager
We've defined the key-press sequence Ctrl + S in our web application to a specific action (save the current form).
Now we want to test that behavior with Robot Framework. How can we describe that accurately to do that?
The documentation describes how to use Enter or any single key press, but nothing is said about combinations. So how to trigger a Ctrl + S, for instance?
I was looking for the same and came across this. It says it is under implementation. Follow this for more update.
https://github.com/robotframework/Selenium2Library/issues/498
Lets hope it will be available to use by Oct-2015.
I found a solution with the ImageHorizonLibrary:
http://eficode.github.io/robotframework-imagehorizonlibrary/doc/ImageHorizonLibrary.html#Press%20Combination
Press Combination Key.CTRL Key.S
Here in the documentation you have examples of multiple keys pressed :
Press Keys locator CTRL+S
Xcode offers several key codes to open the Find (CMD-F) or Find and Replace (CMD-OPT-F) editor toolbar, but how can I get the Find Options to show without having to move my mouse over the magnifying glass and clicking (which takes forever, I misclick, and then have to select the menu item - ugh)?
I have not found a single key to do this, but just discovered that after using
CMD-F
or
CMD-OPT-F
that the Find search field has focus, and by tapping the
down arrow key
twice followed by a
Return key, that it opened (do again to close)!
I added a key code sequence to Butler so I can use a single key to do this, so use your favorite Macro program to do likewise.
EDIT: Just discovered this still works in Xcode 7, you just need to do 2 down-arrows followed by a return.
Users open files in our app through a QFileDialog. The order of the filenames is bizarre. What is determining the sorting order, and how can we make it sort by filenames, or otherwise impose our own sorting, perhaps giving it a pointer to our own comparison function?
The documentation and online forums haven't been helpful. Unless it's well hidden, there doesn't seem to be any sorting method, property, etc.
This is a primarily Linux app, but also runs on Macs. (I know nothing about Mac.)
Here is the juicy part of the source code:
QtFileDialog chooser(parent, caption, directory, filter);
/// QtFileDialog is our class derived from QFileDialog
chooser.setModal(true);
chooser.setAcceptMode(acceptMode);
chooser.setFileMode(fileMode);
QStringList hist = chooser.history();
chooser.setHistory(hist);
/* point "x" */
if(chooser.exec()) {
QStringList files = chooser.selectedFiles();
...blah blah blah...
From one of the answers, I tried an evil experiment, adding this ill-informed guesswork code at "point x":
QSortFilterProxyModel *sorter = new QSortFilterProxyModel();
sorter->sort(1); // ???
chooser.setProxyModel(sorter);
But this crashed spectacularly at a point about 33 subroutine calls deep from this level of code. I admit, even after reading the Qt4 documentation and sample code, I have no idea of the proper usage of QSortFilterProxyModel.
Are you using QFileDialog by calling exec()? If you are, you should have a button to switch the view to Detail View. This will give you some column headers that you can click on to sort the files. It should remember that mode the next time the dialog opens but you can force it by calling setViewMode(QFileDialog::Detail) before calling exec().
An alternative is to call the static function QFileDialog::getOpenFileName() which will open a file dialog that is native to the OS on which you are running. Your users may like the familiarity of this option better.
Update 1:
About sort order in screen cap from OP:
This screen capture is actually showing a sorted list. I don't know if the listing behaviour is originating from the Qt dialog or the underlying file system but I know Windows XP and later do it this way.
When sorting filenames with embedded numbers, any runs of consecutive digits are treated as a single number. With the more classic plain string sorting, files would be sorted like this:
A_A_10e0
A_A_9a05
Going character by character, the first 1 sorts before the 9.
.. But with numerical interpretation (as in Windows 7 at least), they are sorted as:
A_A_9a05
A_A_10e0
The 9 sorts before the 10.
So, the sorting you are seeing is alphabetical with numerical interpretation and not just straight character by character. Some deep digging may be required to see if that is Qt behaviour or OS behaviour and whether or not it can be configured.
Update 2:
The QSortFilterProxyModel will sort the strings alphabetically by default so there is not much work to using it to get the behavior you are looking for. Use the following code where you have "point x" in your example.. (you almost had it :)
QSortFilterProxyModel *sorter = new QSortFilterProxyModel();
sorter->setDynamicSortFilter(true); // This ensures the proxy will resort when the model changes
chooser.setProxyModel(sorter);
I think what you need to do is create a QSortFilterProxyModel which you then set in your QFileDialog with QFileDialog::setProxyModel(QAbstractProxyModel * proxyModel)
Here are some relevant links to the Qt 4.6 docs about it.
http://doc.trolltech.com/4.6/qfiledialog.html#setProxyModel
http://doc.trolltech.com/4.6/qsortfilterproxymodel.html#details
I don't think it depends upon the implementation of Qt libraries... But upon the Native OS implementation..
For example in Windows,
if you use QFileDialog, it will display the Files and Directories by Name sorted.. It is the same when used in other applications. In the sense that, if you try to open a file through MS- Word, it indeed displays the Files and directories as Name sorted by default..
And am not sure about other environments since am not used to them...
But in Windows, you can change the sorted order by right-click in the area of Files and Directories display and can select the options you like.. For e.g like Name,size,type, modified... And also which is similar, when you use an MS-Word application...
So, I believe it does depend on the Native OS implementation and not on QFileDialog's...