All Classes Namespaces Functions Variables Enumerations Properties Pages
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:

Signals

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

Public Member Functions

 Pencil2D (int &argc, char **argv)
 Initializes the application with the given command line arguments. More...
 
Status handleCommandLineOptions ()
 Parses supplied command line arguments and performs the appropriate actions, such as running the command line exporter or preparing the GUI. More...
 
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
 
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)
 
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 QMetaObjectmetaObject () const const
 
 QObject (QObject *parent)
 
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)
 
QThreadthread () 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)
 
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 QObjectListchildren () 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< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
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. More...
 

Private Attributes

std::unique_ptr< MainWindow2mainWindow
 

Additional Inherited Members

- Public Types inherited from QApplication
enum  ColorSpec
 
- Public Types inherited from QCoreApplication
enum  Encoding
 
- Static Public Member Functions inherited from QApplication
QStylestyle ()
 
void setStyle (QStyle *style)
 
QStylesetStyle (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 ()
 
QDesktopWidgetdesktop ()
 
QWidgetactivePopupWidget ()
 
QWidgetactiveModalWidget ()
 
QWidgetfocusWidget ()
 
QWidgetactiveWindow ()
 
void setActiveWindow (QWidget *active)
 
QWidgetwidgetAt (const QPoint &point)
 
QWidgetwidgetAt (int x, int y)
 
QWidgettopLevelAt (const QPoint &point)
 
QWidgettopLevelAt (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 ()
 
QWindowtopLevelAt (const QPoint &pos)
 
void setWindowIcon (const QIcon &icon)
 
QIcon windowIcon ()
 
QString platformName ()
 
QWindowmodalWindow ()
 
QWindowfocusWindow ()
 
QObjectfocusObject ()
 
QScreenprimaryScreen ()
 
QList< QScreen * > screens ()
 
QScreenscreenAt (const QPoint &point)
 
QCursoroverrideCursor ()
 
void setOverrideCursor (const QCursor &cursor)
 
void changeOverrideCursor (const QCursor &cursor)
 
void restoreOverrideCursor ()
 
QFont font ()
 
void setFont (const QFont &font)
 
QClipboardclipboard ()
 
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 ()
 
QStyleHintsstyleHints ()
 
void setDesktopSettingsAware (bool on)
 
bool desktopSettingsAware ()
 
QInputMethodinputMethod ()
 
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 ()
 
QCoreApplicationinstance ()
 
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 ()
 
QAbstractEventDispatchereventDispatcher ()
 
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
 
- Protected Member Functions inherited from QObject
QObjectsender () 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 36 of file pencil2d.h.

Constructor & Destructor Documentation

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 35 of file pencil2d.cpp.

Member Function Documentation

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 62 of file pencil2d.cpp.

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
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 125 of file pencil2d.cpp.


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