From 1ce0448808d2bcd39e6643be898376238650ebd8 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 2 Apr 2013 17:30:14 +0200 Subject: [PATCH] Bitcoin-Qt: only use qApp for Q(Core)Application::instance() --- src/qt/bitcoin.cpp | 4 ++-- src/qt/bitcoinamountfield.cpp | 2 +- src/qt/bitcoingui.cpp | 12 ++++++------ src/qt/guiutil.cpp | 6 +++--- src/qt/sendcoinsdialog.cpp | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 346128c0..2c47f30e 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -82,14 +82,14 @@ static void InitMessage(const std::string &message) if(splashref) { splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(255,255,200)); - QApplication::instance()->processEvents(); + qApp->processEvents(); } printf("init message: %s\n", message.c_str()); } static void QueueShutdown() { - QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection); + QMetaObject::invokeMethod(qApp, "quit", Qt::QueuedConnection); } /* diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 4fa2ca50..b12e296f 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -98,7 +98,7 @@ bool BitcoinAmountField::eventFilter(QObject *object, QEvent *event) { // Translate a comma into a period QKeyEvent periodKeyEvent(event->type(), Qt::Key_Period, keyEvent->modifiers(), ".", keyEvent->isAutoRepeat(), keyEvent->count()); - qApp->sendEvent(object, &periodKeyEvent); + QApplication::sendEvent(object, &periodKeyEvent); return true; } } diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 1c9094a8..11dce3ce 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -70,7 +70,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): restoreWindowGeometry(); setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet")); #ifndef Q_OS_MAC - qApp->setWindowIcon(QIcon(":icons/bitcoin")); + QApplication::setWindowIcon(QIcon(":icons/bitcoin")); setWindowIcon(QIcon(":icons/bitcoin")); #else setUnifiedTitleAndToolBarOnMac(true); @@ -127,7 +127,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): // Override style sheet for progress bar for styles that have a segmented progress bar, // as they make the text unreadable (workaround for issue #1071) // See https://qt-project.org/doc/qt-4.8/gallery.html - QString curStyle = qApp->style()->metaObject()->className(); + QString curStyle = QApplication::style()->metaObject()->className(); if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle") { progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }"); @@ -308,7 +308,7 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) { setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]")); #ifndef Q_OS_MAC - qApp->setWindowIcon(QIcon(":icons/bitcoin_testnet")); + QApplication::setWindowIcon(QIcon(":icons/bitcoin_testnet")); setWindowIcon(QIcon(":icons/bitcoin_testnet")); #else MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet")); @@ -368,7 +368,7 @@ void BitcoinGUI::createTrayIcon() trayIcon->show(); #endif - notificator = new Notificator(qApp->applicationName(), trayIcon); + notificator = new Notificator(QApplication::applicationName(), trayIcon); } void BitcoinGUI::createTrayIconMenu() @@ -432,7 +432,7 @@ void BitcoinGUI::restoreWindowGeometry() QSize size = settings.value("nWindowSize", QSize(850, 550)).toSize(); if (!pos.x() && !pos.y()) { - QRect screen = qApp->desktop()->screenGeometry(); + QRect screen = QApplication::desktop()->screenGeometry(); pos.setX((screen.width()-size.width())/2); pos.setY((screen.height()-size.height())/2); } @@ -681,7 +681,7 @@ void BitcoinGUI::closeEvent(QCloseEvent *event) if(!clientModel->getOptionsModel()->getMinimizeToTray() && !clientModel->getOptionsModel()->getMinimizeOnClose()) { - qApp->quit(); + QApplication::quit(); } #endif } diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index e56e40c2..2105f073 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -161,9 +161,9 @@ void copyEntryData(QAbstractItemView *view, int column, int role) if(!selection.isEmpty()) { // Copy first item (global clipboard) - qApp->clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Clipboard); + QApplication::clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Clipboard); // Copy first item (global mouse selection for e.g. X11 - NOP on Windows) - qApp->clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Selection); + QApplication::clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Selection); } } @@ -227,7 +227,7 @@ Qt::ConnectionType blockingGUIThreadConnection() bool checkPoint(const QPoint &p, const QWidget *w) { - QWidget *atW = qApp->widgetAt(w->mapToGlobal(p)); + QWidget *atW = QApplication::widgetAt(w->mapToGlobal(p)); if (!atW) return false; return atW->topLevelWidget() == w; } diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 2133a5e7..eb3ce48a 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -202,7 +202,7 @@ SendCoinsEntry *SendCoinsDialog::addEntry() entry->clear(); entry->setFocus(); ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint()); - QCoreApplication::instance()->processEvents(); + qApp->processEvents(); QScrollBar* bar = ui->scrollArea->verticalScrollBar(); if(bar) bar->setSliderPosition(bar->maximum());