labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Project Class Reference

Represents a project. More...

#include <Project.h>

Inheritance diagram for Project:
[legend]
Collaboration diagram for Project:
[legend]

Classes

class  Private
 

Public Types

enum class  MdiWindowVisibility { folderOnly , folderAndSubfolders , allMdiWindows }
 MDI subwindow visibility setting. More...
 
- Public Types inherited from AbstractAspect
enum class  ChildIndexFlag { IncludeHidden = 0x01 , Recursive = 0x02 , Compress = 0x04 }
 Flags which control numbering scheme of children. More...
 

Public Slots

void descriptionChanged (const AbstractAspect *)
 Project::descriptionChanged This function is called, when an object changes its name. When a column changed its name and wasn't connected before to the curve/column(formula) then this is done in this function. More...
 
void aspectAddedSlot (const AbstractAspect *)
 Project::aspectAddedSlot When adding new columns, these should be connected to the corresponding curves. More...
 
- Public Slots inherited from AbstractAspect
bool setName (const QString &, bool autoUnique=true)
 AbstractAspect::setName sets the name of the abstract aspect. More...
 
void setComment (const QString &)
 
void remove ()
 Remove me from my parent's list of children. More...
 

Signals

void authorChanged (const QString &)
 
void requestSaveState (QXmlStreamWriter *) const
 
void requestLoadState (XmlStreamReader *)
 
void requestProjectContextMenu (QMenu *)
 
void requestFolderContextMenu (const Folder *, QMenu *)
 
void mdiWindowVisibilityChanged ()
 
void changed ()
 
void requestNavigateTo (const QString &path)
 
void loaded ()
 
void closeRequested ()
 
- Signals inherited from AbstractAspect
void aspectDescriptionAboutToChange (const AbstractAspect *)
 Emitted before the name, comment or caption spec is changed. More...
 
void aspectDescriptionChanged (const AbstractAspect *)
 Emitted after the name, comment or caption spec have changed. More...
 
void aspectAboutToBeAdded (const AbstractAspect *parent, const AbstractAspect *before, const AbstractAspect *child)
 Emitted before a new child is inserted. More...
 
void aspectAdded (const AbstractAspect *)
 Emitted after a new Aspect has been added to the tree. More...
 
void aspectAboutToBeRemoved (const AbstractAspect *)
 Emitted before an aspect is removed from its parent. More...
 
void aspectRemoved (const AbstractAspect *parent, const AbstractAspect *before, const AbstractAspect *child)
 Emitted from the parent after removing a child. More...
 
void aspectHiddenAboutToChange (const AbstractAspect *)
 Emitted before the hidden attribute is changed. More...
 
void aspectHiddenChanged (const AbstractAspect *)
 Emitted after the hidden attribute has changed. More...
 
void statusInfo (const QString &)
 Emitted whenever some aspect in the tree wants to give status information to the user. More...
 
void renameRequested ()
 
void selected (const AbstractAspect *)
 
void deselected (const AbstractAspect *)
 
void childAspectSelectedInView (const AbstractAspect *)
 
void childAspectDeselectedInView (const AbstractAspect *)
 

Public Member Functions

 Project ()
 
 ~Project () override
 
virtual const Projectproject () const
 
Projectproject () override
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one. More...
 
QUndoStack * undoStack () const override
 Return the undo stack of the Project, or 0 if this Aspect is not part of a Project. More...
 
QString path () const override
 Return the path that leads from the top-most Aspect (usually a Project) to me. More...
 
QMenu * createContextMenu () override
 Return a new context menu. More...
 
virtual QMenu * createFolderContextMenu (const Folder *)
 
void setMdiWindowVisibility (MdiWindowVisibility visibility)
 
MdiWindowVisibility mdiWindowVisibility () const
 
void setChanged (const bool value=true)
 
bool hasChanged () const
 
void navigateTo (const QString &path)
 
void setSuppressAspectAddedSignal (bool)
 
bool aspectAddedSignalSuppressed () const
 
void save (const QPixmap &, QXmlStreamWriter *) const
 
bool load (XmlStreamReader *, bool preview) override
 Load from XML. More...
 
bool load (const QString &, bool preview=false)
 
QVector< quintptr > droppedAspects (const QMimeData *)
 
