Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Pencil2D Class Reference

The main application class handling startup as well as the main loop. More...

#include <pencil2d.h>

+ Inheritance diagram for Pencil2D:
Inheritance graph
[legend]
+ Collaboration diagram for Pencil2D:
Collaboration graph
[legend]

Signals

void openFileRequested (QString filename)
 Emitted when the operating system requests that a file should be opened.
 

Public Member Functions

 Pencil2D (int &argc, char **argv)
 Initializes the application with the given command line arguments.
 
Status handleCommandLineOptions ()
 Parses supplied command line arguments and performs the appropriate actions, such as running the command line exporter or preparing the GUI.
 
bool isInstanceOpen ()
 Checks if multiple instances of Pencil2D are open.
 
bool event (QEvent *event) override
 
- Public Member Functions inherited from QApplication
 QApplication (int &argc, char **argv)
 
virtual bool notify (QObject *receiver, QEvent *e) override
 
void focusChanged (QWidget *old, QWidget *now)
 
QString styleSheet () const const
 
void setStyleSheet (const QString &sheet)
 
void setAutoSipEnabled (const bool enabled)
 
bool autoSipEnabled () const const
 
 qApp qApp
 
- Public Member Functions inherited from QGuiApplication
 QGuiApplication (int &argc, char **argv)
 
qreal devicePixelRatio () const const
 
virtual bool notify (QObject *object, QEvent *event) override
 
bool isSessionRestored () const const
 
QString sessionId () const const
 
QString sessionKey () const const
 
bool isSavingSession () const const
 
void fontDatabaseChanged ()
 
void screenAdded (QScreen *screen)
 
void screenRemoved (QScreen *screen)
 
void primaryScreenChanged (QScreen *screen)
 
void lastWindowClosed ()
 
void focusObjectChanged (QObject *focusObject)
 
void focusWindowChanged (QWindow *focusWindow)
 
void applicationStateChanged (Qt::ApplicationState state)
 
void layoutDirectionChanged (Qt::LayoutDirection direction)
 
void commitDataRequest (QSessionManager &manager)
 
void saveStateRequest (QSessionManager &manager)
 
void paletteChanged (const QPalette &palette)
 
void applicationDisplayNameChanged ()
 
void fontChanged (const QFont &font)
 
 qGuiApp qGuiApp
 
- Public Member Functions inherited from QCoreApplication
 QCoreApplication (int &argc, char **argv)
 
virtual bool notify (QObject *receiver, QEvent *event)
 
void installNativeEventFilter (QAbstractNativeEventFilter *filterObj)
 
void removeNativeEventFilter (QAbstractNativeEventFilter *filterObject)
 
void aboutToQuit ()
 
void organizationNameChanged ()
 
void organizationDomainChanged ()
 
void applicationNameChanged ()
 
void applicationVersionChanged ()
 
 Q_COREAPP_STARTUP_FUNCTION (QtStartUpFunction ptr)
 
void qAddPostRoutine (QtCleanUpFunction ptr)
 
void qRemovePostRoutine (QtCleanUpFunction ptr)
 
 Q_DECLARE_TR_FUNCTIONS (context)
 
- Public Member Functions inherited from QObject
virtual const QMetaObject * metaObject () const const
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThread * thread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
T findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectList & children () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArray > dynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObject * parent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
T qobject_cast (QObject *object)
 
T qobject_cast (const QObject *object)
 
T qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 

Private Member Functions

void installTranslators ()
 Sets up translators for the application locale configured by the user or the system locale.
 
void prepareGuiStartup (const QString &inputPath)
 Readies the graphical UI for entering the main loop.
 

Private Attributes

std::unique_ptr< MainWindow2 > mainWindow
 
std::unique_ptr< QLockFile > mProcessLock
 

Additional Inherited Members

- Public Types inherited from QApplication
enum  ColorSpec
 
- Public Types inherited from QCoreApplication
enum  Encoding
 
- Static Public Member Functions inherited from QApplication
QStyle * style ()
 
void setStyle (QStyle *style)
 
QStyle * setStyle (const QString &style)
 
int colorSpec ()
 
void setColorSpec (int spec)
 
QPalette palette (const QWidget *widget)
 
QPalette palette (const char *className)
 
void setPalette (const QPalette &palette, const char *className)
 
QFont font ()
 
QFont font (const QWidget *widget)
 
QFont font (const char *className)
 
void setFont (const QFont &font, const char *className)
 
QFontMetrics fontMetrics ()
 
void setWindowIcon (const QIcon &icon)
 
QIcon windowIcon ()
 
QWidgetList allWidgets ()
 
QWidgetList topLevelWidgets ()
 
QDesktopWidget * desktop ()
 
QWidget * activePopupWidget ()
 
QWidget * activeModalWidget ()
 
QWidget * focusWidget ()
 
QWidget * activeWindow ()
 
