Help: Prevent moc from running on helpviewer_qwv.cpp.

If Webkit is disabled, moc will run on the file anyway, because there is
a ".moc" included and moc does not know about #ifdefs. This results in
an ugly warning ("no output generated") being emitted in the no-Webkit
case.
Solve the problem by moving the declaration of the QObject subclass into
the header file.

Change-Id: I2abaffd85a342fa2f3dbaa7bcf3ef63a2972c73e
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Christian Kandeler
2012-09-25 13:59:37 +02:00
committed by hjk
parent 61753f7e08
commit a6d50b6e12
2 changed files with 28 additions and 29 deletions

View File

@@ -44,6 +44,7 @@
#if defined(QT_NO_WEBKIT)
#include <QTextBrowser>
#else
#include <QWebPage>
#include <QWebView>
#endif
@@ -140,6 +141,33 @@ private:
HelpViewerPrivate *d;
};
#ifndef QT_NO_WEBKIT
class HelpPage : public QWebPage
{
Q_OBJECT
public:
HelpPage(QObject *parent);
protected:
virtual QWebPage *createWindow(QWebPage::WebWindowType);
virtual void triggerAction(WebAction action, bool checked = false);
virtual bool acceptNavigationRequest(QWebFrame *frame,
const QNetworkRequest &request, NavigationType type);
private slots:
void onHandleUnsupportedContent(QNetworkReply *reply);
private:
QUrl m_loadingUrl;
bool closeNewTabIfNeeded;
friend class Help::Internal::HelpViewer;
Qt::MouseButtons m_pressedButtons;
Qt::KeyboardModifiers m_keyboardModifiers;
};
#endif // QT_NO_WEBKIT
} // namespace Internal
} // namespace Help

View File

@@ -204,35 +204,6 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation op,
? QLatin1String("application/octet-stream") : mimeType);
}
// -- HelpPage
class HelpPage : public QWebPage
{
Q_OBJECT
public:
HelpPage(QObject *parent);
protected:
virtual QWebPage *createWindow(QWebPage::WebWindowType);
virtual void triggerAction(WebAction action, bool checked = false);
virtual bool acceptNavigationRequest(QWebFrame *frame,
const QNetworkRequest &request, NavigationType type);
private slots:
void onHandleUnsupportedContent(QNetworkReply *reply);
private:
QUrl m_loadingUrl;
bool closeNewTabIfNeeded;
friend class Help::Internal::HelpViewer;
Qt::MouseButtons m_pressedButtons;
Qt::KeyboardModifiers m_keyboardModifiers;
};
#include "helpviewer_qwv.moc"
// - HelpPage
HelpPage::HelpPage(QObject *parent)