LibrePCB Developers Documentation
EditorWidgetBase Class Referenceabstract

The EditorWidgetBase class. More...

#include <editorwidgetbase.h>

+ Inheritance diagram for EditorWidgetBase:
+ Collaboration diagram for EditorWidgetBase:

Classes

struct  Context
 

Public Types

enum  Tool
 
enum class  Feature
 

Public Slots

virtual bool save () noexcept
 
virtual bool selectAll () noexcept
 
virtual bool cut () noexcept
 
virtual bool copy () noexcept
 
virtual bool paste () noexcept
 
virtual bool move (Qt::ArrowType direction) noexcept
 
virtual bool rotate (const librepcb::Angle &rotation) noexcept
 
virtual bool mirror (Qt::Orientation orientation) noexcept
 
virtual bool flip (Qt::Orientation orientation) noexcept
 
virtual bool moveAlign () noexcept
 
virtual bool snapToGrid () noexcept
 
virtual bool remove () noexcept
 
virtual bool editProperties () noexcept
 
virtual bool zoomIn () noexcept
 
virtual bool zoomOut () noexcept
 
virtual bool zoomAll () noexcept
 
virtual bool toggle3D () noexcept
 
virtual bool abortCommand () noexcept
 
virtual bool processGenerateOutline () noexcept
 
virtual bool processGenerateCourtyard () noexcept
 
virtual bool importDxf () noexcept
 
virtual bool exportImage () noexcept
 
virtual bool exportPdf () noexcept
 
virtual bool print () noexcept
 
virtual bool editGridProperties () noexcept
 
virtual bool increaseGridInterval () noexcept
 
virtual bool decreaseGridInterval () noexcept
 
virtual bool toggleBackgroundImage () noexcept
 

Signals

void dirtyChanged (bool dirty)
 
void elementEdited (const librepcb::FilePath &fp)
 
void interfaceBrokenChanged (bool broken)
 
void errorsAvailableChanged (bool hasErrors)
 
void availableFeaturesChanged (const QSet< librepcb::editor::EditorWidgetBase::Feature > &features)
 

Public Member Functions

 EditorWidgetBase ()=delete
 
 EditorWidgetBase (const EditorWidgetBase &other)=delete
 
 EditorWidgetBase (const Context &context, const FilePath &fp, QWidget *parent=nullptr)
 
virtual ~EditorWidgetBase () noexcept
 
const FilePathgetFilePath () const noexcept
 
bool isDirty () const noexcept
 
virtual bool isBackgroundImageSet () const noexcept
 
virtual QSet< FeaturegetAvailableFeatures () const noexcept=0
 
virtual void connectEditor (UndoStackActionGroup &undoStackActionGroup, ExclusiveActionGroup &toolsActionGroup, QToolBar &commandToolBar, StatusBar &statusBar) noexcept
 
virtual void disconnectEditor () noexcept
 
EditorWidgetBaseoperator= (const EditorWidgetBase &rhs)=delete
 

Protected Member Functions

void setupInterfaceBrokenWarningWidget (QWidget &widget) noexcept
 
void setupErrorNotificationWidget (QWidget &widget) noexcept
 
virtual bool isInterfaceBroken () const noexcept=0
 
virtual bool toolChangeRequested (Tool newTool, const QVariant &mode) noexcept
 
virtual bool runChecks (RuleCheckMessageList &msgs) const =0
 
void setMessageApproved (LibraryBaseElement &element, std::shared_ptr< const RuleCheckMessage > msg, bool approve) noexcept
 
virtual bool execGraphicsExportDialog (GraphicsExportDialog::Output output, const QString &settingsKey) noexcept
 
void undoStackStateModified () noexcept
 
void setStatusBarMessage (const QString &message, int timeoutMs=-1) noexcept
 
const QStringList & getLibLocaleOrder () const noexcept
 
QString getWorkspaceSettingsUserName () noexcept
 
- Protected Member Functions inherited from IF_RuleCheckHandler
 IF_RuleCheckHandler () noexcept
 
 IF_RuleCheckHandler (const IF_RuleCheckHandler &) noexcept
 
virtual ~IF_RuleCheckHandler () noexcept
 