void setActiveWindow (QWidget *active)
 
QWidget * widgetAt (const QPoint &point)
 
QWidget * widgetAt (int x, int y)
 
QWidget * topLevelAt (const QPoint &point)
 
QWidget * topLevelAt (int x, int y)
 
void beep ()
 
void alert (QWidget *widget, int msec)
 
void setCursorFlashTime (int)
 
int cursorFlashTime ()
 
void setDoubleClickInterval (int)
 
int doubleClickInterval ()
 
void setKeyboardInputInterval (int)
 
int keyboardInputInterval ()
 
void setWheelScrollLines (int)
 
int wheelScrollLines ()
 
void setGlobalStrut (const QSize &)
 
QSize globalStrut ()
 
void setStartDragTime (int ms)
 
int startDragTime ()
 
void setStartDragDistance (int l)
 
int startDragDistance ()
 
bool isEffectEnabled (Qt::UIEffect effect)
 
void setEffectEnabled (Qt::UIEffect effect, bool enable)
 
int exec ()
 
void setKeypadNavigationEnabled (bool enable)
 
bool keypadNavigationEnabled ()
 
void setNavigationMode (Qt::NavigationMode mode)
 
Qt::NavigationMode navigationMode ()
 
void closeAllWindows ()
 
void aboutQt ()
 
- Static Public Member Functions inherited from QGuiApplication
void setApplicationDisplayName (const QString &name)
 
QString applicationDisplayName ()
 
void setDesktopFileName (const QString &name)
 
QString desktopFileName ()
 
QWindowList allWindows ()
 
QWindowList topLevelWindows ()
 
QWindow * topLevelAt (const QPoint &pos)
 
void setWindowIcon (const QIcon &icon)
 
QIcon windowIcon ()
 
QString platformName ()
 
QWindow * modalWindow ()
 
QWindow * focusWindow ()
 
QObject * focusObject ()
 
QScreen * primaryScreen ()
 
QList< QScreen * > screens ()
 
QScreen * screenAt (const QPoint &point)
 
QCursor * overrideCursor ()
 
void setOverrideCursor (const QCursor &cursor)
 
void changeOverrideCursor (const QCursor &cursor)
 
void restoreOverrideCursor ()
 
QFont font ()
 
void setFont (const QFont &font)
 
QClipboard * clipboard ()
 
QPalette palette ()
 
void setPalette (const QPalette &pal)
 
Qt::KeyboardModifiers keyboardModifiers ()
 
Qt::KeyboardModifiers queryKeyboardModifiers ()
 
Qt::MouseButtons mouseButtons ()
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
Qt::LayoutDirection layoutDirection ()
 
bool isRightToLeft ()
 
bool isLeftToRight ()
 
QStyleHints * styleHints ()
 
void setDesktopSettingsAware (bool on)
 
bool desktopSettingsAware ()
 
QInputMethod * inputMethod ()
 
QPlatformNativeInterface * platformNativeInterface ()
 
QFunctionPointer platformFunction (const QByteArray &function)
 
void setQuitOnLastWindowClosed (bool quit)
 
bool quitOnLastWindowClosed ()
 
Qt::ApplicationState applicationState ()
 
void setHighDpiScaleFactorRoundingPolicy (Qt::HighDpiScaleFactorRoundingPolicy policy)
 
Qt::HighDpiScaleFactorRoundingPolicy highDpiScaleFactorRoundingPolicy ()
 
int exec ()
 
bool isFallbackSessionManagementEnabled ()
 
void setFallbackSessionManagementEnabled (bool enabled)
 
void sync ()
 
- Static Public Member Functions inherited from QCoreApplication
QStringList arguments ()
 
void setAttribute (Qt::ApplicationAttribute attribute, bool on)
 
bool testAttribute (Qt::ApplicationAttribute attribute)
 
void setOrganizationDomain (const QString &orgDomain)
 
QString organizationDomain ()
 
void setOrganizationName (const QString &orgName)
 
QString organizationName ()
 
void setApplicationName (const QString &application)
 
QString applicationName ()
 
void setApplicationVersion (const QString &version)
 
QString applicationVersion ()
 
void setSetuidAllowed (bool allow)
 
bool isSetuidAllowed ()
 
QCoreApplication * instance ()
 
int exec ()
 
void processEvents (QEventLoop::ProcessEventsFlags flags)
 
void processEvents (QEventLoop::ProcessEventsFlags flags, int ms)
 
void exit (int returnCode)
 
bool sendEvent (QObject *receiver, QEvent *event)
 
void postEvent (QObject *receiver, QEvent *event, int priority)
 
void sendPostedEvents (QObject *receiver, int event_type)
 
void removePostedEvents (QObject *receiver, int eventType)
 
bool hasPendingEvents ()
 
QAbstractEventDispatcher * eventDispatcher ()
 
void setEventDispatcher (QAbstractEventDispatcher *eventDispatcher)
 
