nodeguy/website/docs/api/generated/classes/qurl.md
swittk 3cb3424250
Added QMimeData, additional methods to QUrl, and Dropping should now be supported (#614)
* Added QWheelEvent

* removed x y

* Added QNativeGestureEvent

* Changed wrong type of QNativeGestureEventWrap value

* Added QTabletEvent

* Fixing build error for QTabletEvent

* adding dropaction

* fix typos

* Added more functions to QPainterPath

* Added more functions to QPainterPath

* Fixed multiple typos

* Fixed multiple typos

* Got QPainterPath additions working.

* Modified QPainterPath to use qreal instead

* Added QPointF, added a few missing methods to QPoint

* Added QRectF

* implemented QRectF

* Added acceptDrops and setAcceptDrops to QWidget, will be useful for addon implementation of Drag and Drop

* Added more methods to QUrl

* Added QMimeData, additional methods to QUrl, and Dropping should now be supported

* refactored

* Fixed more merge conflicts

* Is this my final merge conflict??

* All merge conflicts resolved

* All merge conflicts resolved

* Adds guide for drag and drop

* lint fix

Co-authored-by: Switt Kongdachalert <switt1995@yahoo.com>
Co-authored-by: Atul R <atulanand94@gmail.com>
2020-06-27 17:35:31 +02:00

18 KiB
Raw Blame History

id title sidebar_label
qurl QUrl QUrl

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new QUrl(): QUrl

Overrides Component.constructor

Returns: QUrl

+ new QUrl(nativeElement: NativeElement): QUrl

Overrides Component.constructor

Parameters:

Name Type
nativeElement NativeElement

Returns: QUrl

+ new QUrl(url: string, parsingMode?: ParsingMode): QUrl

Overrides Component.constructor

Parameters:

Name Type
url string
parsingMode? ParsingMode

Returns: QUrl

Properties

Readonly ComponentFormattingOption

ComponentFormattingOption: ComponentFormattingOption = ComponentFormattingOption


Readonly ParsingMode

ParsingMode: ParsingMode = ParsingMode


Readonly UrlFormattingOption

UrlFormattingOption: UrlFormattingOption = UrlFormattingOption


Readonly UserInputResolutionOption

UserInputResolutionOption: UserInputResolutionOption = UserInputResolutionOption


native

native: NativeElement

Overrides Component.native


nodeChildren

nodeChildren: SetComponent

Inherited from Component.nodeChildren


Optional nodeParent

nodeParent? : Component

Inherited from Component.nodeParent


Static Readonly ComponentFormattingOption

ComponentFormattingOption: ComponentFormattingOption = ComponentFormattingOption


Static Readonly ParsingMode

ParsingMode: ParsingMode = ParsingMode


Static Readonly UrlFormattingOption

UrlFormattingOption: UrlFormattingOption = UrlFormattingOption


Static Readonly UserInputResolutionOption

UserInputResolutionOption: UserInputResolutionOption = UserInputResolutionOption

Methods

adjusted

adjusted(options: number): QUrl

Returns an adjusted version of the URL. The output can be customized by passing flags with options.

Parameters:

Name Type
options number

Returns: QUrl


authority

authority(options: number): string

Returns the authority of the URL if it is defined; otherwise an empty string is returned.

Parameters:

Name Type Default
options number ComponentFormattingOption.PrettyDecoded

Returns: string


clear

clear(): void

Resets the content of the QUrl. After calling this function, the QUrl is equal to one that has been constructed with the default empty constructor.

Returns: void


errorString

errorString(): string

Returns an error message if the last operation that modified this QUrl object ran into a parsing error. If no error was detected, this function returns an empty string and isValid() returns true.

Returns: string


fileName

fileName(options: number): string

Returns the name of the file, excluding the directory path.

Parameters:

Name Type Default
options number ComponentFormattingOption.FullyDecoded

Returns: string


fragment

fragment(options: number): string

Returns the fragment of the URL. To determine if the parsed URL contained a fragment, use hasFragment().

Parameters:

Name Type Default
options number ComponentFormattingOption.PrettyDecoded

Returns: string


hasFragment

hasFragment(): boolean

Returns true if this URL contains a fragment (i.e., if # was seen on it).

Returns: boolean


hasQuery

hasQuery(): boolean

Returns true if this URL contains a Query (i.e., if ? was seen on it).

Returns: boolean


host

host(options: number): string

Returns the host of the URL if it is defined; otherwise an empty string is returned.

Parameters:

Name Type Default
options number ComponentFormattingOption.FullyDecoded

Returns: string


isEmpty

isEmpty(): boolean

Returns true if the URL has no data; otherwise returns false.

Returns: boolean


isLocalFile

isLocalFile(): boolean

Returns true if this URL is pointing to a local file path. A URL is a local file path if the scheme is "file".

Returns: boolean


isParentOf

isParentOf(childUrl: QUrl): boolean

Returns true if this URL is a parent of childUrl. childUrl is a child of this URL if the two URLs share the same scheme and authority, and this URL's path is a parent of the path of childUrl.

Parameters:

Name Type
childUrl QUrl

Returns: boolean


isRelative

isRelative(): boolean

Returns true if the URL is relative; otherwise returns false. A URL is relative reference if its scheme is undefined; this function is therefore equivalent to calling scheme().isEmpty().

Returns: boolean


isValid

isValid(): boolean

Returns true if the URL is non-empty and valid; otherwise returns false.

Returns: boolean


matches

matches(url: QUrl, options: number): boolean

Returns true if this URL and the given url are equal after applying options to both; otherwise returns false.

Parameters:

Name Type
url QUrl
options number

Returns: boolean


password

password(options: number): string

Returns the password of the URL if it is defined; otherwise an empty string is returned.

Parameters:

Name Type Default
options number ComponentFormattingOption.FullyDecoded

Returns: string


path

path(options: number): string

Returns the path of the URL.

Parameters:

Name Type Default
options number ComponentFormattingOption.FullyDecoded

Returns: string


port

port(defaultPort: number): number

Returns the port of the URL, or defaultPort if the port is unspecified.

Parameters:

Name Type Default
defaultPort number -1

Returns: number


query

query(options: number): string

Returns the query string of the URL if there's a query string, or an empty result if not. To determine if the parsed URL contained a query string, use hasQuery().

Parameters:

Name Type Default
options number ComponentFormattingOption.PrettyDecoded

Returns: string


resolved

resolved(relative: QUrl): QUrl

Returns the result of the merge of this URL with relative. This URL is used as a base to convert relative to an absolute URL.

Parameters:

Name Type
relative QUrl

Returns: QUrl


scheme

scheme(): string

Returns the scheme of the URL. If an empty string is returned, this means the scheme is undefined and the URL is then relative.

Returns: string


setAuthority

setAuthority(authority: string, mode: ParsingMode): void

Sets the authority of the URL to authority.

Parameters:

Name Type Default
authority string -
mode ParsingMode ParsingMode.TolerantMode

Returns: void


setFragment

setFragment(fragment: string, mode: ParsingMode): void

Sets the fragment of the URL to fragment. The fragment is the last part of the URL, represented by a '#' followed by a string of characters. It is typically used in HTTP for referring to a certain link or point on a page:

Parameters:

Name Type Default
fragment string -
mode ParsingMode ParsingMode.TolerantMode

Returns: void


setHost

setHost(host: string, mode: ParsingMode): void

Sets the host of the URL to host. The host is part of the authority.

Parameters:

Name Type Default
host string -
mode ParsingMode ParsingMode.DecodedMode

Returns: void


setNodeParent

setNodeParent(parent?: Component): void

Inherited from Component.setNodeParent

Parameters:

Name Type
parent? Component

Returns: void


setPassword

setPassword(password: string, mode: ParsingMode): void

Sets the URL's password to password. The password is part of the user info element in the authority of the URL, as described in setUserInfo().

Parameters:

Name Type Default
password string -
mode ParsingMode ParsingMode.DecodedMode

Returns: void


setPath

setPath(path: string, mode: ParsingMode): void

Sets the path of the URL to path. The path is the part of the URL that comes after the authority but before the query string.

Parameters:

Name Type Default
path string -
mode ParsingMode ParsingMode.DecodedMode

Returns: void


setPort

setPort(port: number): void

Sets the port of the URL to port. The port is part of the authority of the URL, as described in setAuthority().

Parameters:

Name Type
port number

Returns: void


setQuery

setQuery(query: string, mode: ParsingMode): void

Sets the query string of the URL to query.

Parameters:

Name Type Default
query string -
mode ParsingMode ParsingMode.TolerantMode

Returns: void


setScheme

setScheme(scheme: string): void

Sets the scheme of the URL to scheme. As a scheme can only contain ASCII characters, no conversion or decoding is done on the input. It must also start with an ASCII letter.

Parameters:

Name Type
scheme string

Returns: void


setUrl

setUrl(url: string, parsingMode: ParsingMode): void

Parses url and sets this object to that value. QUrl will automatically percent encode all characters that are not allowed in a URL and decode the percent-encoded sequences that represent an unreserved character (letters, digits, hyphens, undercores, dots and tildes). All other characters are left in their original forms.

Parameters:

Name Type Default
url string -
parsingMode ParsingMode ParsingMode.TolerantMode

Returns: void


setUserInfo

setUserInfo(userInfo: string, mode: ParsingMode): void

Sets the user info of the URL to userInfo. The user info is an optional part of the authority of the URL, as described in setAuthority().

Parameters:

Name Type Default
userInfo string -
mode ParsingMode ParsingMode.TolerantMode

Returns: void


setUserName

setUserName(userName: string, mode: ParsingMode): void

Sets the URL's user name to userName. The userName is part of the user info element in the authority of the URL, as described in setUserInfo().

Parameters:

Name Type Default
userName string -
mode ParsingMode ParsingMode.DecodedMode

Returns: void


swap

swap(other: QUrl): void

Swaps URL other with this URL. This operation is very fast and never fails.

Parameters:

Name Type
other QUrl

Returns: void


toDisplayString

toDisplayString(options: number): string

Returns a human-displayable string representation of the URL. The output can be customized by passing flags with options. The option RemovePassword is always enabled, since passwords should never be shown back to users.

Parameters:

Name Type Default
options number ComponentFormattingOption.PrettyDecoded

Returns: string


toLocalFile

toLocalFile(): string

Returns the path of this URL formatted as a local file path. The path returned will use forward slashes, even if it was originally created from one with backslashes.

Returns: string


toString

toString(options?: undefined | number): string

Returns a string representation of the URL. The output can be customized by passing flags with options. The option QUrl::FullyDecoded is not permitted in this function since it would generate ambiguous data.

See QUrl::ComponentFormattingOption for flags

Parameters:

Name Type
options? undefined | number

Returns: string


url

url(options: number): string

Returns a string representation of the URL. The output can be customized by passing flags with options. The option QUrl::FullyDecoded is not permitted in this function since it would generate ambiguous data.

Parameters:

Name Type
options number

Returns: string


userInfo

userInfo(options: number): string

Returns the user info of the URL, or an empty string if the user info is undefined.

Parameters:

Name Type Default
options number ComponentFormattingOption.PrettyDecoded

Returns: string


userName

userName(options: number): string

Returns the user name of the URL if it is defined; otherwise an empty string is returned.

Parameters:

Name Type Default
options number ComponentFormattingOption.FullyDecoded

Returns: string


Static fromLocalFile

fromLocalFile(localFile: string): QUrl

Returns a QUrl representation of localFile, interpreted as a local file. This function accepts paths separated by slashes as well as the native separator for this platform.

Parameters:

Name Type
localFile string

Returns: QUrl


Static fromQVariant

fromQVariant(variant: QVariant): QUrl

Parameters:

Name Type
variant QVariant

Returns: QUrl


Static fromUserInput

fromUserInput(userInput: string, workingDirectory?: undefined | string, options: number): QUrl

Returns a valid URL from a user supplied userInput string if one can be deduced. In the case that is not possible, an invalid QUrl() is returned.

Parameters:

Name Type Default
userInput string -
workingDirectory? undefined | string -
options number UserInputResolutionOption.DefaultResolution

Returns: QUrl