QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
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<
30 QgsDockableWidgetHelper>( tr( "Code Editor" ), this, QgsDockableWidgetHelper::sOwnerWindow, dockId, QStringList(), QgsDockableWidgetHelper::OpeningMode::RespectSetting, true, Qt::BottomDockWidgetArea, options );
31
32 mDockToggleButton = mDockableWidgetHelper->createDockUndockToolButton();
33 mDockToggleButton->setToolTip( tr( "Dock Code Editor" ) );
34 connect( mDockableWidgetHelper.get(), &QgsDockableWidgetHelper::closed, this, [this]() { close(); } );
35
36 connect( mDockableWidgetHelper.get(), &QgsDockableWidgetHelper::visibilityChanged, this, &QgsCodeEditorDockWidget::visibilityChanged );
37}
38
41
42void QgsCodeEditorDockWidget::setTitle( const QString &title )
43{
44 mDockableWidgetHelper->setWindowTitle( title );
45}
46
48{
49 return mDockToggleButton;
50}
51
53{
54 mDockableWidgetHelper->setDockObjectName( name );
55}
56
58{
59 return mDockableWidgetHelper->isUserVisible();
60}
61
63{
64 mDockableWidgetHelper->setUserVisible( visible );
65}
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...