QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
23 #include <QButtonGroup>
26 : QDialog( parent, flags )
33 QButtonGroup *buttonGroup =
new QButtonGroup(
this );
34 buttonGroup->addButton( mUpperLeftRadioButton );
35 buttonGroup->addButton( mUpperMiddleRadioButton );
36 buttonGroup->addButton( mUpperRightRadioButton );
37 buttonGroup->addButton( mMiddleLeftRadioButton );
38 buttonGroup->addButton( mMiddleRadioButton );
39 buttonGroup->addButton( mMiddleRightRadioButton );
40 buttonGroup->addButton( mLowerLeftRadioButton );
41 buttonGroup->addButton( mLowerMiddleRadioButton );
42 buttonGroup->addButton( mLowerRightRadioButton );
43 buttonGroup->setExclusive(
true );
46 double lastWidth = settings.
value( QStringLiteral(
"LayoutDesigner/lastItemWidth" ), QStringLiteral(
"50" ) ).toDouble();
47 double lastHeight = settings.
value( QStringLiteral(
"LayoutDesigner/lastItemHeight" ), QStringLiteral(
"50" ) ).toDouble();
51 mPosUnitsComboBox->linkToWidget( mXPosSpin );
52 mPosUnitsComboBox->linkToWidget( mYPosSpin );
53 mSizeUnitsComboBox->linkToWidget( mWidthSpin );
54 mSizeUnitsComboBox->linkToWidget( mHeightSpin );
56 mLockAspectRatio->setWidthSpinBox( mWidthSpin );
57 mLockAspectRatio->setHeightSpinBox( mHeightSpin );
59 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsLayoutItemPropertiesDialog::showHelp );
71 mPageSpin->setValue(
page + 1 );
73 mXPosSpin->setValue( position.
x() );
74 mYPosSpin->setValue( position.
y() );
79 return QgsLayoutPoint( mXPosSpin->value(), mYPosSpin->value(), mPosUnitsComboBox->unit() );
84 return mPageSpin->value() - 1;
89 mWidthSpin->setValue( size.
width() );
90 mHeightSpin->setValue( size.
height() );
96 return QgsLayoutSize( mWidthSpin->value(), mHeightSpin->value(), mSizeUnitsComboBox->unit() );
101 if ( mUpperLeftRadioButton->isChecked() )
105 else if ( mUpperMiddleRadioButton->isChecked() )
109 else if ( mUpperRightRadioButton->isChecked() )
113 else if ( mMiddleLeftRadioButton->isChecked() )
117 else if ( mMiddleRadioButton->isChecked() )
121 else if ( mMiddleRightRadioButton->isChecked() )
125 else if ( mLowerLeftRadioButton->isChecked() )
129 else if ( mLowerMiddleRadioButton->isChecked() )
133 else if ( mLowerRightRadioButton->isChecked() )
145 mUpperLeftRadioButton->setChecked(
true );
149 mUpperMiddleRadioButton->setChecked(
true );
153 mUpperRightRadioButton->setChecked(
true );
157 mMiddleLeftRadioButton->setChecked(
true );
161 mMiddleRadioButton->setChecked(
true );
165 mMiddleRightRadioButton->setChecked(
true );
169 mLowerLeftRadioButton->setChecked(
true );
173 mLowerMiddleRadioButton->setChecked(
true );
177 mLowerRightRadioButton->setChecked(
true );
189 void QgsLayoutItemPropertiesDialog::showHelp()
191 QgsHelp::openHelp( QStringLiteral(
"print_composer/composer_items/composer_items_options.html#creating-a-layout-item" ) );
const QgsLayoutMeasurementConverter & measurementConverter() const
Returns the layout measurement converter to be used in the layout.
double width() const
Returns the width of the size.
QgsUnitTypes::LayoutUnit units() const
Returns the units for the size.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
@ MiddleRight
Middle right of item.
@ MiddleLeft
Middle left of item.
LayoutUnit
Layout measurement units.
double y() const
Returns y coordinate of point.
This class is a composition of two QSettings instances:
ReferencePoint
Fixed position reference point.
void setLayout(QgsLayout *layout)
Sets the layout associated with the dialog.
void setReferencePoint(QgsLayoutItem::ReferencePoint point)
Sets the item reference point defined to show in the dialog.
void setItemPosition(QgsLayoutPoint position)
Sets the item position to show in the dialog.
int page() const
Returns the page number for the new item.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
int pageNumberForPoint(QPointF point) const
Returns the page number corresponding to a point in the layout (in layout units).
QgsLayoutPoint itemPosition() const
Returns the current item position defined by the dialog.
QPointF positionOnPage(QPointF point) const
Returns the position within a page of a point in the layout (in layout units).
QgsLayoutRenderContext & renderContext()
Returns a reference to the layout's render context, which stores information relating to the current ...
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
QgsLayoutItem::ReferencePoint referencePoint() const
Returns the item reference point defined by the dialog.
QgsLayoutItemPropertiesDialog(QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
Constructor for QgsLayoutNewItemPropertiesDialog.
@ LowerRight
Lower right corner of item.
double height() const
Returns the height of the size.
@ LowerLeft
Lower left corner of item.
QgsLayoutPageCollection * pageCollection()
Returns a pointer to the layout's page collection, which stores and manages page items in the layout.
QgsLayoutSize itemSize() const
Returns the item size defined by the dialog.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
@ UpperRight
Upper right corner of item.
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layo...
void setItemSize(QgsLayoutSize size)
Sets the item size to show in the dialog.
@ UpperMiddle
Upper center of item.
@ LayoutMillimeters
Millimeters.
T enumValue(const QString &key, const T &defaultValue, const Section section=NoSection)
Returns the setting value for a setting based on an enum.
This class provides a method of storing points, consisting of an x and y coordinate,...
double convertToLayoutUnits(QgsLayoutMeasurement measurement) const
Converts a measurement into the layout's native units.
@ UpperLeft
Upper left corner of item.
double x() const
Returns x coordinate of point.
QgsLayoutMeasurement convertFromLayoutUnits(double length, QgsUnitTypes::LayoutUnit unit) const
Converts a length measurement from the layout's native units to a specified target unit.
QgsUnitTypes::LayoutUnit units() const
Returns the units for the point.
@ LowerMiddle
Lower center of item.