-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[needs-docs] Add a new item properties dialog
When adding a new item to a layout, if the user just does a single click of the mouse (vs a click and drag to set the new item position/size), then a dialog is shown asking to user for the new item size/position/reference point. This allows easy creation of items with an exact position/size and is common behavior in most proper DTP/illustration apps.
- Loading branch information
1 parent
b4f5025
commit cdec70b
Showing
7 changed files
with
571 additions
and
4 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,46 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/layout/qgslayoutnewitempropertiesdialog.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsLayoutNewItemPropertiesDialog : QDialog | ||
{ | ||
%Docstring | ||
A dialog for configuring properties like the size and position of new layout items. | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayoutnewitempropertiesdialog.h" | ||
%End | ||
public: | ||
|
||
QgsLayoutNewItemPropertiesDialog( QWidget *parent = 0, Qt::WindowFlags flags = 0 ); | ||
|
||
|
||
void setInitialItemPosition( QPointF position ); | ||
|
||
QgsLayoutPoint itemPosition() const; | ||
%Docstring | ||
:rtype: QgsLayoutPoint | ||
%End | ||
|
||
QgsLayoutSize itemSize() const; | ||
%Docstring | ||
:rtype: QgsLayoutSize | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/layout/qgslayoutnewitempropertiesdialog.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
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,44 @@ | ||
/*************************************************************************** | ||
qgslayoutnewitempropertiesdialog.cpp | ||
------------------------------------ | ||
Date : July 2017 | ||
Copyright : (C) 2017 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 "qgslayoutnewitempropertiesdialog.h" | ||
#include "qgssettings.h" | ||
|
||
QgsLayoutNewItemPropertiesDialog::QgsLayoutNewItemPropertiesDialog( QWidget *parent, Qt::WindowFlags flags ) | ||
: QDialog( parent, flags ) | ||
{ | ||
setupUi( this ); | ||
QgsSettings settings; | ||
double lastWidth = settings.value( QStringLiteral( "LayoutDesigner/lastItemWidth" ), QStringLiteral( "50" ) ).toDouble(); | ||
double lastHeight = settings.value( QStringLiteral( "LayoutDesigner/lastItemHeight" ), QStringLiteral( "50" ) ).toDouble(); | ||
mWidthSpin->setValue( lastWidth ); | ||
mHeightSpin->setValue( lastHeight ); | ||
} | ||
|
||
void QgsLayoutNewItemPropertiesDialog::setInitialItemPosition( QPointF position ) | ||
{ | ||
mXPosSpin->setValue( position.x() ); | ||
mYPosSpin->setValue( position.y() ); | ||
} | ||
|
||
QgsLayoutPoint QgsLayoutNewItemPropertiesDialog::itemPosition() const | ||
{ | ||
return QgsLayoutPoint( mXPosSpin->value(), mYPosSpin->value() ); | ||
} | ||
|
||
QgsLayoutSize QgsLayoutNewItemPropertiesDialog::itemSize() const | ||
{ | ||
return QgsLayoutSize( mWidthSpin->value(), mHeightSpin->value() ); | ||
} |
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,47 @@ | ||
/*************************************************************************** | ||
qgslayoutnewitempropertiesdialog.h | ||
---------------------------------- | ||
Date : July 2017 | ||
Copyright : (C) 2017 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 QGSLAYOUTNEWITEMPROPERTIESDIALOG_H | ||
#define QGSLAYOUTNEWITEMPROPERTIESDIALOG_H | ||
|
||
#include "qgis.h" | ||
#include "qgis_gui.h" | ||
#include "ui_qgslayoutnewitemproperties.h" | ||
|
||
#include "qgslayoutsize.h" | ||
#include "qgslayoutpoint.h" | ||
|
||
/** | ||
* \ingroup gui | ||
* \brief A dialog for configuring properties like the size and position of new layout items. | ||
*/ | ||
class GUI_EXPORT QgsLayoutNewItemPropertiesDialog : public QDialog, private Ui::QgsLayoutNewItemPropertiesDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
QgsLayoutNewItemPropertiesDialog( QWidget *parent = nullptr, Qt::WindowFlags flags = 0 ); | ||
|
||
|
||
void setInitialItemPosition( QPointF position ); | ||
|
||
QgsLayoutPoint itemPosition() const; | ||
|
||
QgsLayoutSize itemSize() const; | ||
|
||
}; | ||
|
||
#endif // QGSLAYOUTNEWITEMPROPERTIESDIALOG_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
Oops, something went wrong.