Add QtGraphicsWidget
This commit is contained in:
parent
1af25740d4
commit
d690586766
8 changed files with 484 additions and 19 deletions
|
@ -51,7 +51,7 @@
|
|||
namespace ObjQt {
|
||||
|
||||
static OF_INLINE QPaintDevice *
|
||||
toQt(QtPaintDevice *paintDevice)
|
||||
toQt(id <QtPaintDevice> paintDevice)
|
||||
{
|
||||
return [paintDevice qPaintDevice];
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ STATIC_LIB_NOINST = ${QTWIDGETS_A}
|
|||
SRCS = QtAbstractButton.mm \
|
||||
QtAction.mm \
|
||||
QtApplication.mm \
|
||||
QtPushButton.mm \
|
||||
QtGraphicsWidget.mm \
|
||||
QtPushButton.mm \
|
||||
QtWidget.mm
|
||||
|
||||
include ../../buildsys.mk
|
||||
|
|
|
@ -131,7 +131,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)setIconSize: (of_dimension_t)iconSize
|
||||
{
|
||||
toQt(self)->setIconSize(toQt(iconSize));
|
||||
toQt(self)->setIconSize(toQt(iconSize).toSize());
|
||||
}
|
||||
|
||||
- (QKeySequence)shortcut
|
||||
|
|
|
@ -81,7 +81,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)setGlobalStrut: (of_dimension_t)globalStrut
|
||||
{
|
||||
toQt(self)->setGlobalStrut(toQt(globalStrut));
|
||||
toQt(self)->setGlobalStrut(toQt(globalStrut).toSize());
|
||||
}
|
||||
|
||||
- (int)keyboardInputInterval
|
||||
|
|
113
src/QtWidgets/QtGraphicsWidget.h
Normal file
113
src/QtWidgets/QtGraphicsWidget.h
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Jonathan Schleifer <js@heap.zone>
|
||||
*
|
||||
* https://heap.zone/git/objqt.git
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import <ObjFW/ObjFW.h>
|
||||
|
||||
#include <QGraphicsWidget>
|
||||
|
||||
#import "QtAction.h"
|
||||
#import "QtObject.h" // TODO: Remove
|
||||
|
||||
// TODO: Remove once QtGraphicsObject is bound
|
||||
@interface QtGraphicsObject: QtObject
|
||||
@end
|
||||
|
||||
@interface QtGraphicsWidget: QtGraphicsObject
|
||||
@property (readonly, nonatomic) QGraphicsWidget *qGraphicsWidget;
|
||||
@property (nonatomic) bool autoFillBackground;
|
||||
@property (nonatomic) Qt::FocusPolicy focusPolicy;
|
||||
@property (nonatomic) of_rectangle_t geometry;
|
||||
@property (nonatomic) QGraphicsLayout *layout;
|
||||
@property (nonatomic) Qt::LayoutDirection layoutDirection;
|
||||
@property (nonatomic) of_dimension_t maximumSize;
|
||||
@property (nonatomic) of_dimension_t minimumSize;
|
||||
@property (nonatomic) QPalette palette;
|
||||
@property (nonatomic) of_dimension_t preferredSize;
|
||||
@property (readonly, nonatomic) of_dimension_t size;
|
||||
@property (nonatomic) QSizePolicy sizePolicy;
|
||||
@property (nonatomic) Qt::WindowFlags windowFlags;
|
||||
@property (copy, nonatomic) OFString *windowTitle;
|
||||
@property (readonly, nonatomic) OFArray OF_GENERIC(QtAction *) *actions;
|
||||
@property (readonly, nonatomic) bool isActiveWindow;
|
||||
@property (nonatomic) QStyle *style;
|
||||
@property (readonly, nonatomic) of_rectangle_t windowFrameGeometry;
|
||||
@property (readonly, nonatomic) of_rectangle_t windowFrameRect;
|
||||
|
||||
- initWithQObject: (QObject *)qObject OF_UNAVAILABLE;
|
||||
- initWithQGraphicsWidget: (QGraphicsWidget *)qGraphicsWidget
|
||||
OF_DESIGNATED_INITIALIZER;
|
||||
- (void)addAction: (QtAction *)action;
|
||||
- (void)addActions: (OFArray OF_GENERIC(QtAction *) *)actions;
|
||||
- (void)adjustSize;
|
||||
- (QtGraphicsWidget *)focusWidget;
|
||||
- (void)getWindowFrameMarginsWithLeft: (qreal *)left
|
||||
top: (qreal *)top
|
||||
right: (qreal *)right
|
||||
bottom: (qreal *)bottom;
|
||||
- (void)setWindowFrameMarginsWithLeft: (qreal)left
|
||||
top: (qreal)top
|
||||
right: (qreal)right
|
||||
bottom: (qreal)bottom;
|
||||
- (void)insertAction: (QtAction *)action
|
||||
before: (QtAction *)before;
|
||||
- (void)insertActions: (OFArray OF_GENERIC(QtAction *) *)actions
|
||||
before: (QtAction *)before;
|
||||
- (void)paintWindowFrameWithPainter: (QPainter *)painter
|
||||
option: (const QStyleOptionGraphicsItem *)option
|
||||
widget: (QtWidget *)widget;
|
||||
- (void)releaseShortcut: (int)ID;
|
||||
- (void)removeAction: (QtAction *)action;
|
||||
- (void)resizeTo: (of_dimension_t)size;
|
||||
- (void)setAttribute: (Qt::WidgetAttribute)attribute
|
||||
to: (bool)on;
|
||||
- (void)setContentsMarginsWithLeft: (qreal)left
|
||||
top: (qreal)top
|
||||
right: (qreal)right
|
||||
bottom: (qreal)bottom;
|
||||
- (void)setAutoRepeat: (bool)enabled
|
||||
forShortcut: (int)ID;
|
||||
- (void)setEnabled: (bool)enabled
|
||||
forShortcut: (int)ID;
|
||||
- (bool)testAttribute: (Qt::WidgetAttribute)attribute;
|
||||
- (void)unsetLayoutDirection;
|
||||
- (void)unsetWindowFrameMargins;
|
||||
@end
|
||||
|
||||
namespace ObjQt {
|
||||
|
||||
static OF_INLINE QtGraphicsWidget *
|
||||
toOF(QGraphicsWidget *qGraphicsWidget)
|
||||
{
|
||||
if (qGraphicsWidget == NULL)
|
||||
return nil;
|
||||
|
||||
return [[[QtGraphicsWidget alloc]
|
||||
initWithQGraphicsWidget: qGraphicsWidget] autorelease];
|
||||
}
|
||||
|
||||
static OF_INLINE QGraphicsWidget *
|
||||
toQt(QtGraphicsWidget *graphicsWidget)
|
||||
{
|
||||
return [graphicsWidget qGraphicsWidget];
|
||||
}
|
||||
|
||||
}
|
338
src/QtWidgets/QtGraphicsWidget.mm
Normal file
338
src/QtWidgets/QtGraphicsWidget.mm
Normal file
|
@ -0,0 +1,338 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Jonathan Schleifer <js@heap.zone>
|
||||
*
|
||||
* https://heap.zone/git/objqt.git
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "QtGraphicsWidget.h"
|
||||
#import "OFString+QString.h"
|
||||
|
||||
#import "helpers.h"
|
||||
|
||||
using ObjQt::toOF;
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtGraphicsObject
|
||||
@end
|
||||
|
||||
@implementation QtGraphicsWidget
|
||||
|
||||
- initWithQObject: (QObject *)qObject
|
||||
{
|
||||
OF_INVALID_INIT_METHOD
|
||||
}
|
||||
|
||||
- initWithQGraphicsWidget: (QGraphicsWidget *)qGraphicsWidget
|
||||
{
|
||||
return [super initWithQObject: qGraphicsWidget];
|
||||
}
|
||||
|
||||
- (QGraphicsWidget *)qGraphicsWidget
|
||||
{
|
||||
return dynamic_cast<QGraphicsWidget *>([self qObject]);
|
||||
}
|
||||
|
||||
- (bool)autoFillBackground
|
||||
{
|
||||
return toQt(self)->autoFillBackground();
|
||||
}
|
||||
|
||||
- (void)setAutoFillBackground: (bool)autoFillBackground
|
||||
{
|
||||
toQt(self)->setAutoFillBackground(autoFillBackground);
|
||||
}
|
||||
|
||||
- (Qt::FocusPolicy)focusPolicy
|
||||
{
|
||||
return toQt(self)->focusPolicy();
|
||||
}
|
||||
|
||||
- (void)setFocusPolicy: (Qt::FocusPolicy)focusPolicy
|
||||
{
|
||||
toQt(self)->setFocusPolicy(focusPolicy);
|
||||
}
|
||||
|
||||
- (of_rectangle_t)geometry
|
||||
{
|
||||
return toOF(toQt(self)->geometry());
|
||||
}
|
||||
|
||||
- (void)setGeometry: (of_rectangle_t)geometry
|
||||
{
|
||||
toQt(self)->setGeometry(toQt(geometry));
|
||||
}
|
||||
|
||||
- (QGraphicsLayout *)layout
|
||||
{
|
||||
return toQt(self)->layout();
|
||||
}
|
||||
|
||||
- (void)setLayout: (QGraphicsLayout *)layout
|
||||
{
|
||||
toQt(self)->setLayout(layout);
|
||||
}
|
||||
|
||||
- (Qt::LayoutDirection)layoutDirection
|
||||
{
|
||||
return toQt(self)->layoutDirection();
|
||||
}
|
||||
|
||||
- (void)setLayoutDirection: (Qt::LayoutDirection)layoutDirection
|
||||
{
|
||||
toQt(self)->setLayoutDirection(layoutDirection);
|
||||
}
|
||||
|
||||
- (of_dimension_t)maximumSize
|
||||
{
|
||||
return toOF(toQt(self)->maximumSize());
|
||||
}
|
||||
|
||||
- (void)setMaximumSize: (of_dimension_t)maximumSize
|
||||
{
|
||||
toQt(self)->setMaximumSize(toQt(maximumSize));
|
||||
}
|
||||
|
||||
- (of_dimension_t)minimumSize
|
||||
{
|
||||
return toOF(toQt(self)->minimumSize());
|
||||
}
|
||||
|
||||
- (void)setMinimumSize: (of_dimension_t)minimumSize
|
||||
{
|
||||
toQt(self)->setMinimumSize(toQt(minimumSize));
|
||||
}
|
||||
|
||||
- (QPalette)palette
|
||||
{
|
||||
return toQt(self)->palette();
|
||||
}
|
||||
|
||||
- (void)setPalette: (QPalette)palette
|
||||
{
|
||||
toQt(self)->setPalette(palette);
|
||||
}
|
||||
|
||||
- (of_dimension_t)preferredSize
|
||||
{
|
||||
return toOF(toQt(self)->preferredSize());
|
||||
}
|
||||
|
||||
- (void)setPreferredSize: (of_dimension_t)preferredSize
|
||||
{
|
||||
toQt(self)->setPreferredSize(toQt(preferredSize));
|
||||
}
|
||||
|
||||
- (of_dimension_t)size
|
||||
{
|
||||
return toOF(toQt(self)->size());
|
||||
}
|
||||
|
||||
- (QSizePolicy)sizePolicy
|
||||
{
|
||||
return toQt(self)->sizePolicy();
|
||||
}
|
||||
|
||||
- (void)setSizePolicy: (QSizePolicy)sizePolicy
|
||||
{
|
||||
toQt(self)->setSizePolicy(sizePolicy);
|
||||
}
|
||||
|
||||
- (Qt::WindowFlags)windowFlags
|
||||
{
|
||||
return toQt(self)->windowFlags();
|
||||
}
|
||||
|
||||
- (void)setWindowFlags: (Qt::WindowFlags)windowFlags
|
||||
{
|
||||
toQt(self)->setWindowFlags(windowFlags);
|
||||
}
|
||||
|
||||
- (OFString *)windowTitle
|
||||
{
|
||||
return toOF(toQt(self)->windowTitle());
|
||||
}
|
||||
|
||||
- (void)setWindowTitle: (OFString *)windowTitle
|
||||
{
|
||||
toQt(self)->setWindowTitle(toQt(windowTitle));
|
||||
}
|
||||
|
||||
- (OFArray OF_GENERIC(QtAction *) *)actions
|
||||
{
|
||||
const QList<QAction *> &actions = toQt(self)->actions();
|
||||
OFMutableArray *ret =
|
||||
[OFMutableArray arrayWithCapacity: actions.count()];
|
||||
void *pool = objc_autoreleasePoolPush();
|
||||
|
||||
for (QAction *action: actions)
|
||||
[ret addObject: toOF(action)];
|
||||
|
||||
[ret makeImmutable];
|
||||
|
||||
objc_autoreleasePoolPop(pool);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (bool)isActiveWindow
|
||||
{
|
||||
return toQt(self)->isActiveWindow();
|
||||
}
|
||||
|
||||
- (QStyle *)style
|
||||
{
|
||||
return toQt(self)->style();
|
||||
}
|
||||
|
||||
- (void)setStyle: (QStyle *)style
|
||||
{
|
||||
toQt(self)->setStyle(style);
|
||||
}
|
||||
|
||||
- (of_rectangle_t)windowFrameGeometry
|
||||
{
|
||||
return toOF(toQt(self)->windowFrameGeometry());
|
||||
}
|
||||
|
||||
- (of_rectangle_t)windowFrameRect
|
||||
{
|
||||
return toOF(toQt(self)->windowFrameRect());
|
||||
}
|
||||
|
||||
- (void)addAction: (QtAction *)action
|
||||
{
|
||||
toQt(self)->addAction(toQt(action));
|
||||
}
|
||||
|
||||
- (void)addActions: (OFArray OF_GENERIC(QtAction *) *)actions
|
||||
{
|
||||
QList<QAction *> list;
|
||||
|
||||
for (QtAction *action in actions)
|
||||
list.append(toQt(action));
|
||||
|
||||
toQt(self)->addActions(list);
|
||||
}
|
||||
|
||||
- (void)adjustSize
|
||||
{
|
||||
toQt(self)->adjustSize();
|
||||
}
|
||||
|
||||
- (QtGraphicsWidget *)focusWidget
|
||||
{
|
||||
return toOF(toQt(self)->focusWidget());
|
||||
}
|
||||
|
||||
- (void)getWindowFrameMarginsWithLeft: (qreal *)left
|
||||
top: (qreal *)top
|
||||
right: (qreal *)right
|
||||
bottom: (qreal *)bottom
|
||||
{
|
||||
toQt(self)->getWindowFrameMargins(left, top, right, bottom);
|
||||
}
|
||||
|
||||
- (void)setWindowFrameMarginsWithLeft: (qreal)left
|
||||
top: (qreal)top
|
||||
right: (qreal)right
|
||||
bottom: (qreal)bottom
|
||||
{
|
||||
toQt(self)->setWindowFrameMargins(left, top, right, bottom);
|
||||
}
|
||||
|
||||
- (void)insertAction: (QtAction *)action
|
||||
before: (QtAction *)before
|
||||
{
|
||||
toQt(self)->insertAction(toQt(before), toQt(action));
|
||||
}
|
||||
|
||||
- (void)insertActions: (OFArray OF_GENERIC(QtAction *) *)actions
|
||||
before: (QtAction *)before
|
||||
{
|
||||
QList<QAction *> list;
|
||||
|
||||
for (QtAction *action in actions)
|
||||
list.append(toQt(action));
|
||||
|
||||
toQt(self)->insertActions(toQt(before), list);
|
||||
}
|
||||
|
||||
- (void)paintWindowFrameWithPainter: (QPainter *)painter
|
||||
option: (const QStyleOptionGraphicsItem *)option
|
||||
widget: (QtWidget *)widget
|
||||
{
|
||||
toQt(self)->paintWindowFrame(painter, option, toQt(widget));
|
||||
}
|
||||
|
||||
- (void)releaseShortcut: (int)ID
|
||||
{
|
||||
toQt(self)->releaseShortcut(ID);
|
||||
}
|
||||
|
||||
- (void)removeAction: (QtAction *)action
|
||||
{
|
||||
toQt(self)->removeAction(toQt(action));
|
||||
}
|
||||
|
||||
- (void)resizeTo: (of_dimension_t)size
|
||||
{
|
||||
toQt(self)->resize(toQt(size));
|
||||
}
|
||||
|
||||
- (void)setAttribute: (Qt::WidgetAttribute)attribute
|
||||
to: (bool)on
|
||||
{
|
||||
toQt(self)->setAttribute(attribute, on);
|
||||
}
|
||||
|
||||
- (void)setContentsMarginsWithLeft: (qreal)left
|
||||
top: (qreal)top
|
||||
right: (qreal)right
|
||||
bottom: (qreal)bottom
|
||||
{
|
||||
toQt(self)->setContentsMargins(left, top, right, bottom);
|
||||
}
|
||||
|
||||
- (void)setAutoRepeat: (bool)enabled
|
||||
forShortcut: (int)ID
|
||||
{
|
||||
toQt(self)->setShortcutAutoRepeat(ID, enabled);
|
||||
}
|
||||
|
||||
- (void)setEnabled: (bool)enabled
|
||||
forShortcut: (int)ID
|
||||
{
|
||||
toQt(self)->setShortcutEnabled(ID, enabled);
|
||||
}
|
||||
|
||||
- (bool)testAttribute: (Qt::WidgetAttribute)attribute
|
||||
{
|
||||
return toQt(self)->testAttribute(attribute);
|
||||
}
|
||||
|
||||
- (void)unsetLayoutDirection
|
||||
{
|
||||
toQt(self)->unsetLayoutDirection();
|
||||
}
|
||||
|
||||
- (void)unsetWindowFrameMargins
|
||||
{
|
||||
toQt(self)->unsetWindowFrameMargins();
|
||||
}
|
||||
@end
|
|
@ -102,7 +102,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)setBaseSize: (of_dimension_t)baseSize
|
||||
{
|
||||
toQt(self)->setBaseSize(toQt(baseSize));
|
||||
toQt(self)->setBaseSize(toQt(baseSize).toSize());
|
||||
}
|
||||
|
||||
- (of_rectangle_t)childrenRect
|
||||
|
@ -197,7 +197,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)setGeometry: (of_rectangle_t)geometry
|
||||
{
|
||||
toQt(self)->setGeometry(toQt(geometry));
|
||||
toQt(self)->setGeometry(toQt(geometry).toRect());
|
||||
}
|
||||
|
||||
- (int)height
|
||||
|
@ -272,7 +272,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)setMaximumSize: (of_dimension_t)maximumSize
|
||||
{
|
||||
toQt(self)->setMaximumSize(toQt(maximumSize));
|
||||
toQt(self)->setMaximumSize(toQt(maximumSize).toSize());
|
||||
}
|
||||
|
||||
- (int)maximumWidth
|
||||
|
@ -307,7 +307,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)setMinimumSize: (of_dimension_t)minimumSize
|
||||
{
|
||||
toQt(self)->setMinimumSize(toQt(minimumSize));
|
||||
toQt(self)->setMinimumSize(toQt(minimumSize).toSize());
|
||||
}
|
||||
|
||||
- (of_dimension_t)minimumSizeHint
|
||||
|
@ -377,7 +377,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)resizeTo: (of_dimension_t)size
|
||||
{
|
||||
toQt(self)->resize(toQt(size));
|
||||
toQt(self)->resize(toQt(size).toSize());
|
||||
}
|
||||
|
||||
- (of_dimension_t)sizeHint
|
||||
|
@ -392,7 +392,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)setSizeIncrement: (of_dimension_t)sizeIncrement
|
||||
{
|
||||
toQt(self)->setSizeIncrement(toQt(sizeIncrement));
|
||||
toQt(self)->setSizeIncrement(toQt(sizeIncrement).toSize());
|
||||
}
|
||||
|
||||
- (QSizePolicy)sizePolicy
|
||||
|
@ -674,7 +674,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (QPixmap)grabRectangle: (of_rectangle_t)rectangle
|
||||
{
|
||||
return toQt(self)->grab(toQt(rectangle));
|
||||
return toQt(self)->grab(toQt(rectangle).toRect());
|
||||
}
|
||||
|
||||
- (void)grabGesture: (Qt::GestureType)gesture
|
||||
|
@ -905,7 +905,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)repaintInRectangle: (of_rectangle_t)rect
|
||||
{
|
||||
toQt(self)->repaint(toQt(rect));
|
||||
toQt(self)->repaint(toQt(rect).toRect());
|
||||
}
|
||||
|
||||
- (void)repaintInRegion: (const QRegion &)region
|
||||
|
@ -933,7 +933,7 @@ using ObjQt::toQt;
|
|||
down: (int)dy
|
||||
inRectangle: (of_rectangle_t)rect
|
||||
{
|
||||
toQt(self)->scroll(dx, dy, toQt(rect));
|
||||
toQt(self)->scroll(dx, dy, toQt(rect).toRect());
|
||||
}
|
||||
|
||||
- (void)setAttribute: (Qt::WidgetAttribute)attribute
|
||||
|
@ -956,7 +956,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)setFixedSize: (of_dimension_t)size
|
||||
{
|
||||
toQt(self)->setFixedSize(toQt(size));
|
||||
toQt(self)->setFixedSize(toQt(size).toSize());
|
||||
}
|
||||
|
||||
- (void)setFixedWidth: (int)width
|
||||
|
@ -1064,7 +1064,7 @@ using ObjQt::toQt;
|
|||
|
||||
- (void)updateInRectangle: (of_rectangle_t)rect
|
||||
{
|
||||
toQt(self)->update(toQt(rect));
|
||||
toQt(self)->update(toQt(rect).toRect());
|
||||
}
|
||||
|
||||
- (void)updateInRegion: (const QRegion &)region
|
||||
|
|
|
@ -52,10 +52,16 @@ toOF(const QSize &qSize)
|
|||
return of_dimension(qSize.width(), qSize.height());
|
||||
}
|
||||
|
||||
static OF_INLINE QSize
|
||||
static OF_INLINE of_dimension_t
|
||||
toOF(const QSizeF &qSizeF)
|
||||
{
|
||||
return of_dimension(qSizeF.width(), qSizeF.height());
|
||||
}
|
||||
|
||||
static OF_INLINE QSizeF
|
||||
toQt(const of_dimension_t &dimension)
|
||||
{
|
||||
return QSize(dimension.width, dimension.height);
|
||||
return QSizeF(dimension.width, dimension.height);
|
||||
}
|
||||
|
||||
static OF_INLINE of_rectangle_t
|
||||
|
@ -65,10 +71,17 @@ toOF(const QRect &qRect)
|
|||
qRect.width(), qRect.height());
|
||||
}
|
||||
|
||||
static OF_INLINE QRect
|
||||
static OF_INLINE of_rectangle_t
|
||||
toOF(const QRectF &qRectF)
|
||||
{
|
||||
return of_rectangle(qRectF.x(), qRectF.y(),
|
||||
qRectF.width(), qRectF.height());
|
||||
}
|
||||
|
||||
static OF_INLINE QRectF
|
||||
toQt(const of_rectangle_t &rectangle)
|
||||
{
|
||||
return QRect(rectangle.origin.x, rectangle.origin.y,
|
||||
return QRectF(rectangle.origin.x, rectangle.origin.y,
|
||||
rectangle.size.width, rectangle.size.height);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue