CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Slots | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Properties | List of all members
ctkFittedTextBrowser Class Reference

#include <Libs/Widgets/ctkFittedTextBrowser.h>

Inheritance diagram for ctkFittedTextBrowser:
Inheritance graph
[legend]
Collaboration diagram for ctkFittedTextBrowser:
Collaboration graph
[legend]

Public Slots

void setCollapsibleHtml (const QString &text)
 
void setCollapsiblePlainText (const QString &text)
 
void setCollapsibleText (const QString &text)
 

Public Member Functions

bool collapsed () const
 Show only first line/the full text. More...
 
Q_INVOKABLE QString collapsibleText () const
 Return text set by setCollapsibleText. More...
 
 ctkFittedTextBrowser (QWidget *parent=0)
 
virtual int heightForWidth (int width) const
 Reimplemented for internal reasons. More...
 
QString hideDetailsText () const
 Text that is displayed at the end of non-collapsed text. More...
 
virtual QSize minimumSizeHint () const
 Reimplemented for internal reasons. More...
 
void setCollapsed (bool collapsed)
 
void setHideDetailsText (const QString &text)
 
void setShowDetailsText (const QString &text)
 
QString showDetailsText () const
 Text that is displayed at the end of collapsed text. More...
 
virtual QSize sizeHint () const
 Reimplemented for internal reasons. More...
 
virtual ~ctkFittedTextBrowser ()
 

Protected Slots

void anchorClicked (const QUrl &url)
 
void heightForWidthMayHaveChanged ()
 

Protected Member Functions

virtual void resizeEvent (QResizeEvent *e)
 

Protected Attributes

QScopedPointer< ctkFittedTextBrowserPrivate > d_ptr
 

Properties

bool collapsed
 
QString hideDetailsText
 
QString showDetailsText
 

Detailed Description

ctkFittedTextBrowser is a QTextBrowser that adapts its height depending on its contents and the width available. It always tries to show the whole contents. ctkFittedTextBrowser doesn't resize itself but acts on the sizeHint, minimumSizeHint and heightForWidth. Here sizeHint() and minimumSizeHint() are the same as ctkFittedTextBrowser always try to show the whole contents.

The widget can further optimize use of available space by collapsing text. If the option is enabled then only a short teaser is shown and the user has to click on "More..." to see the full text.

Definition at line 42 of file ctkFittedTextBrowser.h.

Constructor & Destructor Documentation

◆ ctkFittedTextBrowser()

ctkFittedTextBrowser::ctkFittedTextBrowser ( QWidget *  parent = 0)

◆ ~ctkFittedTextBrowser()

virtual ctkFittedTextBrowser::~ctkFittedTextBrowser ( )
virtual

Member Function Documentation

◆ anchorClicked

void ctkFittedTextBrowser::anchorClicked ( const QUrl &  url)
protectedslot

◆ collapsed()

bool ctkFittedTextBrowser::collapsed ( ) const

Show only first line/the full text.

◆ collapsibleText()

Q_INVOKABLE QString ctkFittedTextBrowser::collapsibleText ( ) const

Return text set by setCollapsibleText.

◆ heightForWidth()

virtual int ctkFittedTextBrowser::heightForWidth ( int  width) const
virtual

Reimplemented for internal reasons.

◆ heightForWidthMayHaveChanged

void ctkFittedTextBrowser::heightForWidthMayHaveChanged ( )
protectedslot

◆ hideDetailsText()

QString ctkFittedTextBrowser::hideDetailsText ( ) const

Text that is displayed at the end of non-collapsed text.

◆ minimumSizeHint()

virtual QSize ctkFittedTextBrowser::minimumSizeHint ( ) const
virtual

Reimplemented for internal reasons.

◆ resizeEvent()

virtual void ctkFittedTextBrowser::resizeEvent ( QResizeEvent *  e)
protectedvirtual

◆ setCollapsed()

void ctkFittedTextBrowser::setCollapsed ( bool  collapsed)

Show only first line/the full text. Only has effect if collapsible = true.

◆ setCollapsibleHtml

void ctkFittedTextBrowser::setCollapsibleHtml ( const QString &  text)
slot

Set text that can be displayed in a shortened form (collapsed) for saving space.

See also
setCollapsibleText

◆ setCollapsiblePlainText

void ctkFittedTextBrowser::setCollapsiblePlainText ( const QString &  text)
slot

Set text that can be displayed in a shortened form (collapsed) for saving space.

See also
setCollapsibleText

◆ setCollapsibleText

void ctkFittedTextBrowser::setCollapsibleText ( const QString &  text)
slot

Set text that can be displayed in a shortened form (collapsed) for saving space, by only showing first line with "More..." link appended. When the user clicks on the link then the full text is displayed (and a "Less..." link). The teaser is the beginning of the text up to the first newline character (for plain text) or
tag (for html). The separator is removed when the text is expanded so that the full text can continue on the same line as the teaser.

The text can be plain text or HTML and the the right format will be guessed. Use setCollapsedHtml() or setCollapsedPlainText() directly to avoid guessing.

◆ setHideDetailsText()

void ctkFittedTextBrowser::setHideDetailsText ( const QString &  text)

Text that is displayed at the end of non-collapsed text. Clicking on the text collapses the widget.

◆ setShowDetailsText()

void ctkFittedTextBrowser::setShowDetailsText ( const QString &  text)

Text that is displayed at the end of collapsed text. Clicking on the text expands the widget.

◆ showDetailsText()

QString ctkFittedTextBrowser::showDetailsText ( ) const

Text that is displayed at the end of collapsed text.

◆ sizeHint()

virtual QSize ctkFittedTextBrowser::sizeHint ( ) const
virtual

Reimplemented for internal reasons.

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkFittedTextBrowserPrivate> ctkFittedTextBrowser::d_ptr
protected

Definition at line 112 of file ctkFittedTextBrowser.h.

Property Documentation

◆ collapsed

bool ctkFittedTextBrowser::collapsed
readwrite

Definition at line 1 of file ctkFittedTextBrowser.h.

◆ hideDetailsText

QString ctkFittedTextBrowser::hideDetailsText
readwrite

Definition at line 1 of file ctkFittedTextBrowser.h.

◆ showDetailsText

QString ctkFittedTextBrowser::showDetailsText
readwrite

Definition at line 1 of file ctkFittedTextBrowser.h.


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