[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
Public Slots | Signals | Public Member Functions | List of all members
KLFAbstractLibView Class Referenceabstract

A view widget to display a library resource's contents. More...

#include <klflibview.h>

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

Public Slots

virtual void updateResourceEngine ()=0
 
virtual void updateResourceProp (int propId)=0
 
virtual void updateResourceData (const QString &subres, int modifyType, const QList< KLFLib::entryId > &entryIdList)=0
 
virtual void updateResourceDefaultSubResourceChanged (const QString &newSubResource)
 
virtual bool selectEntries (const QList< KLFLib::entryId > &idList)=0
 
virtual void restore (uint restoreFlags=KLFLib::RestoreLatexAndStyle)=0
 
virtual void restoreWithStyle ()
 
virtual void restoreLatexOnly ()
 
virtual void wantMoreCategorySuggestions ()
 

Signals

void requestRestore (const KLFLibEntry &entry, uint restoreflags=KLFLib::RestoreLatexAndStyle)
 
void requestRestoreStyle (const KLFStyle &style)
 
void resourceDataChanged (const QList< KLFLib::entryId > &entryIdList)
 
void entriesSelected (const KLFLibEntryList &entries)
 
void moreCategorySuggestions (const QStringList &categorylist)
 
void operationStartReportingProgress (KLFProgressReporter *progressReporter, const QString &descriptiveText)
 

Public Member Functions

 KLFAbstractLibView (QWidget *parent)
 
virtual ~KLFAbstractLibView ()
 
virtual KLFLibResourceEngineresourceEngine () const
 
virtual QUrl url () const =0
 Display Resource URL. NOT exactly like KLFLibResourceEngine::url() ! More...
 
virtual uint compareUrlTo (const QUrl &other, uint interestFlags=0xFFFFFFFF) const =0
 Compare this resource view's URL to another URL. More...
 
bool validResourceEngine () const
 Returns TRUE if a non-NULL resource engine has been set. More...
 
virtual void setResourceEngine (KLFLibResourceEngine *resource)
 
virtual KLFLibEntryList selectedEntries () const =0
 
virtual QList< KLFLib::entryIdselectedEntryIds () const =0
 
virtual QList< QAction * > addContextMenuActions (const QPoint &pos)
 
virtual QVariantMap saveGuiState () const =0
 
virtual bool restoreGuiState (const QVariantMap &state)=0
 
virtual QStringList getCategorySuggestions ()=0
 
virtual KLFSearchablesearchable ()
 
- Public Member Functions inherited from QWidget
 ContextMenuPolicy
 
 FocusPolicy
 
 LayoutDirection
 
 WindowFlags
 
 WindowModality
 
 QWidget (QWidget *parent=0, Qt::WindowFlags f=0)
 
 actionEvent (QActionEvent *event)
 
 actions ()
 
 activateWindow ()
 
 addAction (QAction *action)
 
 addActions (QList< QAction * > actions)
 
 adjustSize ()
 
 ColorRole QWidget::backgroundRole()
 
 changeEvent (QEvent *event)
 
 childAt (int x, int y)
 
 childAt (const QPoint &p)
 
 clearFocus ()
 
 clearMask ()
 
 close ()
 
 closeEvent (QCloseEvent *event)
 
 contentsRect ()
 
 contextMenuEvent (QContextMenuEvent *event)
 
 create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
 customContextMenuRequested (const QPoint &pos)
 
 destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
 dragEnterEvent (QDragEnterEvent *event)
 
 dragLeaveEvent (QDragLeaveEvent *event)
 
 dragMoveEvent (QDragMoveEvent *event)
 
 dropEvent (QDropEvent *event)
 
 ensurePolished ()
 
 enterEvent (QEvent *event)
 
 event (QEvent *event)
 
 find (WId id)
 
 focusInEvent (QFocusEvent *event)
 
 focusNextChild ()
 
 focusNextPrevChild (bool next)
 
 focusOutEvent (QFocusEvent *event)
 
 focusPreviousChild ()
 
 focusProxy ()
 
 focusWidget ()
 
 fontInfo ()
 
 fontMetrics ()
 
 ColorRole QWidget::foregroundRole()
 
 getContentsMargins (int *left, int *top, int *right, int *bottom)
 
 getDC ()
 
 grabKeyboard ()
 
 grabMouse ()
 
 grabMouse (const QCursor &cursor)
 
 grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 
 hasEditFocus ()
 
 heightForWidth (int w)
 
 hide ()
 
 hideEvent (QHideEvent *event)
 
 inputContext ()
 
 inputMethodEvent (QInputMethodEvent *event)
 
 inputMethodQuery (Qt::InputMethodQuery query)
 
 insertAction (QAction *before, QAction *action)
 
 insertActions (QAction *before, QList< QAction * > actions)
 
 isAncestorOf (const QWidget *child)
 
 isEnabledTo (QWidget *ancestor)
 
 isHidden ()
 
 isVisibleTo (QWidget *ancestor)
 
 isWindow ()
 
 keyPressEvent (QKeyEvent *event)
 
 keyReleaseEvent (QKeyEvent *event)
 
 keyboardGrabber ()
 
 layout ()
 
 leaveEvent (QEvent *event)
 
 lower ()
 
 HANDLE QWidget::macCGHandle()
 
 macEvent (EventHandlerCallRef caller, EventRef event)
 
 HANDLE QWidget::macQDHandle()
 
 mapFrom (QWidget *parent, const QPoint &pos)
 
 mapFromGlobal (const QPoint &pos)
 
 mapFromParent (const QPoint &pos)
 
 mapTo (QWidget *parent, const QPoint &pos)
 
 mapToGlobal (const QPoint &pos)
 
 mapToParent (const QPoint &pos)
 
 mask ()
 
 metric (PaintDeviceMetric m)
 
 mouseDoubleClickEvent (QMouseEvent *event)
 
 mouseGrabber ()
 
 mouseMoveEvent (QMouseEvent *event)
 
 mousePressEvent (QMouseEvent *event)
 
 mouseReleaseEvent (QMouseEvent *event)
 
 moveEvent (QMoveEvent *event)
 
 nextInFocusChain ()
 
 overrideWindowFlags (Qt::WindowFlags flags)
 
 paintEngine ()
 
 paintEvent (QPaintEvent *event)
 
 parentWidget ()
 
 qwsEvent (QWSEvent *event)
 
 raise ()
 
 releaseDC (HDC hdc)
 
 releaseKeyboard ()
 
 releaseMouse ()
 
 releaseShortcut (int id)
 
 removeAction (QAction *action)
 
 render (QPaintDevice *target, const QPoint &targetOffset=QPoint()
 
 repaint ()
 
 repaint (int x, int y, int w, int h)
 
 repaint (const QRect &r)
 
 repaint (const QRegion &rgn)
 
 resetInputContext ()
 
 resizeEvent (QResizeEvent *event)
 
 restoreGeometry (const QByteArray &geometry)
 
 saveGeometry ()
 
 scroll (int dx, int dy)
 
 scroll (int dx, int dy, const QRect &r)
 
 setAttribute (Qt::WidgetAttribute attribute, bool on=true)
 
 setBackgroundRole (QPalette::ColorRole role)
 
 setContentsMargins (int left, int top, int right, int bottom)
 
 setDisabled (bool disable)
 
 setEditFocus (bool enable)
 
 setFixedHeight (int h)
 
 setFixedSize (const QSize &s)
 
 setFixedSize (int w, int h)
 
 setFixedWidth (int w)
 
 setFocus (Qt::FocusReason reason)
 
 setFocus ()
 
 setFocusProxy (QWidget *w)
 
 setForegroundRole (QPalette::ColorRole role)
 
 setHidden (bool hidden)
 
 setInputContext (QInputContext *context)
 
 setLayout (QLayout *layout)
 
 setMask (const QBitmap &bitmap)
 
 setMask (const QRegion &region)
 
 setParent (QWidget *parent)
 
 setParent (QWidget *parent, Qt::WindowFlags f)
 
 setShortcutAutoRepeat (int id, bool enable=true)
 
 setShortcutEnabled (int id, bool enable=true)
 
 setStyle (QStyle *style)
 
 setTabOrder (QWidget *first, QWidget *second)
 
 setWindowRole (const QString &role)
 
 setWindowState (Qt::WindowStates windowState)
 
 setWindowSurface (QWindowSurface *surface)
 
 show ()
 
 showEvent (QShowEvent *event)
 
 showFullScreen ()
 
 showMaximized ()
 
 showMinimized ()
 
 showNormal ()
 
 stackUnder (QWidget *w)
 
 style ()
 
 tabletEvent (QTabletEvent *event)
 
 testAttribute (Qt::WidgetAttribute attribute)
 
 underMouse ()
 
 update ()
 
 update (int x, int y, int w, int h)
 
 update (const QRect &r)
 
 update (const QRegion &rgn)
 
 updateGeometry ()
 
 updateMicroFocus ()
 
 visibleRegion ()
 
 wheelEvent (QWheelEvent *event)
 
 winEvent (MSG *message, long *result)
 
 winId ()
 
 window ()
 
 windowRole ()
 
 WindowStates QWidget::windowState()
 
 windowSurface ()
 
 WindowType QWidget::windowType()
 
 x11Event (XEvent *event)
 
 x11Info ()
 
 HANDLE QWidget::x11PictureHandle()
 
 QWidget (QWidget *parent, const char *name, Qt::WindowFlags f=0)
 
 BackgroundMode QWidget::backgroundMode()
 
 backgroundOffset ()
 
 backgroundOrigin ()
 
 caption ()
 
 childAt (int x, int y, bool includeThis)
 
 childAt (const QPoint &p, bool includeThis)
 
 close (bool alsoDelete)
 
 colorGroup ()
 
 constPolish ()
 
 drawText (const QPoint &p, const QString &s)
 
 drawText (int x, int y, const QString &s)
 
 erase ()
 
 erase (int x, int y, int w, int h)
 
 erase (const QRect &rect)
 
 erase (const QRegion &rgn)
 
 hasMouse ()
 
 icon ()
 
 iconText ()
 
 iconify ()
 
 isDesktop ()
 
 isDialog ()
 
 isInputMethodEnabled ()
 
 isPopup ()
 
 isShown ()
 
 isUpdatesEnabled ()
 
 isVisibleToTLW ()
 
 ownCursor ()
 
 ownFont ()
 
 ownPalette ()
 
 parentWidget (bool sameWindow)
 
 polish ()
 
 recreate (QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt=false)
 
 repaint (bool b)
 
 repaint (int x, int y, int w, int h, bool b)
 
 repaint (const QRect &r, bool b)
 
 repaint (const QRegion &rgn, bool b)
 
 reparent (QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt=false)
 
 reparent (QWidget *parent, const QPoint &p, bool showIt=false)
 
 setActiveWindow ()
 
 setBackgroundColor (const QColor &color)
 
 setBackgroundMode (Qt::BackgroundMode widgetBackground, Qt::BackgroundMode paletteBackground=Qt::PaletteBackground)
 
 setBackgroundOrigin (BackgroundOrigin background)
 
 setBackgroundPixmap (const QPixmap &pixmap)
 
 setCaption (const QString &c)
 
 setEraseColor (const QColor &color)
 
 setErasePixmap (const QPixmap &pixmap)
 
 setFont (const QFont &f, bool b)
 
 setIcon (const QPixmap &i)
 
 setIconText (const QString &it)
 
 setInputMethodEnabled (bool enabled)
 
 setKeyCompression (bool b)
 
 setPalette (const QPalette &p, bool b)
 
 setPaletteBackgroundColor (const QColor &color)
 
 setPaletteBackgroundPixmap (const QPixmap &pixmap)
 
 setPaletteForegroundColor (const QColor &color)
 
 setShown (bool shown)
 
 setSizePolicy (QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw)
 
 setStyle (const QString &style)
 
 unsetFont ()
 
 unsetPalette ()
 
 visibleRect ()
 
 wmapper ()
 

Detailed Description

A view widget to display a library resource's contents.

A base API for a widget that will display a KLFLibResourceEngine's contents. For example one could create a QTreeView and display the contents in there (that's what KLFLibDefaultView does...).

Note
This class subclasses QWidget because it makes uses of signals and slots. Before editing this file to change that, think before removing that inheritance or muting it to a QObject (subclasses will eventually want to inherit QWidget), no multiple QObject inheritance please!
Subclasses should emit the resourceDataChanged() signal AFTER they refresh after a resource data change.

Note: The operationStartReportingProgress() signal is purposed for when long update operations are necessary. It is to be used by subclasses exactly like in KLFLibResourceEngine.

Warning
The design of this class with a setResourceEngine() function makes it unsafe to blindly assume a non-NULL resource engine pointer at all times. Check the pointer before using it! See validResourceEngine().

If the reimplementation of this view can be searched with a KLFSearchBar, reimplement searchable() to return a KLFSearchable object for this view.

Definition at line 82 of file klflibview.h.

Constructor & Destructor Documentation

KLFAbstractLibView::KLFAbstractLibView ( QWidget parent)

Definition at line 171 of file klflibview.cpp.

virtual KLFAbstractLibView::~KLFAbstractLibView ( )
inlinevirtual

Definition at line 87 of file klflibview.h.

Member Function Documentation

QList< QAction * > KLFAbstractLibView::addContextMenuActions ( const QPoint pos)
virtual

Subclasses may add items to the context menu by returning them in this function.

Parameters
posis the position relative to widget where the menu was requested.
Note
The view itself does not handle context menus. This function is provided for whichever class uses this view to add these actions when that class creates a context menu.

The default implementation returns an empty list.

Reimplemented in KLFLibDefaultView.

Definition at line 200 of file klflibview.cpp.

Referenced by KLFLibBrowser::slotShowContextMenu().

virtual uint KLFAbstractLibView::compareUrlTo ( const QUrl other,
uint  interestFlags = 0xFFFFFFFF 
) const
pure virtual

Compare this resource view's URL to another URL.

Compares the URL of the resource we are viewing with the URL other, and returns an OR-ed combination of enum KlfUrlCompareFlag values of URL-comparision tests that have turned out to be true (see KlfUrlCompareFlag for a list of tests).

This function is supposed to answer to the following questions, each a condition as whether to return a URL comparation flag or not:

  • flag KlfUrlCompareEqual: does this view show the same information as a view whose URL would be other ?
  • flag KlfUrlCompareLessSpecific: does this view show MORE information than the other view ("less specific information" <=> "shows more") ?
  • flag KLFUrlCompareMoreSpecific: does this view show LESS information than the other view ?
  • flag KLFUrlComapreBaseEqual: does this view show the same resource as the other view, but possibly does not the same specific information, eg. not the same sub-resource.

The interestFlags is a binary OR'ed value of KlfUrlCompareFlag values of tests to be performed. Any flag that is set in interestFlags indicates that the return value of this function, when binary-AND'ed with that flag, is the result (T or F) of the test the flag stands for. However, if a flag is not set in interestFlags, its state in the return value by this function is undefined.

See also klfUrlCompare().

Implemented in KLFLibDefaultView.

void KLFAbstractLibView::entriesSelected ( const KLFLibEntryList entries)
signal

Emitted when the selection has changed, eg. user selected or deselected some entries.

Referenced by KLFLibDefaultView::slotSelectAll(), and KLFLibDefaultView::slotViewSelectionChanged().

virtual QStringList KLFAbstractLibView::getCategorySuggestions ( )
pure virtual

Subclasses should reimplement this function to return a list of all known categories to suggest to the user, eg. in a completion list for an editable combo box to edit categories.

Implemented in KLFLibDefaultView.

Referenced by wantMoreCategorySuggestions().

void KLFAbstractLibView::moreCategorySuggestions ( const QStringList categorylist)
signal

Subclasses should emit this signal with lists of categories they come accross, so that the editor can suggest these as completions upon editing category

Referenced by wantMoreCategorySuggestions().

void KLFAbstractLibView::operationStartReportingProgress ( KLFProgressReporter progressReporter,
const QString descriptiveText 
)
signal

Emitted by subclasses to announce the beginning of a long operation during which progress will be reported through the given progressReporter.

Should be used in the same way as KLFLibResourceEngine::operationStartReportingProgress().

Referenced by KLFLibDefaultView::updateResourceEngine().

void KLFAbstractLibView::requestRestore ( const KLFLibEntry entry,
uint  restoreflags = KLFLib::RestoreLatexAndStyle 
)
signal

Is emitted (by subclasses) when a latex entry is selected to be restored (eg. the entry was double-clicked).

Parameters
entryis the data to restore
restoreflagsprovides information on which part of entry to restore. See the possible flags in KLFLib::RestoreMode.

Referenced by KLFLibDefaultView::restore(), and KLFLibDefaultView::slotEntryDoubleClicked().

void KLFAbstractLibView::requestRestoreStyle ( const KLFStyle style)
signal

Is emitted (by subclasses) when the view wants the main application (or the framework that uses this class) to restore the given style style. No latex is to be restored.

void KLFAbstractLibView::resourceDataChanged ( const QList< KLFLib::entryId > &  entryIdList)
signal

Subclasses must emit this signal AFTER they have refreshed.

Referenced by KLFLibDefaultView::slotResourceDataChanged().

virtual KLFLibResourceEngine* KLFAbstractLibView::resourceEngine ( ) const
inlinevirtual
virtual void KLFAbstractLibView::restore ( uint  restoreFlags = KLFLib::RestoreLatexAndStyle)
pure virtualslot

Collects the necessary information and emits requestRestore()

virtual bool KLFAbstractLibView::restoreGuiState ( const QVariantMap &  state)
pure virtual

Restores the state described in state (which was previously, possibly in another session, returned by saveGuiState())

Implemented in KLFLibDefaultView.

Referenced by KLFLibBrowserViewContainer::loadGuiState(), and KLFLibBrowserViewContainer::openView().

virtual void KLFAbstractLibView::restoreLatexOnly ( )
inlinevirtualslot

Provides a reasonable default implementation that should suit for most purposes.

Definition at line 245 of file klflibview.h.

References KLFLib::RestoreLatex.

Referenced by KLFLibBrowser::slotRestoreLatexOnly().

virtual void KLFAbstractLibView::restoreWithStyle ( )
inlinevirtualslot

Provides a reasonable default implementation that should suit for most purposes.

Definition at line 243 of file klflibview.h.

References KLFLib::RestoreLatexAndStyle.

Referenced by KLFLibBrowser::slotRestoreWithStyle().

virtual QVariantMap KLFAbstractLibView::saveGuiState ( ) const
pure virtual

Saves the current GUI state (eg. column widths and order, etc.)

Implemented in KLFLibDefaultView.

Referenced by KLFLibBrowserViewContainer::saveGuiState().

virtual KLFSearchable* KLFAbstractLibView::searchable ( )
inlinevirtual

Reimplemented in KLFLibDefaultView.

Definition at line 167 of file klflibview.h.

Referenced by KLFLibBrowserViewContainer::slotCurrentChanged().

virtual KLFLibEntryList KLFAbstractLibView::selectedEntries ( ) const
pure virtual
virtual QList<KLFLib::entryId> KLFAbstractLibView::selectedEntryIds ( ) const
pure virtual

Subclasses should return a list of resource-entry-IDs that have been selected by the user.

Implemented in KLFLibDefaultView.

Referenced by KLFLibBrowser::slotCopyMoveToResource(), KLFLibBrowser::slotCut(), KLFLibBrowser::slotDeleteSelected(), and KLFLibBrowser::slotMetaInfoChanged().

virtual bool KLFAbstractLibView::selectEntries ( const QList< KLFLib::entryId > &  idList)
pure virtualslot

Subclasses should reimplement to update the given property to the given value on all library entries that are selected by the user. (They have to actually perform the change in the resource, eg with KLFLibResourceEngine::changeEntries()).

Note
The view does not have to garantee that selection is preserved. Subclasses must reimplement to select the given entries in the view.
Returns
TRUE on success. If the operation was not possible (eg. one ID is invalid/not displayed, view does not support multiple selections whilst idList.size()>1, etc.) then this function should return FALSE.

Referenced by KLFLibBrowser::slotMetaInfoChanged().

void KLFAbstractLibView::setResourceEngine ( KLFLibResourceEngine resource)
virtual
virtual void KLFAbstractLibView::updateResourceData ( const QString subres,
int  modifyType,
const QList< KLFLib::entryId > &  entryIdList 
)
pure virtualslot

Implemented in KLFLibDefaultView.

Referenced by setResourceEngine().

void KLFAbstractLibView::updateResourceDefaultSubResourceChanged ( const QString newSubResource)
virtualslot

Default implementation calls updateResourceEngine()

Definition at line 190 of file klflibview.cpp.

References updateResourceEngine().

Referenced by setResourceEngine().

virtual void KLFAbstractLibView::updateResourceEngine ( )
pure virtualslot
virtual void KLFAbstractLibView::updateResourceProp ( int  propId)
pure virtualslot

Implemented in KLFLibDefaultView.

Referenced by setResourceEngine().

virtual QUrl KLFAbstractLibView::url ( ) const
pure virtual

Display Resource URL. NOT exactly like KLFLibResourceEngine::url() !

Returns an URL describing exactly what is shown to user, based on the resource engine's URL.

Warning
This does not simply return resourceEngine()->url(). It returns in the URL exactly the information that is displayed to user. For example, a view that can handle displaying all sub-resources will NOT include the default sub-resource in its URL, however a view displaying only the default sub-resource will include a "klfDefaultSubResource" query item to distinguish it from another view acting on the same base URL but displaying a different sub-resource.

Implemented in KLFLibDefaultView.

Referenced by KLFLibBrowser::slotCopy(), KLFLibBrowser::slotShowContextMenu(), and KLFLibBrowserViewContainer::url().

bool KLFAbstractLibView::validResourceEngine ( ) const
inline

Returns TRUE if a non-NULL resource engine has been set.

Definition at line 134 of file klflibview.h.

void KLFAbstractLibView::wantMoreCategorySuggestions ( )
virtualslot

Called by the owner of the view. This function fetches category suggestions (by calling the virtual getCategorySuggestions() reimplemented by subclasses) and emits the signal moreCategorySuggestions().

Subclasses need not reimplement this function.

Definition at line 195 of file klflibview.cpp.

References getCategorySuggestions(), and moreCategorySuggestions().

Referenced by KLFLibBrowser::openResource(), and KLFLibDefaultView::updateResourceEngine().


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

Generated by doxygen 1.8.6