LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::SelectableBrowser Class Reference

A "browser" that shows HTML either via QTextBrowser or a browser plugin. More...

#include "selectablebrowser.h"

+ Inheritance diagram for LC::Util::SelectableBrowser:
+ Collaboration diagram for LC::Util::SelectableBrowser:

Public Member Functions

 SelectableBrowser (QWidget *parent=nullptr)
 Constructs the browser with the given parent. More...
 
void Construct (IWebBrowser *browser)
 Initialize the widget with the browser plugin. More...
 
void SetHtml (const QString &html, const QUrl &base=QUrl())
 Sets the HTML content to display. More...
 
void SetNavBarVisible (bool visible)
 Sets whether navigation bar should be visible. More...
 
void SetEverythingElseVisible (bool visible)
 Sets whether other UI elements should be visible. More...
 

Detailed Description

A "browser" that shows HTML either via QTextBrowser or a browser plugin.

This class is used to display HTML content via some web browser plugin (like Poshuku) and, if such plugins aren't available, downgrade to QTextBrowser.

Currently using this class is generally discouraged. QtWebKit isn't as new and uncommon as it was a couple of years ago, so in most cases it's easier to just embed a QWebView.

Definition at line 38 of file selectablebrowser.h.

Constructor & Destructor Documentation

◆ SelectableBrowser()

LC::Util::SelectableBrowser::SelectableBrowser ( QWidget *  parent = nullptr)
explicit

Constructs the browser with the given parent.

By default, if no other functions are called, this browser widget will use QTextBrowser to display content. Call Construct() and pass a pointer to a web browser plugin to use it.

Parameters
[in]parentThe parent widget.
See also
Construct()

Definition at line 20 of file selectablebrowser.cpp.

Member Function Documentation

◆ Construct()

void LC::Util::SelectableBrowser::Construct ( IWebBrowser browser)

Initialize the widget with the browser plugin.

After calling this function the widget will use the browser plugin to show HTML content.

If the browser is nullptr, this function does nothing and the widget still uses the QTextBrowser.

Any HTML content currently set will be cleared after calling this function.

Parameters
[in]browserThe browser to use.

Definition at line 31 of file selectablebrowser.cpp.

◆ SetEverythingElseVisible()

void LC::Util::SelectableBrowser::SetEverythingElseVisible ( bool  visible)

Sets whether other UI elements should be visible.

Sometimes it's not desirable to show, for example, browser history or bookmarks panes. Use this function to hide them.

The default state is unspecified.

Parameters
[in]visibleWhether irrelevant UI elements should be visible.

Definition at line 61 of file selectablebrowser.cpp.

◆ SetHtml()

void LC::Util::SelectableBrowser::SetHtml ( const QString &  html,
const QUrl &  base = QUrl () 
)

Sets the HTML content to display.

Parameters
[in]htmlThe HTML content to display.
[in]baseThe base URL which is used to resolve relative URLs found in the HTML content.

Definition at line 47 of file selectablebrowser.cpp.

◆ SetNavBarVisible()

void LC::Util::SelectableBrowser::SetNavBarVisible ( bool  visible)

Sets whether navigation bar should be visible.

The navigation bar typically includes the address edit button with back/forward/reload buttons. Some plugins may find it undesirable.

The default state is unspecified.

Parameters
[in]visibleWhether navigation bar should be visible.

Definition at line 55 of file selectablebrowser.cpp.


The documentation for this class was generated from the following files: