API reference - Class BrowserPanel

Notation used in Ruby API documentation

Module: lay

Description: A HTML display and browser widget

Class hierarchy: BrowserPanel » QWidget » QObject

This widget provides the functionality of BrowserDialog within a widget. It can be embedded into other dialogs. For details about the use model of this class see BrowserDialog.

This class has been introduced in version 0.25.

Public constructors

new BrowserPanel ptrnew(QWidget ptr parent,
BrowserSource ptr source)
Creates a HTML browser widget with a BrowserSource as the source of HTML code
new BrowserPanel ptrnew(QWidget ptr parent)Creates a HTML browser widget

Public methods

void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
voidhome=(string home_url)Sets the browser widget's initial and current URL which is selected if the "home" location is chosen
voidlabel=(string label)Sets the label text
voidload(string url)Loads the given URL into the browser widget
voidreloadReloads the current page
voidsearch(string search_item)Issues a search request using the given search item and the search URL specified with set_search_url
voidset_search_url(string url,
string query_item)
Enables the search field and specifies the search URL generated for a search
voidsource=(BrowserSource ptr source)Connects to a source object
[const]stringurlGets the URL currently shown

Detailed description

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

home=

Signature: void home= (string home_url)

Description: Sets the browser widget's initial and current URL which is selected if the "home" location is chosen

The home URL is the one shown initially and the one which is selected when the "home" button is pressed. The default location is "int:/index.html".

Python specific notes:
The object exposes a writable attribute 'home'. This is the setter.

label=

Signature: void label= (string label)

Description: Sets the label text

The label is shown left of the navigation buttons. By default, no label is specified.

Python specific notes:
The object exposes a writable attribute 'label'. This is the setter.

load

Signature: void load (string url)

Description: Loads the given URL into the browser widget

Typically the URL has the "int:" scheme so the HTML code is taken from the BrowserSource object.

new

(1) Signature: [static] new BrowserPanel ptr new (QWidget ptr parent, BrowserSource ptr source)

Description: Creates a HTML browser widget with a BrowserSource as the source of HTML code

Python specific notes:
This method is the default initializer of the object.

(2) Signature: [static] new BrowserPanel ptr new (QWidget ptr parent)

Description: Creates a HTML browser widget

Python specific notes:
This method is the default initializer of the object.

reload

Signature: void reload

Description: Reloads the current page

search

Signature: void search (string search_item)

Description: Issues a search request using the given search item and the search URL specified with set_search_url

See search_url= for a description of the search mechanism.

set_search_url

Signature: void set_search_url (string url, string query_item)

Description: Enables the search field and specifies the search URL generated for a search

If a search URL is set, the search box right to the navigation bar will be enabled. When a text is entered into the search box, the browser will navigate to an URL composed of the search URL, the search item and the search text, i.e. "myurl?item=search_text".

source=

Signature: void source= (BrowserSource ptr source)

Description: Connects to a source object

Setting the source should be the first thing done after the BrowserDialog object is created. It will not have any effect after the browser has loaded the first page. In particular, home= should be called after the source was set.

Python specific notes:
The object exposes a writable attribute 'source'. This is the setter.

url

Signature: [const] string url

Description: Gets the URL currently shown