Use proper toolbar in documentation browser for consistency

And show frame for web view
This commit is contained in:
Nyall Dawson 2024-11-28 11:02:28 +10:00
parent 454f5ecab4
commit 18764a3452
2 changed files with 71 additions and 80 deletions

View File

@ -16,6 +16,7 @@
#include "qgsdocumentationpanelwidget.h"
#include "moc_qgsdocumentationpanelwidget.cpp"
#include "qgisapp.h"
#include "qgsguiutils.h"
#include <QVBoxLayout>
#ifdef HAVE_WEBENGINE
@ -33,6 +34,9 @@ QgsDocumentationPanelWidget::QgsDocumentationPanelWidget( QWidget *parent )
: QgsDevToolWidget( parent )
{
setupUi( this );
mToolbar->setIconSize( QgsGuiUtils::iconSize( true ) );
#ifdef HAVE_WEBENGINE
mWebView = new QWebEngineView( this );
#else
@ -41,10 +45,9 @@ QgsDocumentationPanelWidget::QgsDocumentationPanelWidget( QWidget *parent )
mWebViewContainer->layout()->addWidget( mWebView );
connect( mPyQgisHomeButton, &QToolButton::clicked, this, [] {QgisApp::instance()->showApiDocumentation( Qgis::DocumentationApi::PyQgis, Qgis::DocumentationBrowser::DeveloperToolsPanel );} );
connect( mQtHomeButton, &QToolButton::clicked, this, [] {QgisApp::instance()->showApiDocumentation( Qgis::DocumentationApi::Qt, Qgis::DocumentationBrowser::DeveloperToolsPanel );} );
connect( mOpenUrlButton, &QToolButton::clicked, this, [this] {QgisApp::instance()->openURL( mWebView->url().toString(), false );} );
connect( mActionPyQgis, &QAction::triggered, this, [] {QgisApp::instance()->showApiDocumentation( Qgis::DocumentationApi::PyQgis, Qgis::DocumentationBrowser::DeveloperToolsPanel );} );
connect( mActionQt, &QAction::triggered, this, [] {QgisApp::instance()->showApiDocumentation( Qgis::DocumentationApi::Qt, Qgis::DocumentationBrowser::DeveloperToolsPanel );} );
connect( mActionOpenInBrowser, &QAction::triggered, this, [this] {QgisApp::instance()->openURL( mWebView->url().toString(), false );} );
}
void QgsDocumentationPanelWidget::showUrl( const QUrl &url )

View File

@ -18,6 +18,9 @@
<normaloff>:/images/themes/default/mActionHelpContents.svg</normaloff>:/images/themes/default/mActionHelpContents.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
@ -31,90 +34,33 @@
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="mPyQgisHomeButton">
<property name="toolTip">
<string>PyQGIS API Documentation</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/icons/qgis_icon.svg</normaloff>:/images/icons/qgis_icon.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mQtHomeButton">
<property name="toolTip">
<string>Qt API Documentation</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mIconQt.svg</normaloff>:/images/themes/default/mIconQt.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="mOpenUrlButton">
<property name="toolTip">
<string>Open in Web Browser</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mIconWms.svg</normaloff>:/images/themes/default/mIconWms.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
<widget class="QToolBar" name="mToolbar">
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<addaction name="mActionPyQgis"/>
<addaction name="mActionQt"/>
<addaction name="separator"/>
<addaction name="mActionOpenInBrowser"/>
</widget>
</item>
<item>
<widget class="QWidget" name="mWebViewContainer" native="true">
<widget class="QFrame" name="mWebViewContainer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
@ -132,6 +78,48 @@
</widget>
</item>
</layout>
<action name="mActionPyQgis">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/icons/qgis_icon.svg</normaloff>:/images/icons/qgis_icon.svg</iconset>
</property>
<property name="text">
<string>PyQGIS API Documentation</string>
</property>
<property name="toolTip">
<string>PyQGIS API Documentation</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="mActionQt">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mIconQt.svg</normaloff>:/images/themes/default/mIconQt.svg</iconset>
</property>
<property name="text">
<string>Qt API Documentation</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="mActionOpenInBrowser">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mIconWms.svg</normaloff>:/images/themes/default/mIconWms.svg</iconset>
</property>
<property name="text">
<string>Open in Web Browser</string>
</property>
<property name="toolTip">
<string>Open in Web Browser</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
</widget>
<customwidgets>
<customwidget>