diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-06-29 14:30:35 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-07-18 06:44:59 +0000 |
commit | 75481443f2d51c63ac86da540e1e75111374cba2 (patch) | |
tree | eaad1800b05d78204d25274208f6fbae8de12d16 | |
parent | 8c1b116da4d2b6c816d61efd4c276525046e96bf (diff) | |
download | qtdoc-75481443f2d51c63ac86da540e1e75111374cba2.tar.gz |
Fix invocation of static methods of QCoreApplication and subclasses
Replace qApp-> by static invocation where applicable.
Change-Id: I24df2689b0df8609d1aa8e7c9c9da75ed94a4bab
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
-rw-r--r-- | doc/src/howtos/scalabilityintro.qdoc | 6 | ||||
-rw-r--r-- | doc/src/platforms/windows.qdoc | 12 | ||||
-rw-r--r-- | doc/src/snippets/code/doc_src_deployment.cpp | 8 | ||||
-rw-r--r-- | doc/src/snippets/code/doc_src_deployment.qdoc | 2 | ||||
-rw-r--r-- | doc/src/snippets/code/doc_src_i18n.cpp | 8 | ||||
-rw-r--r-- | doc/src/snippets/code/doc_src_linguist-manual.cpp | 6 | ||||
-rw-r--r-- | doc/src/snippets/signalsandslots/signalslotsyntaxes.cpp | 2 | ||||
-rw-r--r-- | doc/src/snippets/widgets-tutorial/notepad/notepad.cpp | 2 |
8 files changed, 23 insertions, 23 deletions
diff --git a/doc/src/howtos/scalabilityintro.qdoc b/doc/src/howtos/scalabilityintro.qdoc index 8d8b99cb..cd823ce9 100644 --- a/doc/src/howtos/scalabilityintro.qdoc +++ b/doc/src/howtos/scalabilityintro.qdoc @@ -340,10 +340,10 @@ qreal refDpi = 216.; qreal refHeight = 1776.; qreal refWidth = 1080.; - QRect rect = qApp->primaryScreen()->geometry(); + QRect rect = QGuiApplication::primaryScreen()->geometry(); qreal height = qMax(rect.width(), rect.height()); qreal width = qMin(rect.width(), rect.height()); - qreal dpi = qApp->primaryScreen()->logicalDotsPerInch(); + qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch(); m_ratio = qMin(height/refHeight, width/refWidth); m_ratioFont = qMin(height*refDpi/(dpi*refHeight), width*refDpi/(dpi*refWidth)); \endcode @@ -446,7 +446,7 @@ code to actually use the @2x versions: \code - if ( qApp->primaryScreen()->devicePixelRatio() >= 2 ) { + if ( QGuiApplication::primaryScreen()->devicePixelRatio() >= 2 ) { imageVariant = "@2x"; } else { imageVariant = ""; diff --git a/doc/src/platforms/windows.qdoc b/doc/src/platforms/windows.qdoc index d809c12b..c4ba7e56 100644 --- a/doc/src/platforms/windows.qdoc +++ b/doc/src/platforms/windows.qdoc @@ -881,8 +881,8 @@ An alternative to putting the plugins in the plugins subdirectory is to add a custom search path when you start your application - using QApplication::addLibraryPath() or - QApplication::setLibraryPaths(). + using QCoreApplication::addLibraryPath() or + QCoreApplication::setLibraryPaths(). \snippet snippets/code/doc_src_deployment.cpp 19 @@ -1079,7 +1079,7 @@ \snippet snippets/code/doc_src_deployment.qdoc 54 - Then qApp->libraryPaths() would return something like this: + Then QCoreApplication::libraryPaths() would return something like this: \list \li \c{C:/customPath/plugins} @@ -1088,10 +1088,10 @@ \endlist The executable will look for the plugins in these directories and - the same order as the QStringList returned by qApp->libraryPaths(). - The newly added path is prepended to the qApp->libraryPaths() which + the same order as the QStringList returned by QCoreApplication::libraryPaths(). + The newly added path is prepended to the QCoreApplication::libraryPaths() which means that it will be searched through first. However, if you use - qApp->setLibraryPaths(), you will be able to determine which paths + QCoreApplication::setLibraryPaths(), you will be able to determine which paths and in which order they will be searched. The \l{How to Create Qt Plugins} document outlines the issues you diff --git a/doc/src/snippets/code/doc_src_deployment.cpp b/doc/src/snippets/code/doc_src_deployment.cpp index 5c15d1df..0932f70d 100644 --- a/doc/src/snippets/code/doc_src_deployment.cpp +++ b/doc/src/snippets/code/doc_src_deployment.cpp @@ -39,18 +39,18 @@ ****************************************************************************/ //! [9] -qApp->addLibraryPath("/some/other/path"); +QCoreApplication::addLibraryPath("/some/other/path"); //! [9] //! [19] -qApp->addLibraryPath("C:\some\other\path"); +QCoreApplication::addLibraryPath("C:/some/other/path"); //! [19] //! [49] -QDir dir(QApplication::applicationDirPath()); +QDir dir(QCoreApplication::applicationDirPath()); dir.cdUp(); dir.cd("plugins"); -QApplication::setLibraryPaths(QStringList(dir.absolutePath())); +QCoreApplication::setLibraryPaths(QStringList(dir.absolutePath())); //! [49] diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc index feb3bb74..2395cca2 100644 --- a/doc/src/snippets/code/doc_src_deployment.qdoc +++ b/doc/src/snippets/code/doc_src_deployment.qdoc @@ -377,5 +377,5 @@ otool -L MyApp.app/Contents/MacOS/MyApp //! [54] -qApp->addLibraryPath("C:/customPath/plugins"); +QCoreApplication::addLibraryPath("C:/customPath/plugins"); //! [54] diff --git a/doc/src/snippets/code/doc_src_i18n.cpp b/doc/src/snippets/code/doc_src_i18n.cpp index 83b59bf1..88bd1302 100644 --- a/doc/src/snippets/code/doc_src_i18n.cpp +++ b/doc/src/snippets/code/doc_src_i18n.cpp @@ -57,7 +57,7 @@ void some_global_function(LoginWidget *logwid) void same_global_function(LoginWidget *logwid) { QLabel *label = new QLabel( - qApp->translate("LoginWidget", "Password:"), logwid); + QCoreApplication::translate("LoginWidget", "Password:"), logwid); } //! [1] @@ -87,8 +87,8 @@ QString FriendlyConversation::greeting(int type) QString global_greeting(int type) { - return qApp->translate("FriendlyConversation", - greeting_strings[type]); + return QCoreApplication::translate("FriendlyConversation", + greeting_strings[type]); } //! [3] @@ -185,7 +185,7 @@ void some_global_function(LoginWidget *logwid) void same_global_function(LoginWidget *logwid) { QLabel *label = new QLabel( - qApp->translate("LoginWidget", "Password:"), + QCoreApplication::translate("LoginWidget", "Password:"), logwid); } //! [13] diff --git a/doc/src/snippets/code/doc_src_linguist-manual.cpp b/doc/src/snippets/code/doc_src_linguist-manual.cpp index 78e5d7df..acdf5e86 100644 --- a/doc/src/snippets/code/doc_src_linguist-manual.cpp +++ b/doc/src/snippets/code/doc_src_linguist-manual.cpp @@ -107,7 +107,7 @@ void some_global_function(LoginWidget *logwid) void same_global_function(LoginWidget *logwid) { QLabel *label = new QLabel( - qApp->translate("LoginWidget", "Password:"), + QCoreApplication::translate("LoginWidget", "Password:"), logwid); } //! [14] @@ -138,8 +138,8 @@ QString FriendlyConversation::greeting(int greet_type) QString global_greeting(int greet_type) { - return qApp->translate("FriendlyConversation", - greeting_strings[greet_type]); + return QCoreApplication::translate("FriendlyConversation", + greeting_strings[greet_type]); } //! [16] diff --git a/doc/src/snippets/signalsandslots/signalslotsyntaxes.cpp b/doc/src/snippets/signalsandslots/signalslotsyntaxes.cpp index 1bec5407..d38aa0c7 100644 --- a/doc/src/snippets/signalsandslots/signalslotsyntaxes.cpp +++ b/doc/src/snippets/signalsandslots/signalslotsyntaxes.cpp @@ -117,7 +117,7 @@ DemoWidget::DemoWidget(QWidget *parent) : QWidget(parent) { this, SLOT(printNumber())); // ERROR: Compiler requires compatible arguments - connect(qApp, &QApplication::aboutToQuit, + connect(qApp, &QCoreApplication::aboutToQuit, this, &DemoWidget::printNumber); } //! [defaultparams] diff --git a/doc/src/snippets/widgets-tutorial/notepad/notepad.cpp b/doc/src/snippets/widgets-tutorial/notepad/notepad.cpp index 2d29e385..a0e85be5 100644 --- a/doc/src/snippets/widgets-tutorial/notepad/notepad.cpp +++ b/doc/src/snippets/widgets-tutorial/notepad/notepad.cpp @@ -63,7 +63,7 @@ Notepad::~Notepad() //! [1] void Notepad::on_quitButton_clicked() { - qApp->quit(); + QCoreApplication::quit(); } //! [1] |