[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Public Types | Public Slots | Signals | Public Member Functions | Properties | List of all members
KLFSideWidget Class Reference

A widget that can be shown or hidden, that expands a main widget, e.g. klatexformula expanded mode. More...

#include <klfsidewidget.h>

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

Public Types

enum  SideWidgetManager { ShowHide = 1, Float, Drawer }
 

Public Slots

void showSideWidget (bool show=true)
 show or hide the side widget. More...
 
void hideSideWidget (bool hide=true)
 hide or show the side widget. More...
 
void toggleSideWidget ()
 toggles the show/hide state of this side widget. More...
 
void setSideWidgetManager (SideWidgetManager mtype)
 
void setSideWidgetManager (const QString &mtype)
 
void debug_unlock_qtdesigner ()
 

Signals

void sideWidgetShown (bool shown)
 emitted whenever this side widget is shown or hidden More...
 
void sideWidgetManagerTypeChanged (const QString &managerType)
 emitted whenver the manager associated to this side widget has changed. More...
 

Public Member Functions

 KLFSideWidget (QWidget *parent=NULL)
 
virtual ~KLFSideWidget ()
 
bool sideWidgetVisible () const
 returns TRUE if this side widget is currently visible More...
 
QString sideWidgetManagerType () const
 returns the current side widget manager type More...
 
KLFSideWidgetManagerBasesideWidgetManager ()
 returns the instance of the side widget manager used for this side widget More...
 

Properties

QString sideWidgetManagerType
 

Detailed Description

A widget that can be shown or hidden, that expands a main widget, e.g. klatexformula expanded mode.

This container may be used to provide a widget that can be shown or hidden. This container makes transparent the way this widget will be shown or hidden; for example it could be implemented as a Mac OS X drawer, as a floating tool window, or shown alongside the main widget.

A side widget manager (subclass of KLFSideWidgetManagerBase) is responsible for actually implementing the show/hide process. This includes instantiating a new floating widget/making it a drawer/reparenting that and this widget etc. if needed. You may also implement your own KLFSideWidgetManagerBase, and write a factory for it. See KLFSideWidgetManagerBase.

A KLFSideWidget has to be associated with a "Main Widget", which is our given by our parent widget at the moment a side widget manager is set. In fact, it should be instantiated as a child of your "main widget", possibly in a layout (especially for show/hide manager).

A KLFSideWidget may also be created in Qt designer, inside the main widget UI.

Minimal example:

QWidget *mainWidget = ...;
Q[Something]Layout *mainLayout = ...;
KLFSideWidget * sideWidget = new KLFSideWidget(mainWidget);
mainLayout->addWidget(sideWidget);
// or
sideWidget->setSideWidgetManager("Float");
// use eg. sideWidget->showSideWidget(bool) to show/hide the side widget.

Definition at line 373 of file klfsidewidget.h.

Member Enumeration Documentation

◆ SideWidgetManager

Enumerator
ShowHide 
Float 
Drawer 

Definition at line 379 of file klfsidewidget.h.

Constructor & Destructor Documentation

◆ KLFSideWidget()

KLFSideWidget::KLFSideWidget ( QWidget *  parent = NULL)

Definition at line 784 of file klfsidewidget.cpp.

References KLF_INIT_PRIVATE.

◆ ~KLFSideWidget()

KLFSideWidget::~KLFSideWidget ( )
virtual

Definition at line 792 of file klfsidewidget.cpp.

References KLF_DEBUG_BLOCK, KLF_DELETE_PRIVATE, and KLF_FUNC_NAME.

Member Function Documentation

◆ debug_unlock_qtdesigner

void KLFSideWidget::debug_unlock_qtdesigner ( )
slot

Useful to debug the behavior of show/hide in Qt Designer preview. Just connect anything to this slot to enable full show/hide functionality of this widget. (Normally, in Qt Designer, no show/hide process is taking place, to avoid unadvertently hiding the widget for good!)

Definition at line 876 of file klfsidewidget.cpp.

References setSideWidgetManager(), and sideWidgetManagerType().

◆ hideSideWidget

void KLFSideWidget::hideSideWidget ( bool  hide = true)
inlineslot

hide or show the side widget.

Exactly the same as showSideWidget(!hide). May be useful for signals/slots.

Definition at line 431 of file klfsidewidget.h.

◆ setSideWidgetManager [1/2]

void KLFSideWidget::setSideWidgetManager ( SideWidgetManager  mtype)
slot

Instantiate a new side widget manager of the given type and associate it to this widget.

Definition at line 818 of file klfsidewidget.cpp.

References Drawer, Float, QString::isEmpty(), KLF_ASSERT_CONDITION, and ShowHide.

Referenced by debug_unlock_qtdesigner(), and showSideWidget().

◆ setSideWidgetManager [2/2]

void KLFSideWidget::setSideWidgetManager ( const QString mtype)
slot

Instantiate a new side widget manager of the given type and associate it to this widget. This function allows for customized side widget managers, for which you have registered a factory. See KLFSideWidgetManagerBase.

Definition at line 831 of file klfsidewidget.cpp.

References KLFSideWidgetManagerFactory::findCreateSideWidgetManager(), KLF_ASSERT_NOT_NULL, KLF_DEBUG_BLOCK, KLF_FUNC_NAME, klfDbg, sideWidgetManagerTypeChanged(), and sideWidgetShown().

◆ showSideWidget

void KLFSideWidget::showSideWidget ( bool  show = true)
slot

show or hide the side widget.

If TRUE (resp. FALSE), then shows (resp. hides) the side widget using the current side widget manager.

If no side widget manager was set, a warning is issued and a "Float" side widget manager is created.

Definition at line 865 of file klfsidewidget.cpp.

References Float, KLF_ASSERT_NOT_NULL, and setSideWidgetManager().

◆ sideWidgetManager()

KLFSideWidgetManagerBase * KLFSideWidget::sideWidgetManager ( )

returns the instance of the side widget manager used for this side widget

See KLFSideWidgetManagerBase.

Definition at line 801 of file klfsidewidget.cpp.

◆ sideWidgetManagerType()

QString KLFSideWidget::sideWidgetManagerType ( ) const

returns the current side widget manager type

Returns the type of side widget manager used here. This is the key used in the KLFSideWidgetManagerBase factory. Standard keys are "ShowHide", "Float", and "Drawer" (Mac only). But you may create your own.

See also KLFSideWidgetManagerBase.

Referenced by debug_unlock_qtdesigner(), and sideWidgetVisible().

◆ sideWidgetManagerTypeChanged

void KLFSideWidget::sideWidgetManagerTypeChanged ( const QString managerType)
signal

emitted whenver the manager associated to this side widget has changed.

See setSideWidgetManager() and KLFSideWidgetManagerBase.

Referenced by setSideWidgetManager().

◆ sideWidgetShown

void KLFSideWidget::sideWidgetShown ( bool  shown)
signal

emitted whenever this side widget is shown or hidden

This is also emitted when the side widget manager has changed.

Referenced by setSideWidgetManager().

◆ sideWidgetVisible()

bool KLFSideWidget::sideWidgetVisible ( ) const

returns TRUE if this side widget is currently visible

This is not necessarily the same as QWidget::isVisible(), since this widget may have been reparented to some container, which itself is being shown or hidden.

Definition at line 806 of file klfsidewidget.cpp.

References KLF_ASSERT_NOT_NULL, and sideWidgetManagerType().

◆ toggleSideWidget

void KLFSideWidget::toggleSideWidget ( )
inlineslot

toggles the show/hide state of this side widget.

Exactly the same as showSideWidget(!sideWidgetVisible()).

Definition at line 436 of file klfsidewidget.h.

References KLF_DECLARE_PRIVATE.

Property Documentation

◆ sideWidgetManagerType

QString KLFSideWidget::sideWidgetManagerType
readwrite

Definition at line 377 of file klfsidewidget.h.


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

Generated by doxygen 1.8.13