- Public Member Functions inherited from Folder
 Folder (const QString &name, AspectType type=AspectType::Folder)
 
QIcon icon () const override
 Return an icon to be used for decorating my views. More...
 
void setPathesToLoad (const QStringList &)
 
const QStringList & pathesToLoad () const
 
bool isDraggable () const override
 
QVector< AspectTypedropableOn () const override
 
void processDropEvent (const QVector< quintptr > &) override
 
- Public Member Functions inherited from AbstractAspect
 AbstractAspect (const QString &name, AspectType type)
 
 ~AbstractAspect () override
 
QString name () const
 
QString comment () const
 
void setCreationTime (const QDateTime &)
 
QDateTime creationTime () const
 
void setHidden (bool)
 Set "hidden" property, i.e. whether to exclude this aspect from being shown in the explorer. More...
 
bool hidden () const
 
void setIsLoading (bool)
 
bool isLoading () const
 
AspectType type () const
 
bool inherits (AspectType type) const
 
AbstractAspectparentAspect () const
 Return my parent Aspect or 0 if I currently don't have one. More...
 
AbstractAspectparent (AspectType type) const
 In the parent-child hierarchy, return the first parent of type. More...
 
void setParentAspect (AbstractAspect *)
 
Folderfolder ()
 Return the folder the Aspect is contained in or 0 if there is none. More...
 
bool isDescendantOf (AbstractAspect *other)
 Return whether the there is a path upwards to the given aspect. More...
 
void addChild (AbstractAspect *)
 Add the given Aspect to my list of children. More...
 
void addChildFast (AbstractAspect *)
 Add the given Aspect to my list of children without any checks and without putting this step onto the undo-stack. More...
 
virtual void finalizeAdd ()
 
QVector< AbstractAspect * > children (AspectType type, ChildIndexFlags flags={}) const
 
void insertChildBefore (AbstractAspect *child, AbstractAspect *before)
 Insert the given Aspect at a specific position in my list of children. More...
 
void insertChildBeforeFast (AbstractAspect *child, AbstractAspect *before)
 Insert the given Aspect at a specific position in my list of children.without any checks and without putting this step onto the undo-stack. More...
 
void reparent (AbstractAspect *newParent, int newIndex=-1)
 Move a child to another parent aspect and transfer ownership. More...
 
void removeChild (AbstractAspect *)
 Remove the given Aspect from my list of children. More...
 
void removeAllChildren ()
 Remove all child Aspects. More...
 
virtual QVector< AbstractAspect * > dependsOn () const
 
template<class T >
T * ancestor () const
 Return the closest ancestor of class T (or NULL if none found). More...
 
template<class T >
QVector< T * > children (ChildIndexFlags flags={}) const
 
template<class T >
T * child (int index, ChildIndexFlags flags={}) const
 
template<class T >
T * child (const QString &name) const
 Get child by name and class. More...
 
template<class T >
int childCount (ChildIndexFlags flags={}) const
 Return the number of child Aspects inheriting from given class. More...
 
template<class T >
int indexOfChild (const AbstractAspect *child, ChildIndexFlags flags={}) const
 Return (0 based) index of child in the list of children inheriting from class T. More...
 
void setSelected (bool)
 
void setUndoAware (bool)
 
void exec (QUndoCommand *)
 Execute the given command, pushing it on the undoStack() if available. More...
 
void exec (QUndoCommand *command, const char *preChangeSignal, const char *postChangeSignal, QGenericArgument val0=QGenericArgument(), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument())
 Execute command and arrange for signals to be sent before/after it is redone or undone. More...
 
void beginMacro (const QString &text)
 Begin an undo stack macro (series of commands) More...
 
void endMacro ()
 End the current undo stack macro. More...
 

Static Public Member Functions

static bool isLabPlotProject (const QString &fileName)
 
static QString supportedExtensions ()
 

Private Member Functions

void updateCurveColumnDependencies (const QVector< XYCurve * > &, const AbstractColumn *) const
 
void updateHistogramColumnDependencies (const QVector< Histogram * > &, const AbstractColumn *) const
 
bool readProjectAttributes (XmlStreamReader *)
 
void save (QXmlStreamWriter *) const override
 Save as XML. More...
 

Private Attributes

Privated
 

Additional Inherited Members

- Protected Slots inherited from AbstractAspect
virtual void childSelected (const AbstractAspect *)
 