bool startingUp ()
 
bool closingDown ()
 
QString applicationDirPath ()
 
QString applicationFilePath ()
 
qint64 applicationPid ()
 
void setLibraryPaths (const QStringList &paths)
 
QStringList libraryPaths ()
 
void addLibraryPath (const QString &path)
 
void removeLibraryPath (const QString &path)
 
bool installTranslator (QTranslator *translationFile)
 
bool removeTranslator (QTranslator *translationFile)
 
QString translate (const char *context, const char *sourceText, const char *disambiguation, int n)
 
QString translate (const char *context, const char *key, const char *disambiguation, QCoreApplication::Encoding encoding, int n)
 
void flush ()
 
bool isQuitLockEnabled ()
 
void setQuitLockEnabled (bool enabled)
 
void quit ()
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Public Attributes inherited from QApplication
 NormalColor
 
 CustomColor
 
 ManyColor
 
- Public Attributes inherited from QCoreApplication
 UnicodeUTF8
 
 Latin1
 
 DefaultCodec
 
 CodecForTr
 
- Public Attributes inherited from QObject
typedef QObjectList
 
virtual bool event (QEvent *e) override
 
virtual bool event (QEvent *e) override
 
virtual bool event (QEvent *e) override
 
- Protected Member Functions inherited from QObject
QObject * sender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
- Properties inherited from QApplication
 windowIcon
 
 cursorFlashTime
 
 doubleClickInterval
 
 keyboardInputInterval
 
 wheelScrollLines
 
 globalStrut
 
 startDragTime
 
 startDragDistance
 
 styleSheet
 
 autoSipEnabled
 
- Properties inherited from QGuiApplication
 windowIcon
 
 applicationDisplayName
 
 desktopFileName
 
 layoutDirection
 
 platformName
 
 quitOnLastWindowClosed
 
 primaryScreen
 
- Properties inherited from QCoreApplication
 applicationName
 
 applicationVersion
 
 organizationName
 
 organizationDomain
 
 quitLockEnabled
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The main application class handling startup as well as the main loop.

Definition at line 37 of file pencil2d.h.

Constructor & Destructor Documentation

◆ Pencil2D()

Pencil2D::Pencil2D ( int &  argc,
char **  argv 
)
explicit

Initializes the application with the given command line arguments.

Parameters
argcNumber of arguments
argvValues of the arguments

Definition at line 44 of file pencil2d.cpp.

◆ ~Pencil2D()

Pencil2D::~Pencil2D ( )
override

Definition at line 66 of file pencil2d.cpp.

Member Function Documentation

◆ event()

bool Pencil2D::event ( QEvent *  event)
overridevirtual

Reimplemented from QApplication.

Definition at line 125 of file pencil2d.cpp.

◆ handleCommandLineOptions()

Status Pencil2D::handleCommandLineOptions ( )

Parses supplied command line arguments and performs the appropriate actions, such as running the command line exporter or preparing the GUI.

This method should be called before entering the main loop.

Returns
  • Status::OK if the arguments have been handled and the application is ready to enter the main loop
  • Status::SAFE if all necessary actions have been performed and the application is ready for shutdown
  • any other code if an error occurred and the application is unable to start.
See also
exec()

Definition at line 72 of file pencil2d.cpp.

◆ installTranslators()

void Pencil2D::installTranslators ( )
private

Sets up translators for the application locale configured by the user or the system locale.

Definition at line 137 of file pencil2d.cpp.

◆ isInstanceOpen()

bool Pencil2D::isInstanceOpen ( )

Checks if multiple instances of Pencil2D are open.

If multiple instances of Pencil2D are open (indicated by a process holding the lock to a specific file in the application data directory) then the user will be warned of the issues with running multiple instances.

Returns
True if there are multiple instances running and the user has not chosen to ignore the warning, false otherwise.

Definition at line 109 of file pencil2d.cpp.

◆ openFileRequested

void Pencil2D::openFileRequested ( QString  filename)
signal

Emitted when the operating system requests that a file should be opened.

Parameters
filenameThe file to be opened
See also
QFileOpenEvent

◆ prepareGuiStartup()

void Pencil2D::prepareGuiStartup ( const QString &  inputPath)
private

Readies the graphical UI for entering the main loop.

Parameters
inputPathPath of a file to be opened on startup.

Definition at line 169 of file pencil2d.cpp.

Member Data Documentation

◆ mainWindow

std::unique_ptr<MainWindow2> Pencil2D::mainWindow
private

Definition at line 96 of file pencil2d.h.

◆ mProcessLock

std::unique_ptr<QLockFile> Pencil2D::mProcessLock
private

Definition at line 98 of file pencil2d.h.


The documentation for this class was generated from the following files:
  • app/src/pencil2d.h
  • app/src/pencil2d.cpp
Generated on Thu May 8 2025 04:47:54 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39