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
5da2513
commit d270b4f
Showing
12 changed files
with
460 additions
and
10 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,80 @@ | ||
/** \ingroup gui | ||
* \class QgsFloatingWidget | ||
* A QWidget subclass for creating widgets which float outside of the normal Qt layout | ||
* system. Floating widgets use an "anchor widget" to determine how they are anchored | ||
* within their parent widget. | ||
* \note Added in version 2.16 | ||
*/ | ||
|
||
class QgsFloatingWidget : QWidget | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsfloatingwidget.h> | ||
%End | ||
|
||
public: | ||
|
||
//! Reference points for anchoring widget position | ||
enum AnchorPoint | ||
{ | ||
TopLeft, //!< Top-left of widget | ||
TopMiddle, //!< Top center of widget | ||
TopRight, //!< Top-right of widget | ||
MiddleLeft, //!< Middle left of widget | ||
Middle, //!< Middle of widget | ||
MiddleRight, //!< Middle right of widget | ||
BottomLeft, //!< Bottom-left of widget | ||
BottomMiddle, //!< Bottom center of widget | ||
BottomRight, //!< Bottom-right of widget | ||
}; | ||
|
||
/** Constructor for QgsFloatingWidget. | ||
* @param parent parent widget | ||
*/ | ||
QgsFloatingWidget( QWidget* parent /TransferThis/ = nullptr ); | ||
|
||
/** Sets the widget to "anchor" the floating widget to. The floating widget will be repositioned whenever the | ||
* anchor widget moves or is resized so that it maintains the same relative position to the anchor widget. | ||
* @param widget anchor widget. Both the floating widget and the anchor widget must share some common parent. | ||
* @see anchorWidget() | ||
*/ | ||
void setAnchorWidget( QWidget* widget ); | ||
|
||
/** Returns the widget that the floating widget is "anchored" tto. The floating widget will be repositioned whenever the | ||
* anchor widget moves or is resized so that it maintains the same relative position to the anchor widget. | ||
* @see setAnchorWidget() | ||
*/ | ||
QWidget* anchorWidget(); | ||
|
||
/** Returns the floating widget's anchor point, which corresponds to the point on the widget which should remain | ||
* fixed in the same relative position whenever the widget's parent is resized or moved. | ||
* @see setAnchorPoint() | ||
*/ | ||
AnchorPoint anchorPoint() const; | ||
|
||
/** Sets the floating widget's anchor point, which corresponds to the point on the widget which should remain | ||
* fixed in the same relative position whenever the widget's parent is resized or moved. | ||
* @param point anchor point | ||
* @see anchorPoint() | ||
*/ | ||
void setAnchorPoint( AnchorPoint point ); | ||
|
||
/** Returns the anchor widget's anchor point, which corresponds to the point on the anchor widget which | ||
* the floating widget should "attach" to. The floating widget should remain fixed in the same relative position | ||
* to this anchor widget whenever the widget's parent is resized or moved. | ||
* @see setAnchorWidgetPoint() | ||
*/ | ||
AnchorPoint anchorWidgetPoint() const; | ||
|
||
/** Returns the anchor widget's anchor point, which corresponds to the point on the anchor widget which | ||
* the floating widget should "attach" to. The floating widget should remain fixed in the same relative position | ||
* to this anchor widget whenever the widget's parent is resized or moved. | ||
* @see setAnchorWidgetPoint() | ||
*/ | ||
void setAnchorWidgetPoint( AnchorPoint point ); | ||
|
||
protected: | ||
void showEvent( QShowEvent* e ); | ||
virtual void paintEvent( QPaintEvent* e ); | ||
|
||
}; |
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
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
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
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.