Squish/Using Ctrl+A: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
(Move [[Category::Tools::Squish]] -> [[Category::Squish]])
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Tools::Squish]]
[[Category:Squish]]


= Using Ctrl+A =
= Using Ctrl+A =
Line 5: Line 5:
The Ctrl+A keyboard shortcut is often the most effective way to select everything in a widget to perform some operation, be it to select everything in a list view to perform an operation or to select everything in a text box to type a replacement. In general, keyboard shortcuts can be an expedient way to test functionality. Here are a couple of examples for Ctrl+A:
The Ctrl+A keyboard shortcut is often the most effective way to select everything in a widget to perform some operation, be it to select everything in a list view to perform an operation or to select everything in a text box to type a replacement. In general, keyboard shortcuts can be an expedient way to test functionality. Here are a couple of examples for Ctrl+A:


== Setting a Text Box value<br /><code>#Incredibly straightforward, will work on anything with a text area that accepts standard keyboard shortcuts<br />def setTextBoxValue(boxName, value):<br /> type(waitForObject(boxName), "<Ctrl+A>")<br /> type(waitForObject(boxName), "value")</code> ==
== Setting a Text Box value
<code>#Incredibly straightforward, will work on anything with a text area that accepts standard keyboard shortcuts
def setTextBoxValue(boxName, value):
type(waitForObject(boxName), "<Ctrl+A>")
type(waitForObject(boxName), "value")</code> ==


== Selecting All Items in a List<br /><code>#Works with most QAbstractItemView types e.g. QListView<br />def selectAll(viewName):<br /> #select the first item<br /> model = waitForObject(viewName).view.model()<br /> clickItem(viewName, model.data(model.index(0,0))) ==
== Selecting All Items in a List
<code>#Works with most QAbstractItemView types e.g. QListView
def selectAll(viewName):
#select the first item
model = waitForObject(viewName).view.model()
clickItem(viewName, model.data(model.index(0,0))) ==

Latest revision as of 08:46, 25 November 2017


Using Ctrl+A

The Ctrl+A keyboard shortcut is often the most effective way to select everything in a widget to perform some operation, be it to select everything in a list view to perform an operation or to select everything in a text box to type a replacement. In general, keyboard shortcuts can be an expedient way to test functionality. Here are a couple of examples for Ctrl+A:

== Setting a Text Box value

#Incredibly straightforward, will work on anything with a text area that accepts standard keyboard shortcuts
def setTextBoxValue(boxName, value):
 type(waitForObject(boxName), "<Ctrl+A>")
 type(waitForObject(boxName), "value")

==

== Selecting All Items in a List #Works with most QAbstractItemView types e.g. QListView def selectAll(viewName):

#select the first item
model = waitForObject(viewName).view.model()
clickItem(viewName, model.data(model.index(0,0))) ==