mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
fix:popup javascript windows
This commit is contained in:
parent
982c480451
commit
3a092947da
|
@ -328,10 +328,10 @@ ArticleView::ArticleView( QWidget * parent, ArticleNetworkAccessManager & nm, Au
|
|||
ui.searchFrame->installEventFilter( this );
|
||||
ui.ftsSearchFrame->installEventFilter( this );
|
||||
|
||||
QWebEngineSettings * settings = ui.definition->page()->settings();
|
||||
settings->defaultSettings()->setAttribute( QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls, true );
|
||||
settings->defaultSettings()->setAttribute( QWebEngineSettings::WebAttribute::LocalContentCanAccessFileUrls, true );
|
||||
settings->defaultSettings()->setAttribute( QWebEngineSettings::WebAttribute::ErrorPageEnabled, false);
|
||||
// QWebEngineSettings * settings = ui.definition->page()->settings();
|
||||
// settings->defaultSettings()->setAttribute( QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls, true );
|
||||
// settings->defaultSettings()->setAttribute( QWebEngineSettings::WebAttribute::LocalContentCanAccessFileUrls, true );
|
||||
// settings->defaultSettings()->setAttribute( QWebEngineSettings::WebAttribute::ErrorPageEnabled, false);
|
||||
// Load the default blank page instantly, so there would be no flicker.
|
||||
|
||||
QString contentType;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <QWebEngineView>
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
#include <QDialog>
|
||||
#include <QMainWindow>
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#include <qt_windows.h>
|
||||
|
@ -34,6 +36,17 @@ void ArticleWebView::triggerPageAction( QWebEnginePage::WebAction action, bool c
|
|||
QWebEngineView::triggerPageAction( action, checked );
|
||||
}
|
||||
|
||||
QWebEngineView * ArticleWebView::createWindow( QWebEnginePage::WebWindowType type )
|
||||
{
|
||||
QMainWindow * dlg = new QMainWindow( this );
|
||||
QWebEngineView * webbrowser = new QWebEngineView( this );
|
||||
dlg->setCentralWidget(webbrowser);
|
||||
dlg->setMinimumSize(400,400);
|
||||
dlg->show();
|
||||
|
||||
return webbrowser;
|
||||
}
|
||||
|
||||
bool ArticleWebView::event( QEvent * event )
|
||||
{
|
||||
if (event->type() == QEvent::ChildAdded) {
|
||||
|
|
|
@ -27,7 +27,6 @@ public:
|
|||
|
||||
ArticleWebView( QWidget * parent );
|
||||
~ArticleWebView();
|
||||
|
||||
void setUp( Config::Class * cfg );
|
||||
|
||||
bool isMidButtonPressed() const
|
||||
|
@ -52,7 +51,7 @@ public:
|
|||
void doubleClicked( QPoint pos );
|
||||
|
||||
protected:
|
||||
|
||||
QWebEngineView *createWindow(QWebEnginePage::WebWindowType type);
|
||||
bool event( QEvent * event );
|
||||
void singleClickAction(QMouseEvent *event);
|
||||
void sendCustomMouseEvent(QEvent::Type type);
|
||||
|
|
|
@ -1303,12 +1303,13 @@ void MainWindow::applyProxySettings()
|
|||
|
||||
void MainWindow::applyWebSettings()
|
||||
{
|
||||
QWebEngineSettings *defaultSettings = QWebEngineSettings::defaultSettings();
|
||||
defaultSettings->setAttribute(QWebEngineSettings::PluginsEnabled, cfg.preferences.enableWebPlugins);
|
||||
defaultSettings->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, false);
|
||||
QWebEngineSettings * defaultSettings = QWebEngineSettings::defaultSettings();
|
||||
defaultSettings->setAttribute( QWebEngineSettings::PluginsEnabled, cfg.preferences.enableWebPlugins );
|
||||
defaultSettings->setAttribute( QWebEngineSettings::PlaybackRequiresUserGesture, false );
|
||||
defaultSettings->setAttribute( QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls, true );
|
||||
defaultSettings->setAttribute( QWebEngineSettings::WebAttribute::LocalContentCanAccessFileUrls, true );
|
||||
defaultSettings->setAttribute( QWebEngineSettings::WebAttribute::ErrorPageEnabled, false);
|
||||
defaultSettings->setAttribute( QWebEngineSettings::WebAttribute::ErrorPageEnabled, false );
|
||||
defaultSettings->setAttribute( QWebEngineSettings::WebAttribute::JavascriptCanOpenWindows, true );
|
||||
}
|
||||
|
||||
void MainWindow::setupNetworkCache( int maxSize )
|
||||
|
|
Loading…
Reference in a new issue