[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Public Types | Public Slots | Signals | Public Member Functions | Properties
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>

List of all members.

Public Types

enum  SideWidgetManager { ShowHide = 1, Float, Drawer }

Public Slots

void showSideWidget (bool show=true)
 show or hide the side widget.
void hideSideWidget (bool hide=true)
 hide or show the side widget.
void toggleSideWidget ()
 toggles the show/hide state of this side widget.
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
void sideWidgetManagerTypeChanged (const QString &managerType)
 emitted whenver the manager associated to this side widget has changed.

Public Member Functions

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

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);

   sideWidget->setSideWidgetManager(KLFSideWidget::Float);
   // 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

Enumerator:
ShowHide 
Float 
Drawer 

Definition at line 379 of file klfsidewidget.h.


Constructor & Destructor Documentation

KLFSideWidget::KLFSideWidget ( QWidget *  parent = NULL)

Definition at line 784 of file klfsidewidget.cpp.

References KLF_INIT_PRIVATE.

Definition at line 792 of file klfsidewidget.cpp.

References KLF_DEBUG_BLOCK, KLF_DELETE_PRIVATE, and KLF_FUNC_NAME.


Member Function Documentation

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().

void KLFSideWidget::hideSideWidget ( bool  hide = true) [inline, slot]

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.

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().

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().

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().

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

See KLFSideWidgetManagerBase.

Definition at line 801 of file klfsidewidget.cpp.

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().

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().

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().

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.

void KLFSideWidget::toggleSideWidget ( ) [inline, slot]

toggles the show/hide state of this side widget.

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

Definition at line 436 of file klfsidewidget.h.


Property Documentation

Definition at line 377 of file klfsidewidget.h.


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

Generated by doxygen 1.7.6.1. The KLatexFormula website is hosted on sourceforge.net