virtual void childDeselected (const AbstractAspect *)
 
- Protected Member Functions inherited from Folder
bool readChildAspectElement (XmlStreamReader *, bool preview)
 Read child aspect from XML. More...
 
- Protected Member Functions inherited from AbstractAspect
void info (const QString &text)
 Implementations should call this whenever status information should be given to the user. More...
 
bool readBasicAttributes (XmlStreamReader *)
 Load name and creation time from XML. More...
 
void writeBasicAttributes (QXmlStreamWriter *) const
 Save name and creation time to XML. More...
 
void writeCommentElement (QXmlStreamWriter *) const
 Save the comment to XML. More...
 
bool readCommentElement (XmlStreamReader *)
 Load comment from an XML element. More...
 
- Protected Attributes inherited from AbstractAspect
const AspectType m_type
 

Detailed Description

Represents a project.

File : Project.cpp Project : LabPlot

Description : Represents a LabPlot project.

Copyright : (C) 2011-2020 Alexander Semke (alexa.nosp@m.nder.nosp@m..semk.nosp@m.e@we.nosp@m.b.de) Copyright : (C) 2007-2008 Tilman Benkert (thzs@.nosp@m.gmx..nosp@m.net) Copyright : (C) 2007 Knut Franke (knut..nosp@m.fran.nosp@m.ke@gm.nosp@m.x.de)

  • This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *
  • This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *
  • You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA *

Project represents the root node of all objects created during the runtime of the program. Manages also the undo stack.

Definition at line 42 of file Project.h.

Member Enumeration Documentation

◆ MdiWindowVisibility

MDI subwindow visibility setting.

Enumerator
folderOnly 

only show MDI windows corresponding to Parts in the current folder

folderAndSubfolders 
allMdiWindows 

show MDI windows for all Parts in the project simultaneously

Definition at line 46 of file Project.h.

Constructor & Destructor Documentation

◆ Project()

◆ ~Project()

Project::~Project ( )
override

Definition at line 128 of file Project.cpp.

References d, AbstractAspect::Recursive, and Project::Private::undo_stack.

Member Function Documentation

◆ aspectAddedSignalSuppressed()

bool Project::aspectAddedSignalSuppressed ( ) const

◆ aspectAddedSlot

void Project::aspectAddedSlot ( const AbstractAspect aspect)
slot

Project::aspectAddedSlot When adding new columns, these should be connected to the corresponding curves.

Parameters
aspect

Definition at line 245 of file Project.cpp.

References AbstractAspect::child(), AbstractAspect::children(), AbstractAspect::Recursive, updateCurveColumnDependencies(), and updateHistogramColumnDependencies().

Referenced by Project().

◆ authorChanged

void Project::authorChanged ( const QString &  )
signal

Referenced by ProjectDock::setProject().

◆ changed

void Project::changed ( )
signal

◆ closeRequested

void Project::closeRequested ( )
signal

◆ createContextMenu()

QMenu * Project::createContextMenu ( )
overridevirtual

Return a new context menu.

The caller takes ownership of the menu.

Reimplemented from Folder.

Definition at line 154 of file Project.cpp.

References closeRequested(), AbstractAspect::createContextMenu(), i18n, and requestProjectContextMenu().

Referenced by ProjectExplorer::contextMenuEvent().

◆ createFolderContextMenu()

QMenu * Project::createFolderContextMenu ( const Folder folder)
virtual

◆ descriptionChanged

void Project::descriptionChanged ( const AbstractAspect aspect)
slot

Project::descriptionChanged This function is called, when an object changes its name. When a column changed its name and wasn't connected before to the curve/column(formula) then this is done in this function.

Parameters
aspect

Definition at line 221 of file Project.cpp.

References Project::Private::changed, changed(), d, AbstractAspect::isLoading(), AbstractAspect::Recursive, updateCurveColumnDependencies(), and updateHistogramColumnDependencies().

Referenced by Project().

◆ droppedAspects()

QVector< quintptr > Project::droppedAspects ( const QMimeData *  mimeData)

Definition at line 360 of file Project.cpp.

References project().

Referenced by WorksheetView::dropEvent(), and ProjectExplorer::eventFilter().

◆ hasChanged()

bool Project::hasChanged ( ) const

◆ isLabPlotProject()

