API reference - Class BrowserDialogNotation used in Ruby API documentation Description: A HTML display and browser dialog Class hierarchy: BrowserDialog » QDialog » QWidget » QObject
The browser dialog displays HTML code in a browser panel. The HTML code is delivered through a separate object of class BrowserSource which acts as a "server" for a specific kind of URL scheme. Whenever the browser sees a URL starting with "int:" it will ask the connected BrowserSource object for the HTML code of that page using it's 'get' method. The task of the BrowserSource object is to format the data requested in HTML and deliver it. One use case for that class is the implementation of rich data browsers for structured information. In a simple scenario, the browser dialog can be instantiated with a static HTML page. In that case, only the content of that page is shown. Here's a simple example: html = "<html><body>Hello, world!</body></html>" RBA::BrowserDialog::new(html).exec And that is an example for the use case with a BrowserSource as the "server": class MySource < RBA::BrowserSource def get(url) if (url =~ /b.html$/) return "<html><body>The second page</body></html>" else return "<html><body>The first page with a <a href='int:b.html'>link</a></body></html>" end end end source = MySource::new RBA::BrowserDialog::new(source).exec Public constructors
Public methods
Deprecated methods (protected, public, static, non-static and constructors)
Detailed descriptionvoid caption=(string caption)Description: Set the caption of the window [virtual] void closedDescription: Callback when the dialog is closed This method is deprecated. void createDescription: 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. void destroyDescription: Explicitly destroy the object Explicitly destroy the object on C++ side if it was owned by the Ruby interpreter. Subsequent access to this object will throw an exception. If the object is not owned by Ruby, this method will do nothing. [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. int execDescription: Execute the HTML browser dialog as a modal window void hideDescription: Hide the HTML browser window void home=(string home_url)Description: Set the browser's initial and current URL which is selected if the "home" location is choosen 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". [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. void label=(string label)Description: Sets the label text The label is shown left of the navigation buttons. By default, no label is specified. This method has been introduced in version 0.23. void load(string url)Description: Load the given URL into the browser dialog Typically the URL has the "int:" scheme so the HTML code is taken from the BrowserSource object. [static] new BrowserDialog new(BrowserSource ptr source)Description: Create a HTML browser window with a BrowserSource as the source of HTML code This method has been introduced in version 0.23. [static] new BrowserDialog new(string html)Description: Create a HTML browser window with a static HTML content This method has been introduced in version 0.23. void reloadDescription: Reload the current page void resize(int width,int height)Description: Set the size of the dialog window 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 set_search_url for a description of the search mechanism. void set_caption(string caption)Description: Set the caption of the window This method is deprecated. Use method 'caption=' instead void set_home(string home_url)Description: Set the browser's initial and current URL which is selected if the "home" location is choosen This method is deprecated. Use method 'home=' instead 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". This method has been introduced in version 0.23. void set_size(int width,int height)Description: Set the size of the dialog window This method is deprecated. Use method 'resize' instead void set_source(BrowserSource ptr source)Description: Connect to a source object This method is deprecated. Use method 'source=' instead void showDescription: Show the HTML browser window in a non-modal way void source=(BrowserSource ptr source)Description: Connect 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. |