forked from quickshell/quickshell
		
	core/types: allow implicit conversion from point to box
This commit is contained in:
		
							parent
							
								
									58c3718287
								
							
						
					
					
						commit
						4b2e569e94
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <qdebug.h>
 | 
					#include <qdebug.h>
 | 
				
			||||||
#include <qnamespace.h>
 | 
					#include <qnamespace.h>
 | 
				
			||||||
 | 
					#include <qpoint.h>
 | 
				
			||||||
#include <qqmlintegration.h>
 | 
					#include <qqmlintegration.h>
 | 
				
			||||||
#include <qtmetamacros.h>
 | 
					#include <qtmetamacros.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +22,7 @@ public:
 | 
				
			||||||
	Box(qint32 x, qint32 y, qint32 w, qint32 h): x(x), y(y), w(w), h(h) {}
 | 
						Box(qint32 x, qint32 y, qint32 w, qint32 h): x(x), y(y), w(w), h(h) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Q_INVOKABLE Box(const QRect& rect): x(rect.x()), y(rect.y()), w(rect.width()), h(rect.height()) {}
 | 
						Q_INVOKABLE Box(const QRect& rect): x(rect.x()), y(rect.y()), w(rect.width()), h(rect.height()) {}
 | 
				
			||||||
 | 
						Q_INVOKABLE Box(const QPoint& rect): x(rect.x()), y(rect.y()) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Q_INVOKABLE Box(const QRectF& rect)
 | 
						Q_INVOKABLE Box(const QRectF& rect)
 | 
				
			||||||
	    : x(static_cast<qint32>(rect.x()))
 | 
						    : x(static_cast<qint32>(rect.x()))
 | 
				
			||||||
| 
						 | 
					@ -28,6 +30,10 @@ public:
 | 
				
			||||||
	    , w(static_cast<qint32>(rect.width()))
 | 
						    , w(static_cast<qint32>(rect.width()))
 | 
				
			||||||
	    , h(static_cast<qint32>(rect.height())) {}
 | 
						    , h(static_cast<qint32>(rect.height())) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Q_INVOKABLE Box(const QPointF& rect)
 | 
				
			||||||
 | 
						    : x(static_cast<qint32>(rect.x()))
 | 
				
			||||||
 | 
						    , y(static_cast<qint32>(rect.y())) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool operator==(const Box& other) const;
 | 
						bool operator==(const Box& other) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	qint32 x = 0;
 | 
						qint32 x = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue