Development/Tutorials/Plasma4/JavaScript/API-Misc: Difference between revisions
Neverendingo (talk | contribs) m (Text replace - "<code javascript>" to "<syntaxhighlight lang="javascript">") |
m (D ed moved page Development/Tutorials/Plasma/JavaScript/API-Misc to Development/Tutorials/Plasma4/JavaScript/API-Misc) |
||
(One intermediate revision by one other user not shown) | |||
Line 2: | Line 2: | ||
Represents a local or remote address. To create a new Url (or assign to an existing one), use the following syntax: | Represents a local or remote address. To create a new Url (or assign to an existing one), use the following syntax: | ||
<syntaxhighlight lang="javascript">var url = new Url("http://kde.org")</ | <syntaxhighlight lang="javascript">var url = new Url("http://kde.org")</syntaxhighlight> | ||
Read-only properties: | Read-only properties: |
Latest revision as of 23:27, 11 September 2014
Url
Represents a local or remote address. To create a new Url (or assign to an existing one), use the following syntax:
var url = new Url("http://kde.org")
Read-only properties:
- string toString: the URL as a String object
Read-write properties (each representing a portion of the full URL):
- string protocol
- string host
- string path
- string user
- string password
ByteArray
This class provides an array of bytes. This is often used by data centric objects, such as the Job classes returned by getUrl.
Read-only properties:
- number length: the size of the array (number of bytes)
Functions:
- chop(number numBytes): chops numBytes from the end of the array
- bool equals(ByteArray other)
- ByteArray left(number len): return len bytes from the left of the array
- ByteArray mid(number pos, number len): returns an array of bytes starting a post and length len (if len is -1, it returns all remaining bytes)
- ByteArray remove(number pos, number len): removes len bytes starting at index pos from the array and returns it
- ByteArray right(number len): returns len bytes from the right of the array
- ByteArray simplified(): returns a byte array that has whitespace removed from the start and the end, and which has each sequence of internal whitespace replaced with a single space
- ByteArray toBase64(): returns the array encoded in base64
- ByteArray toLower(): returns a lowercased copy of the array
- ByteArray toUpper(): returns an uppercased copy of the array
- ByteArray trimmed(): returns a copy of the array with whitespace remove from the start and end
- truncate(number pos): truncates the array at index pos
- String toLatin1String(): returns a Latin1-ized string based on the array
- String toUtf8(): (API v3) returns a string from the contents of the array using a Utf8 conversation
- String valueOf(): returns the raw data in the array as a string
GraphicsItem
This class represents an item on the canvas. Support is only provided so that GraphicsItem objects returned or taken by other objects work. There is no meaningful API provided directly in the JavaScript runtime for these objects and they should not need to be used directly.
QSizePolicy
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy. This can be set on any graphics widget that you have using the enums provided for this (QtSizePolicy ), for example:
button = new PushButton(); button.sizePolicy = QSizePolicy(QSizePolicyMaximum, QSizePolicyFixed);
This is useful when your widgets are being laid out by a layout (specially the anchor layout).
- QtSizePolicy horizontalPolicy: The horizontal component of the size policy.
- QtSizePolicy verticalPolicy: The vertical component of the size policy.
- number horizontalStretch: The horizontal stretch factor of the size policy.
- number verticalStretch: The vertical stretch factor of the size policy.