virtual bool ruleCheckFixAvailable (std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
 
virtual void ruleCheckFixRequested (std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
 
virtual void ruleCheckDescriptionRequested (std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
 
virtual void ruleCheckApproveRequested (std::shared_ptr< const RuleCheckMessage > msg, bool approve) noexcept=0
 
virtual void ruleCheckMessageSelected (std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
 
virtual void ruleCheckMessageDoubleClicked (std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
 

Protected Attributes

Context mContext
 
FilePath mFilePath
 
std::shared_ptr< TransactionalFileSystemmFileSystem
 
QScopedPointer< UndoStackmUndoStack
 
UndoStackActionGroupmUndoStackActionGroup
 
ExclusiveActionGroupmToolsActionGroup
 
StatusBarmStatusBar
 
QScopedPointer< ToolBarProxymCommandToolBarProxy
 
bool mManualModificationsMade
 Modifications bypassing the undo stack. More...
 
bool mIsInterfaceBroken
 
QString mStatusBarMessage
 
QSet< SExpressionmSupportedApprovals
 
QSet< SExpressionmDisappearedApprovals
 

Private Slots

void updateCheckMessages () noexcept
 

Private Member Functions

void toolRequested (int tool, const QVariant &mode) noexcept
 
void undoStackCleanChanged (bool clean) noexcept
 
void scheduleLibraryElementChecks () noexcept
 
virtual bool processRuleCheckMessage (std::shared_ptr< const RuleCheckMessage > msg, bool applyFix)=0
 
bool ruleCheckFixAvailable (std::shared_ptr< const RuleCheckMessage > msg) noexcept override
 
void ruleCheckFixRequested (std::shared_ptr< const RuleCheckMessage > msg) noexcept override
 
void ruleCheckDescriptionRequested (std::shared_ptr< const RuleCheckMessage > msg) noexcept override
 
void ruleCheckMessageSelected (std::shared_ptr< const RuleCheckMessage > msg) noexcept override
 
void ruleCheckMessageDoubleClicked (std::shared_ptr< const RuleCheckMessage > msg) noexcept override
 

Static Private Member Functions

static bool askForRestoringBackup (const FilePath &dir)
 Ask the user whether to restore a backup of a library element. More...
 

Detailed Description

The EditorWidgetBase class.

Member Enumeration Documentation

◆ Tool

enum Tool
Enumerator
NONE 
SELECT 
DRAW_LINE 
DRAW_RECT 
DRAW_POLYGON 
DRAW_CIRCLE 
DRAW_ARC 
DRAW_TEXT 
DRAW_ZONE 
ADD_NAMES 
ADD_VALUES 
ADD_PINS 
ADD_THT_PADS 
ADD_SMT_PADS 
ADD_HOLES 
MEASURE 
RENUMBER_PADS 

◆ Feature

enum class Feature
strong
Enumerator
Close 
Filter 
GraphicsView 
OpenGlView 
BackgroundImage 
ExportGraphics 
GenerateOutline 
GenerateCourtyard 
ReNumberPads 
SelectGraphics 
ImportGraphics 
Abort 
Cut 
Copy 
Paste 
Remove 
Move 
Rotate 
Mirror 
Flip 
MoveAlign 
SnapToGrid 
Properties 

Constructor & Destructor Documentation

◆ EditorWidgetBase() [1/3]

EditorWidgetBase ( )
delete

◆ EditorWidgetBase() [2/3]

EditorWidgetBase ( const EditorWidgetBase other)
delete

◆ EditorWidgetBase() [3/3]

EditorWidgetBase ( const Context context,
const FilePath fp,
QWidget *  parent = nullptr 
)
explicit
+ Here is the call graph for this function:

◆ ~EditorWidgetBase()

~EditorWidgetBase ( )
virtualnoexcept

Member Function Documentation

◆ getFilePath()

const FilePath & getFilePath ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ isDirty()

bool isDirty ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ isBackgroundImageSet()

virtual bool isBackgroundImageSet ( ) const
inlinevirtualnoexcept

Reimplemented in PackageEditorWidget.

◆ getAvailableFeatures()

virtual QSet< Feature > getAvailableFeatures ( ) const
pure virtualnoexcept

Implemented in ComponentCategoryEditorWidget, PackageCategoryEditorWidget, ComponentEditorWidget, DeviceEditorWidget, LibraryOverviewWidget, PackageEditorWidget, and SymbolEditorWidget.

+ Here is the caller graph for this function:

◆ connectEditor()

void connectEditor ( UndoStackActionGroup undoStackActionGroup,
ExclusiveActionGroup toolsActionGroup,
QToolBar &  commandToolBar,
StatusBar statusBar 
)
virtualnoexcept

Reimplemented in PackageEditorWidget, and SymbolEditorWidget.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disconnectEditor()

void disconnectEditor ( )
virtualnoexcept

Reimplemented in PackageEditorWidget, and SymbolEditorWidget.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

EditorWidgetBase & operator= ( const EditorWidgetBase rhs)
delete

◆ save

bool save ( )
virtualslotnoexcept
+ Here is the caller graph for this function:

◆ selectAll

virtual bool selectAll ( )
inlinevirtualslotnoexcept

◆ cut

virtual bool cut ( )
inlinevirtualslotnoexcept

◆ copy

virtual bool copy ( )
inlinevirtualslotnoexcept

◆ paste

virtual bool paste ( )
inlinevirtualslotnoexcept

◆ move

virtual bool move ( Qt::ArrowType  direction)
inlinevirtualslotnoexcept

◆ rotate

virtual bool rotate ( const librepcb::Angle rotation)
inlinevirtualslotnoexcept

◆ mirror

virtual bool mirror ( Qt::Orientation  orientation)
inlinevirtualslotnoexcept

◆ flip

virtual bool flip ( Qt::Orientation  orientation)
inlinevirtualslotnoexcept

◆ moveAlign

virtual bool moveAlign ( )
inlinevirtualslotnoexcept

◆ snapToGrid

virtual bool snapToGrid ( )
inlinevirtualslotnoexcept

◆ remove

virtual bool remove ( )
inlinevirtualslotnoexcept

◆ editProperties

virtual bool editProperties ( )
inlinevirtualslotnoexcept

◆ zoomIn

virtual bool zoomIn ( )
inlinevirtualslotnoexcept

◆ zoomOut

virtual bool zoomOut ( )
inlinevirtualslotnoexcept

◆ zoomAll

virtual bool zoomAll ( )
inlinevirtualslotnoexcept

◆ toggle3D

virtual bool toggle3D ( )
inlinevirtualslotnoexcept

◆ abortCommand

virtual bool abortCommand ( )
inlinevirtualslotnoexcept

◆ processGenerateOutline

virtual bool processGenerateOutline ( )
inlinevirtualslotnoexcept

◆ processGenerateCourtyard

virtual bool processGenerateCourtyard ( )
inlinevirtualslotnoexcept

◆ importDxf

virtual bool importDxf ( )
inlinevirtualslotnoexcept

◆ exportImage

bool exportImage ( )
virtualslotnoexcept
+ Here is the call graph for this function:

◆ exportPdf

bool exportPdf ( )
virtualslotnoexcept
+ Here is the call graph for this function:

◆ print

bool print ( )
virtualslotnoexcept
+ Here is the call graph for this function:

◆ editGridProperties

virtual bool editGridProperties ( )
inlinevirtualslotnoexcept

◆ increaseGridInterval

virtual bool increaseGridInterval ( )
inlinevirtualslotnoexcept

◆ decreaseGridInterval

virtual bool decreaseGridInterval ( )
inlinevirtualslotnoexcept

◆ toggleBackgroundImage

virtual bool toggleBackgroundImage ( )
inlinevirtualslotnoexcept

◆ setupInterfaceBrokenWarningWidget()

void setupInterfaceBrokenWarningWidget ( QWidget &  widget)
protectednoexcept
+ Here is the caller graph for this function:

◆ setupErrorNotificationWidget()

void setupErrorNotificationWidget ( QWidget &  widget)
protectednoexcept
+ Here is the caller graph for this function:

◆ isInterfaceBroken()

virtual bool isInterfaceBroken ( ) const
protectedpure virtualnoexcept

Implemented in ComponentCategoryEditorWidget, PackageCategoryEditorWidget, ComponentEditorWidget, DeviceEditorWidget, LibraryOverviewWidget, PackageEditorWidget, and SymbolEditorWidget.

+ Here is the caller graph for this function:

◆ toolChangeRequested()

virtual bool toolChangeRequested ( Tool  newTool,
const QVariant &  mode 
)
inlineprotectedvirtualnoexcept

Reimplemented in PackageEditorWidget, and SymbolEditorWidget.

◆ runChecks()

virtual bool runChecks ( RuleCheckMessageList msgs) const
protectedpure virtual

Implemented in ComponentCategoryEditorWidget, PackageCategoryEditorWidget, ComponentEditorWidget, DeviceEditorWidget, LibraryOverviewWidget, PackageEditorWidget, and SymbolEditorWidget.

+ Here is the caller graph for this function:

◆ setMessageApproved()

void setMessageApproved ( LibraryBaseElement element,
std::shared_ptr< const RuleCheckMessage msg,
bool  approve 
)
protectednoexcept

◆ execGraphicsExportDialog()

virtual bool execGraphicsExportDialog ( GraphicsExportDialog::Output  output,
const QString &  settingsKey 
)
inlineprotectedvirtualnoexcept

Reimplemented in PackageEditorWidget, and SymbolEditorWidget.

+ Here is the caller graph for this function:

◆ undoStackStateModified()

void undoStackStateModified ( )
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStatusBarMessage()

void setStatusBarMessage ( const QString &  message,
int  timeoutMs = -1 
)
protectednoexcept
+ Here is the caller graph for this function:

◆ getLibLocaleOrder()

const QStringList & getLibLocaleOrder ( ) const
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWorkspaceSettingsUserName()

QString getWorkspaceSettingsUserName ( )
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCheckMessages

void updateCheckMessages ( )
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ askForRestoringBackup()

bool askForRestoringBackup ( const FilePath dir)
staticprivate

Ask the user whether to restore a backup of a library element.

Parameters
dirThe library element directory to be restored.
Return values
trueRestore backup.
falseDo not restore backup.
Exceptions
Exceptionto abort opening the library element.

◆ toolRequested()

void toolRequested ( int  tool,
const QVariant &  mode 
)
privatenoexcept
+ Here is the caller graph for this function:

◆ undoStackCleanChanged()

void undoStackCleanChanged ( bool  clean)
privatenoexcept
+ Here is the caller graph for this function:

◆ scheduleLibraryElementChecks()

void scheduleLibraryElementChecks ( )
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processRuleCheckMessage()

virtual bool processRuleCheckMessage ( std::shared_ptr< const RuleCheckMessage msg,
bool  applyFix 
)
privatepure virtual

◆ ruleCheckFixAvailable()

bool ruleCheckFixAvailable ( std::shared_ptr< const RuleCheckMessage msg)
overrideprivatevirtualnoexcept

Implements IF_RuleCheckHandler.

◆ ruleCheckFixRequested()

void ruleCheckFixRequested ( std::shared_ptr< const RuleCheckMessage msg)
overrideprivatevirtualnoexcept

Implements IF_RuleCheckHandler.

+ Here is the call graph for this function:

◆ ruleCheckDescriptionRequested()

void ruleCheckDescriptionRequested ( std::shared_ptr< const RuleCheckMessage msg)
overrideprivatevirtualnoexcept

Implements IF_RuleCheckHandler.

◆ ruleCheckMessageSelected()

void ruleCheckMessageSelected ( std::shared_ptr< const RuleCheckMessage msg)
overrideprivatevirtualnoexcept

Implements IF_RuleCheckHandler.

◆ ruleCheckMessageDoubleClicked()

void ruleCheckMessageDoubleClicked ( std::shared_ptr< const RuleCheckMessage msg)
overrideprivatevirtualnoexcept

Implements IF_RuleCheckHandler.

◆ dirtyChanged

void dirtyChanged ( bool  dirty)
signal
+ Here is the caller graph for this function:

◆ elementEdited

void elementEdited ( const librepcb::FilePath fp)
signal
+ Here is the caller graph for this function:

◆ interfaceBrokenChanged

void interfaceBrokenChanged ( bool  broken)
signal
+ Here is the caller graph for this function:

◆ errorsAvailableChanged

void errorsAvailableChanged ( bool  hasErrors)
signal
+ Here is the caller graph for this function:

◆ availableFeaturesChanged

void availableFeaturesChanged ( const QSet< librepcb::editor::EditorWidgetBase::Feature > &  features)
signal

Member Data Documentation

◆ mContext

Context mContext
protected

◆ mFilePath

FilePath mFilePath
protected

◆ mFileSystem

std::shared_ptr<TransactionalFileSystem> mFileSystem
protected

◆ mUndoStack

QScopedPointer<UndoStack> mUndoStack
protected

◆ mUndoStackActionGroup

UndoStackActionGroup* mUndoStackActionGroup
protected

◆ mToolsActionGroup

ExclusiveActionGroup* mToolsActionGroup
protected

◆ mStatusBar

StatusBar* mStatusBar
protected

◆ mCommandToolBarProxy

QScopedPointer<ToolBarProxy> mCommandToolBarProxy
protected

◆ mManualModificationsMade

bool mManualModificationsMade
protected

Modifications bypassing the undo stack.

◆ mIsInterfaceBroken

bool mIsInterfaceBroken
protected

◆ mStatusBarMessage

QString mStatusBarMessage
protected

◆ mSupportedApprovals

QSet<SExpression> mSupportedApprovals
protected

◆ mDisappearedApprovals

QSet<SExpression> mDisappearedApprovals
protected

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