QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
18
19QgsCodeEditorDockWidget::QgsCodeEditorDockWidget( const QString &windowGeometrySettingsKey, bool usePersistentWidget )
20 : QWidget( nullptr )
21{
22 mDockableWidgetHelper = new QgsDockableWidgetHelper( true, tr( "Code Editor" ),
23 this, QgsDockableWidgetHelper::sOwnerWindow, Qt::BottomDockWidgetArea, QStringList(), true, windowGeometrySettingsKey, usePersistentWidget );
24
25 mDockToggleButton = mDockableWidgetHelper->createDockUndockToolButton();
26 mDockToggleButton->setToolTip( tr( "Dock Code Editor" ) );
27 connect( mDockableWidgetHelper, &QgsDockableWidgetHelper::closed, this, [ = ]()
28 {
29 close();
30 } );
31
32 connect( mDockableWidgetHelper, &QgsDockableWidgetHelper::visibilityChanged, this, &QgsCodeEditorDockWidget::visibilityChanged );
33}
34
36{
37 delete mDockableWidgetHelper;
38}
39
40void QgsCodeEditorDockWidget::setTitle( const QString &title )
41{
42 mDockableWidgetHelper->setWindowTitle( title );
43}
44
46{
47 return mDockToggleButton;
48}
49
51{
52 mDockableWidgetHelper->setDockObjectName( name );
53}
54
56{
57 return mDockableWidgetHelper->isUserVisible();
58}
59
61{
62 mDockableWidgetHelper->setUserVisible( visible );
63}
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.
QgsCodeEditorDockWidget(const QString &windowGeometrySettingsKey=QString(), bool usePersistentWidget=false)
Constructor for QgsCodeEditorDockWidget, with the specified window geometry settings key.
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.
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...