#include <QPrintDialog>
#include <QPrintPreviewDialog>
#include <QPrinter>
-#include <QSplitter>
// Initialize the public static variables.
QString TabWidget::webEngineDefaultUserAgent = QLatin1String("");
PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const bool adjacent, const bool backgroundTab, const QString urlString)
{
// Create a splitter widget.
- QSplitter *splitterPointer = new QSplitter();
+ splitterPointer = new QSplitter();
// Set the splitter to be vertical.
splitterPointer->setOrientation(Qt::Vertical);
QWebEngineCookieStore *webEngineCookieStorePointer = webEngineProfilePointer->cookieStore();
QWebEngineSettings *webEngineSettingsPointer = webEnginePagePointer->settings();
- // Set the development tools WebEngine. This must be done here to preserve the bottom half of the window as the initial development tools size.
+ // Set the development tools WebEngine.
webEnginePagePointer->setDevToolsPage(devToolsWebEngineViewPointer->page());
// Initially hide the development tools WebEngine.
});
// Update the title when it changes.
- connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::titleChanged, [this, splitterPointer] (const QString &title)
+ connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::titleChanged, [this] (const QString &title)
{
// Get the index for this tab.
int tabIndex = qTabWidgetPointer->indexOf(splitterPointer);
});
// Connect the loading favorite icon movie to the tab icon.
- connect(loadingFavoriteIconMoviePointer, &QMovie::frameChanged, [this, splitterPointer, privacyWebEngineViewPointer]
+ connect(loadingFavoriteIconMoviePointer, &QMovie::frameChanged, [this, privacyWebEngineViewPointer]
{
// Get the index for this tab.
int tabIndex = qTabWidgetPointer->indexOf(splitterPointer);
});
// Update the icon when it changes.
- connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::iconChanged, [this, splitterPointer, privacyWebEngineViewPointer] (const QIcon &newFavoriteIcon)
+ connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::iconChanged, [this, privacyWebEngineViewPointer] (const QIcon &newFavoriteIcon)
{
// Store the favorite icon in the privacy web engine view.
if (newFavoriteIcon.isNull())
});
// Update the progress bar when a load finishes.
- connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadFinished, [this, splitterPointer, privacyWebEngineViewPointer] ()
+ connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadFinished, [this, privacyWebEngineViewPointer] ()
{
// Set the privacy web engine view to be not loading.
privacyWebEngineViewPointer->isLoading = false;
// Plugins must be enabled for the PDF viewer to work. <https://doc.qt.io/qt-5/qtwebengine-features.html#pdf-file-viewing>
webEngineSettingsPointer->setAttribute(QWebEngineSettings::PluginsEnabled, true);
- // Allow JavaScript to paste to (but not copy from) the clipboard with user interaction.
+ // Allow JavaScript to paste to (but not copy from) the clipboard, but only with user interaction.
webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, true);
// Update the blocked requests action.
// Display the developer tools.
devToolsWebEngineViewPointer->setVisible(true);
+
+ // Split the visible space equally between the main WebEngine and the developer tools WebEngine.
+ splitterPointer->setSizes(QList<int>({1, 1}));
}
else
{