QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgscodeeditordockwidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgscodeeditordockwidget.cpp
3 --------------------------------------
4 Date : March 2023
5 Copyright : (C) 2023 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17
19
20#include "moc_qgscodeeditordockwidget.cpp"
21
22QgsCodeEditorDockWidget::QgsCodeEditorDockWidget( const QString &dockId, bool usePersistentWidget )
23 : QWidget( nullptr )
24{
25 QgsDockableWidgetHelper::Options options = QgsDockableWidgetHelper::Option::RaiseTab;
26 if ( usePersistentWidget )
27 options.setFlag( QgsDockableWidgetHelper::Option::PermanentWidget );
28
29 mDockableWidgetHelper = std::make_unique<QgsDockableWidgetHelper>(
30 tr( "Code Editor" ),
31 this,
32 QgsDockableWidgetHelper::sOwnerWindow,
33 dockId,
34 QStringList(),
35 QgsDockableWidgetHelper::OpeningMode::RespectSetting,
36 true,
37 Qt::BottomDockWidgetArea,
38 options
39 );
40
41 mDockToggleButton = mDockableWidgetHelper->createDockUndockToolButton();
42 mDockToggleButton->setToolTip( tr( "Dock Code Editor" ) );
43 connect( mDockableWidgetHelper.get(), &QgsDockableWidgetHelper::closed, this, [this]() {
44 close();
45 } );
46
47 connect( mDockableWidgetHelper.get(), &QgsDockableWidgetHelper::visibilityChanged, this, &QgsCodeEditorDockWidget::visibilityChanged );
48}
49
53
54void QgsCodeEditorDockWidget::setTitle( const QString &title )
55{
56 mDockableWidgetHelper->setWindowTitle( title );
57}
58
60{
61 return mDockToggleButton;
62}
63
65{
66 mDockableWidgetHelper->setDockObjectName( name );
67}
68
70{
71 return mDockableWidgetHelper->isUserVisible();
72}
73
75{
76 mDockableWidgetHelper->setUserVisible( visible );
77}
void setDockObjectName(const QString &name)
Sets the object name of the dock widget.
void visibilityChanged(bool isVisible)
Emitted when the editor's visibility is changed.
void setTitle(const QString &title)
Sets the title to use for the code editor dock widget or window.
bool isUserVisible() const
Returns true if the widget is user visible.
QgsCodeEditorDockWidget(const QString &dockId=QString(), bool usePersistentWidget=false)
Constructor for QgsCodeEditorDockWidget, with the specified window geometry settings key.
void setUserVisible(bool visible)
Sets whether the editor is user visible.
QToolButton * dockToggleButton()
Returns the dock toggle button for the widget, which is used to toggle between dock or full window mo...