From: Soren Stoutner Date: Thu, 15 May 2025 22:03:01 +0000 (-0700) Subject: Open the developer console using half the available space. https://redmine.stoutner... X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=ccf0610a885ea434f02af733718c6a31b7277fb0;p=PrivacyBrowserPC.git Open the developer console using half the available space. https://redmine.stoutner.com/issues/1247 --- diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index fc01862..4f89cb3 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -43,7 +43,6 @@ #include #include #include -#include // Initialize the public static variables. QString TabWidget::webEngineDefaultUserAgent = QLatin1String(""); @@ -181,7 +180,7 @@ void TabWidget::addFirstTab() 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); @@ -215,7 +214,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const 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. @@ -243,7 +242,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // 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); @@ -257,7 +256,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // 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); @@ -268,7 +267,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // 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()) @@ -315,7 +314,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // 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; @@ -452,7 +451,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const // Plugins must be enabled for the PDF viewer to work. 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. @@ -1173,6 +1172,9 @@ void TabWidget::toggleDeveloperTools(const bool enabled) const // Display the developer tools. devToolsWebEngineViewPointer->setVisible(true); + + // Split the visible space equally between the main WebEngine and the developer tools WebEngine. + splitterPointer->setSizes(QList({1, 1})); } else { diff --git a/src/widgets/TabWidget.h b/src/widgets/TabWidget.h index 9bb2183..9b8dc5c 100644 --- a/src/widgets/TabWidget.h +++ b/src/widgets/TabWidget.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-3.0-or-later - * SPDX-FileCopyrightText: 2022-2024 Soren Stoutner + * SPDX-FileCopyrightText: 2022-2025 Soren Stoutner * * This file is part of Privacy Browser PC . * @@ -30,6 +30,7 @@ // Qt toolkit headers. #include #include +#include #include #include #include @@ -166,6 +167,7 @@ private: QTabWidget *qTabWidgetPointer; bool savingArchive; QString searchEngineUrl; + QSplitter *splitterPointer; UserAgentHelper *userAgentHelperPointer; bool wipingCurrentFindTextSelection = false; };