bool Project::isLabPlotProject ( const QString &  fileName)
static

Definition at line 348 of file Project.cpp.

Referenced by MainWin::dropEvent(), MainWin::initGUI(), and MainWin::openProject().

◆ load() [1/2]

bool Project::load ( const QString &  filename,
bool  preview = false 
)

◆ load() [2/2]

◆ loaded

void Project::loaded ( )
signal

◆ mdiWindowVisibility()

Project::MdiWindowVisibility Project::mdiWindowVisibility ( ) const

◆ mdiWindowVisibilityChanged

void Project::mdiWindowVisibilityChanged ( )
signal

◆ navigateTo()

void Project::navigateTo ( const QString &  path)

Definition at line 344 of file Project.cpp.

References path(), and requestNavigateTo().

Referenced by ProjectParser::importTo(), XYCurve::navigateTo(), and Column::navigateTo().

◆ path()

QString Project::path ( ) const
inlineoverridevirtual

Return the path that leads from the top-most Aspect (usually a Project) to me.

Reimplemented from AbstractAspect.

Definition at line 63 of file Project.h.

References AbstractAspect::name().

Referenced by ImportProjectDialog::importTo(), load(), and navigateTo().

◆ project() [1/2]

virtual const Project* Project::project ( ) const
inlinevirtual

Definition at line 56 of file Project.h.

Referenced by droppedAspects().

◆ project() [2/2]

Project* Project::project ( )
inlineoverridevirtual

Return the Project this Aspect belongs to, or 0 if it is currently not part of one.

Reimplemented from AbstractAspect.

Definition at line 59 of file Project.h.

◆ readProjectAttributes()

bool Project::readProjectAttributes ( XmlStreamReader reader)
private

◆ requestFolderContextMenu

void Project::requestFolderContextMenu ( const Folder ,
QMenu *   
)
signal

◆ requestLoadState

void Project::requestLoadState ( XmlStreamReader )
signal

◆ requestNavigateTo

void Project::requestNavigateTo ( const QString &  path)
signal

◆ requestProjectContextMenu

void Project::requestProjectContextMenu ( QMenu *  )
signal

◆ requestSaveState

void Project::requestSaveState ( QXmlStreamWriter *  ) const
signal

◆ save() [1/2]

void Project::save ( const QPixmap &  thumbnail,
QXmlStreamWriter *  writer 
) const

◆ save() [2/2]

void Project::save ( QXmlStreamWriter *  writer) const
overrideprivatevirtual

Save as XML.

Reimplemented from Folder.

Definition at line 412 of file Project.cpp.

References AbstractAspect::child(), AbstractAspect::IncludeHidden, and requestSaveState().

◆ setChanged()

◆ setMdiWindowVisibility()

void Project::setMdiWindowVisibility ( MdiWindowVisibility  visibility)

◆ setSuppressAspectAddedSignal()

void Project::setSuppressAspectAddedSignal ( bool  value)

◆ supportedExtensions()

QString Project::supportedExtensions ( )
static

Definition at line 355 of file Project.cpp.

Referenced by MainWin::openProject(), and ImportProjectDialog::selectFile().

◆ undoStack()

QUndoStack * Project::undoStack ( ) const
overridevirtual

Return the undo stack of the Project, or 0 if this Aspect is not part of a Project.

It's also possible to construct undo-enabled Aspect trees without Project. The only requirement is that the root Aspect reimplements undoStack() to get the undo stack from somewhere (the default implementation just delegates to parentAspect()).

Reimplemented from AbstractAspect.

Definition at line 150 of file Project.cpp.

References d, and Project::Private::undo_stack.

Referenced by MainWin::historyDialog(), MainWin::openProject(), MainWin::redo(), MainWin::save(), and MainWin::undo().

◆ updateCurveColumnDependencies()

void Project::updateCurveColumnDependencies ( const QVector< XYCurve * > &  curves,
const AbstractColumn column 
) const
private

◆ updateHistogramColumnDependencies()

void Project::updateHistogramColumnDependencies ( const QVector< Histogram * > &  histograms,
const AbstractColumn column 
) const
private

Definition at line 328 of file Project.cpp.

References AbstractAspect::path().

Referenced by aspectAddedSlot(), and descriptionChanged().

Member Data Documentation

◆ d


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