Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58e52ed
commit c332267
Showing
5 changed files
with
232 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/*************************************************************************** | ||
qgslayoutelevationprofilewidget.cpp | ||
---------------------- | ||
begin : January 2023 | ||
copyright : (C) 2023 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgslayoutelevationprofilewidget.h" | ||
#include "qgslayoutitemelevationprofile.h" | ||
#include "qgslayoutitemwidget.h" | ||
#include "qgslayoutitemregistry.h" | ||
|
||
QgsLayoutElevationProfileWidget::QgsLayoutElevationProfileWidget( QgsLayoutItemElevationProfile *profile ) | ||
: QgsLayoutItemBaseWidget( nullptr, profile ) | ||
, mProfile( profile ) | ||
{ | ||
Q_ASSERT( mProfile ); | ||
|
||
setupUi( this ); | ||
setPanelTitle( tr( "Elevation Profile Properties" ) ); | ||
|
||
//add widget for general composer item properties | ||
mItemPropertiesWidget = new QgsLayoutItemPropertiesWidget( this, profile ); | ||
mainLayout->addWidget( mItemPropertiesWidget ); | ||
} | ||
|
||
void QgsLayoutElevationProfileWidget::setMasterLayout( QgsMasterLayoutInterface *masterLayout ) | ||
{ | ||
if ( mItemPropertiesWidget ) | ||
mItemPropertiesWidget->setMasterLayout( masterLayout ); | ||
} | ||
|
||
QgsExpressionContext QgsLayoutElevationProfileWidget::createExpressionContext() const | ||
{ | ||
return mProfile->createExpressionContext(); | ||
} | ||
|
||
bool QgsLayoutElevationProfileWidget::setNewItem( QgsLayoutItem *item ) | ||
{ | ||
if ( item->type() != QgsLayoutItemRegistry::LayoutElevationProfile ) | ||
return false; | ||
|
||
if ( mProfile ) | ||
{ | ||
disconnect( mProfile, &QgsLayoutObject::changed, this, &QgsLayoutElevationProfileWidget::setGuiElementValues ); | ||
} | ||
|
||
mProfile = qobject_cast< QgsLayoutItemElevationProfile * >( item ); | ||
mItemPropertiesWidget->setItem( mProfile ); | ||
|
||
if ( mProfile ) | ||
{ | ||
connect( mProfile, &QgsLayoutObject::changed, this, &QgsLayoutElevationProfileWidget::setGuiElementValues ); | ||
} | ||
|
||
setGuiElementValues(); | ||
|
||
return true; | ||
} | ||
|
||
void QgsLayoutElevationProfileWidget::setGuiElementValues() | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/*************************************************************************** | ||
qgslayoutelevationprofilewidget.h | ||
---------------------- | ||
begin : January 2023 | ||
copyright : (C) 2023 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSLAYOUTELEVATIONPROFILEWIDGET_H | ||
#define QGSLAYOUTELEVATIONPROFILEWIDGET_H | ||
|
||
// We don't want to expose this in the public API | ||
#define SIP_NO_FILE | ||
|
||
#include "qgis_gui.h" | ||
#include "ui_qgslayoutelevationprofilewidgetbase.h" | ||
#include "qgslayoutitemwidget.h" | ||
#include "qgslayoutitemelevationprofile.h" | ||
#include <functional> | ||
#include <QPointer> | ||
|
||
/** | ||
* \ingroup gui | ||
* \brief A widget for layout elevation profile item settings. | ||
* | ||
* \note This class is not a part of public API | ||
* \since QGIS 3.30 | ||
*/ | ||
class GUI_EXPORT QgsLayoutElevationProfileWidget: public QgsLayoutItemBaseWidget, public QgsExpressionContextGenerator, private Ui::QgsLayoutElevationProfileWidgetBase | ||
{ | ||
Q_OBJECT | ||
public: | ||
//! constructor | ||
explicit QgsLayoutElevationProfileWidget( QgsLayoutItemElevationProfile *profile ); | ||
void setMasterLayout( QgsMasterLayoutInterface *masterLayout ) override; | ||
QgsExpressionContext createExpressionContext() const override; | ||
|
||
protected: | ||
|
||
bool setNewItem( QgsLayoutItem *item ) override; | ||
|
||
private slots: | ||
|
||
void setGuiElementValues(); | ||
|
||
private: | ||
|
||
QPointer< QgsLayoutItemElevationProfile > mProfile = nullptr; | ||
|
||
QgsLayoutItemPropertiesWidget *mItemPropertiesWidget = nullptr; | ||
}; | ||
|
||
#endif //QGSLAYOUTELEVATIONPROFILEWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>QgsLayoutElevationProfileWidgetBase</class> | ||
<widget class="QWidget" name="QgsLayoutElevationProfileWidgetBase"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>360</width> | ||
<height>705</height> | ||
</rect> | ||
</property> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Label Options</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="_2"> | ||
<property name="spacing"> | ||
<number>0</number> | ||
</property> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="QLabel" name="label"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="styleSheet"> | ||
<string notr="true">padding: 2px; font-weight: bold; background-color: rgb(200, 200, 200);</string> | ||
</property> | ||
<property name="text"> | ||
<string>Elevation Profile</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QgsScrollArea" name="scrollArea"> | ||
<property name="widgetResizable"> | ||
<bool>true</bool> | ||
</property> | ||
<widget class="QWidget" name="scrollAreaWidgetContents"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>358</width> | ||
<height>681</height> | ||
</rect> | ||
</property> | ||
<layout class="QVBoxLayout" name="mainLayout"/> | ||
</widget> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<layoutdefault spacing="6" margin="11"/> | ||
<customwidgets> | ||
<customwidget> | ||
<class>QgsScrollArea</class> | ||
<extends>QScrollArea</extends> | ||
<header>qgsscrollarea.h</header> | ||
<container>1</container> | ||
</customwidget> | ||
</customwidgets> | ||
<tabstops> | ||
<tabstop>scrollArea</tabstop> | ||
</tabstops> | ||
<resources/> | ||
<connections/> | ||
<buttongroups> | ||
<buttongroup name="buttonGroup_2"/> | ||
<buttongroup name="buttonGroup"/> | ||
</buttongroups> | ||
</ui> |