Overview
Comment: | Add QtPaintDevice and initial QtWidget |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
25466afe90488ba55adaf8447f4b216a |
User & Date: | js 2017-04-02 23:00:47 |
Context
2017-04-05
| ||
21:19 | Add toOF() / toQt() for easy conversion check-in: e9fd43644a user: js tags: trunk | |
2017-04-02
| ||
23:00 | Add QtPaintDevice and initial QtWidget check-in: 25466afe90 user: js tags: trunk | |
20:51 | Initial commit check-in: 9463212568 user: js tags: trunk | |
Changes
Changes to ObjQt.pro.
︙ | ︙ | |||
13 14 15 16 17 18 19 | common/QtOwnershipManaging.h \ QtCore/QtChildEvent.h \ QtCore/QtCoreApplication.h \ QtCore/QtEvent.h \ QtCore/QtObject.h \ QtCore/QtThread.h \ QtGui/QtGuiApplication.h \ | > | > > | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | common/QtOwnershipManaging.h \ QtCore/QtChildEvent.h \ QtCore/QtCoreApplication.h \ QtCore/QtEvent.h \ QtCore/QtObject.h \ QtCore/QtThread.h \ QtGui/QtGuiApplication.h \ QtGui/QtPaintDevice.h \ QtWidgets/QtApplication.h \ QtWidgets/QtWidget.h SOURCES += QtCore/QtChildEvent.mm \ QtCore/QtCoreApplication.mm \ QtCore/QtEvent.mm \ QtCore/QtObject.mm \ QtCore/QtThread.mm \ QtGui/QtGuiApplication.mm \ QtGui/QtPaintDevice.mm \ QtWidgets/QtApplication.mm \ QtWidgets/QtWidget.mm QMAKE_CXXFLAGS += $$system("objfw-config --cppflags --objcflags --cxxflags") QMAKE_CXXFLAGS_WARN_ON = -Wall \ -Werror \ -Wsemicolon-before-method-body \ -Wobjc-missing-property-synthesis LIBS += $$system("objfw-config --ldflags --libs") |
Added QtGui/QtPaintDevice.h.
> > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #import <ObjFW/ObjFW.h> #include <QPaintDevice> @protocol QtPaintDevice - (QPaintDevice*)qPaintDevice; - (int)colorCount; - (int)depth; - (int)devicePixelRatio; - (double)devicePixelRatioF; - (int)height; - (int)heightMM; - (int)logicalDPIX; - (int)logicalDPIY; - (QPaintEngine*)paintEngine; - (bool)paintingActive; - (int)physicalDPIX; - (int)physicalDPIY; - (int)width; - (int)widthMM; @end @interface QtPaintDevice: OFObject <QtPaintDevice> @property (readonly) QObject *qObject; @end |
Added QtGui/QtPaintDevice.mm.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #import "QtPaintDevice.h" #include <QObject> @implementation QtPaintDevice @dynamic qObject; - (QPaintDevice*)qPaintDevice { return dynamic_cast<QPaintDevice*>([self qObject]); } - (int)colorCount { return [self qPaintDevice]->colorCount(); } - (int)depth { return [self qPaintDevice]->depth(); } - (int)devicePixelRatio { return [self qPaintDevice]->devicePixelRatio(); } - (double)devicePixelRatioF { return [self qPaintDevice]->devicePixelRatioF(); } - (int)height { return [self qPaintDevice]->height(); } - (int)heightMM { return [self qPaintDevice]->heightMM(); } - (int)logicalDPIX { return [self qPaintDevice]->logicalDpiX(); } - (int)logicalDPIY { return [self qPaintDevice]->logicalDpiY(); } - (QPaintEngine*)paintEngine { return [self qPaintDevice]->paintEngine(); } - (bool)paintingActive { return [self qPaintDevice]->paintingActive(); } - (int)physicalDPIX { return [self qPaintDevice]->physicalDpiX(); } - (int)physicalDPIY { return [self qPaintDevice]->physicalDpiY(); } - (int)width { return [self qPaintDevice]->width(); } - (int)widthMM { return [self qPaintDevice]->widthMM(); } @end |
Changes to QtWidgets/QtApplication.h.
1 2 3 4 5 6 7 8 9 | #import "QtGuiApplication.h" #include <QApplication> @interface QtApplication: QtGuiApplication @property (readonly) QApplication *qApplication; @property bool autoSipEnabled; @property int cursorFlashTime; @property int doubleClickInterval; | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #import "QtGuiApplication.h" #include <QApplication> @interface QtApplication: QtGuiApplication @property (readonly) QApplication *qApplication; @property bool autoSipEnabled; @property int cursorFlashTime; @property int doubleClickInterval; @property of_dimension_t globalStrut; @property int keyboardInputInterval; @property int startDragDistance; @property int startDragTime; @property (copy) OFString *styleSheet; @property int wheelScrollLines; - initWithQApplication: (QApplication*)qApplication; |
︙ | ︙ |
Changes to QtWidgets/QtApplication.mm.
︙ | ︙ | |||
44 45 46 47 48 49 50 | } - (void)setDoubleClickInterval: (int)doubleClickInterval { [self qApplication]->setDoubleClickInterval(doubleClickInterval); } | | | | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | } - (void)setDoubleClickInterval: (int)doubleClickInterval { [self qApplication]->setDoubleClickInterval(doubleClickInterval); } - (of_dimension_t)globalStrut { return QToOFDimension([self qApplication]->globalStrut()); } - (void)setGlobalStrut: (of_dimension_t)globalStrut { [self qApplication]->setGlobalStrut(OFToQSize(globalStrut)); } - (int)keyboardInputInterval { return [self qApplication]->keyboardInputInterval(); } |
︙ | ︙ |
Added QtWidgets/QtWidget.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | #import "QtObject.h" #import "QtPaintDevice.h" #include <QWidget> @interface QtWidget: QtObject @property (readonly) QWidget *qWidget; @property bool acceptDrops; @property (copy) OFString *accessibleDescription; @property (copy) OFString *accessibleName; @property bool autoFillBackground; @property of_dimension_t baseSize; @property (readonly) of_rectangle_t childrenRect; @property (readonly) QRegion childrenRegion; @property Qt::ContextMenuPolicy contextMenuPolicy; @property QCursor cursor; @property (getter=isEnabled) bool enabled; @property (readonly, getter=hasFocus) bool focus; @property Qt::FocusPolicy focusPolicy; @property const QFont &font; @property (readonly) of_rectangle_t frameGeometry; @property (readonly) of_dimension_t frameSize; @property (readonly, getter=isFullScreen) bool fullScreen; @property of_rectangle_t geometry; @property (readonly) int height; @property Qt::InputMethodHints inputMethodHints; @property (readonly) bool isActiveWindow; @property Qt::LayoutDirection layoutDirection; @property QLocale locale; @property (readonly, getter=isMaximized) bool maximized; @property int maximumHeight; @property of_dimension_t maximumSize; @property int maximumWidth; @property (readonly, getter=isMinimized) bool minimized; @property int minimumHeight; @property of_dimension_t minimumSize; @property (readonly) of_dimension_t minimumSizeHint; @property int minimumWidth; @property (readonly, getter=isModal) bool modal; @property (getter=hasMouseTracking) bool mouseTracking; @property (readonly) of_rectangle_t normalGeometry; @property const QPalette &palette; @property (setter=moveToPosition:) of_point_t pos; @property (readonly) of_rectangle_t rect; @property (setter=resizeTo:) of_dimension_t size; @property (readonly) of_dimension_t sizeHint; @property of_dimension_t sizeIncrement; @property QSizePolicy sizePolicy; @property (copy) OFString *statusTip; @property (copy) OFString *styleSheet; @property (copy) OFString *toolTip; @property int toolTipDuration; @property bool updatesEnabled; @property (getter=isVisible) bool visible; @property (copy) OFString *whatsThis; @property (readonly) int width; @property (copy) OFString *windowFilePath; @property Qt::WindowFlags windowFlags; @property QIcon windowIcon; @property Qt::WindowModality windowModality; @property (getter=isWindowModified) bool windowModified; @property double windowOpacity; @property (copy) OFString *windowTitle; @property (readonly) int x; @property (readonly) int y; // TODO: Member functions - initWithQWidget: (QWidget*)qWidget; - (void)unsetCursor; - (void)unsetLayoutDirection; - (void)unsetLocale; @end @interface QtWidget (QtPaintDevice) <QtPaintDevice> @end |
Added QtWidgets/QtWidget.mm.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | #import "QtWidget.h" #import "helpers.h" #include <QIcon> #include <QLocale> @implementation QtWidget + (void)initialize { if (self == [QtWidget class]) [self inheritMethodsFromClass: [QtPaintDevice class]]; } - initWithQWidget: (QWidget*)qWidget { return [super initWithQObject: qWidget]; } - (QWidget*)qWidget { return qobject_cast<QWidget*>(_qObject); } - (bool)acceptDrops { return [self qWidget]->acceptDrops(); } - (void)setAcceptDrops: (bool)acceptDrops { [self qWidget]->setAcceptDrops(acceptDrops); } - (OFString*)accessibleDescription { return QToOFString([self qWidget]->accessibleDescription()); } - (void)setAccessibleDescription: (OFString*)accessibleDescription { [self qWidget]->setAccessibleDescription( OFToQString(accessibleDescription)); } - (OFString*)accessibleName { return QToOFString([self qWidget]->accessibleName()); } - (void)setAccessibleName: (OFString*)accessibleName { [self qWidget]->setAccessibleName(OFToQString(accessibleName)); } - (bool)autoFillBackground { return [self qWidget]->autoFillBackground(); } - (void)setAutoFillBackground: (bool)autoFillBackground { [self qWidget]->setAutoFillBackground(autoFillBackground); } - (of_dimension_t)baseSize { return QToOFDimension([self qWidget]->baseSize()); } - (void)setBaseSize: (of_dimension_t)baseSize { [self qWidget]->setBaseSize(OFToQSize(baseSize)); } - (of_rectangle_t)childrenRect { return QToOFRectangle([self qWidget]->childrenRect()); } - (QRegion)childrenRegion { return [self qWidget]->childrenRegion(); } - (Qt::ContextMenuPolicy)contextMenuPolicy { return [self qWidget]->contextMenuPolicy(); } - (void)setContextMenuPolicy: (Qt::ContextMenuPolicy)contextMenuPolicy { [self qWidget]->setContextMenuPolicy(contextMenuPolicy); } - (QCursor)cursor { return [self qWidget]->cursor(); } - (void)setCursor: (QCursor)cursor { [self qWidget]->setCursor(cursor); } - (void)unsetCursor { [self qWidget]->unsetCursor(); } - (bool)isEnabled { return [self qWidget]->isEnabled(); } - (void)setEnabled: (bool)enabled { [self qWidget]->setEnabled(enabled); } - (bool)hasFocus { return [self qWidget]->hasFocus(); } - (Qt::FocusPolicy)focusPolicy { return [self qWidget]->focusPolicy(); } - (void)setFocusPolicy: (Qt::FocusPolicy)focusPolicy { [self qWidget]->setFocusPolicy(focusPolicy); } - (const QFont&)font { return [self qWidget]->font(); } - (void)setFont: (const QFont&)font { [self qWidget]->setFont(font); } - (of_rectangle_t)frameGeometry { return QToOFRectangle([self qWidget]->frameGeometry()); } - (of_dimension_t)frameSize { return QToOFDimension([self qWidget]->frameSize()); } - (bool)isFullScreen { return [self qWidget]->isFullScreen(); } - (of_rectangle_t)geometry { return QToOFRectangle([self qWidget]->geometry()); } - (void)setGeometry: (of_rectangle_t)geometry { [self qWidget]->setGeometry(OFToQRect(geometry)); } - (int)height { return [self qWidget]->height(); } - (Qt::InputMethodHints)inputMethodHints { return [self qWidget]->inputMethodHints(); } - (void)setInputMethodHints: (Qt::InputMethodHints)inputMethodHints { [self qWidget]->setInputMethodHints(inputMethodHints); } - (bool)isActiveWindow { return [self qWidget]->isActiveWindow(); } - (Qt::LayoutDirection)layoutDirection { return [self qWidget]->layoutDirection(); } - (void)setLayoutDirection: (Qt::LayoutDirection)layoutDirection { [self qWidget]->setLayoutDirection(layoutDirection); } - (void)unsetLayoutDirection { [self qWidget]->unsetLayoutDirection(); } - (QLocale)locale { return [self qWidget]->locale(); } - (void)setLocale: (QLocale)locale { [self qWidget]->setLocale(locale); } - (void)unsetLocale { [self qWidget]->unsetLocale(); } - (bool)isMaximized { return [self qWidget]->isMaximized(); } - (int)maximumHeight { return [self qWidget]->maximumHeight(); } - (void)setMaximumHeight: (int)maximumHeight { [self qWidget]->setMaximumHeight(maximumHeight); } - (of_dimension_t)maximumSize { return QToOFDimension([self qWidget]->maximumSize()); } - (void)setMaximumSize: (of_dimension_t)maximumSize { [self qWidget]->setMaximumSize(OFToQSize(maximumSize)); } - (int)maximumWidth { return [self qWidget]->maximumWidth(); } - (void)setMaximumWidth: (int)maximumWidth { [self qWidget]->setMaximumWidth(maximumWidth); } - (bool)isMinimized { return [self qWidget]->isMinimized(); } - (int)minimumHeight { return [self qWidget]->minimumHeight(); } - (void)setMinimumHeight: (int)minimumHeight { [self qWidget]->setMinimumHeight(minimumHeight); } - (of_dimension_t)minimumSize { return QToOFDimension([self qWidget]->minimumSize()); } - (void)setMinimumSize: (of_dimension_t)minimumSize { [self qWidget]->setMinimumSize(OFToQSize(minimumSize)); } - (of_dimension_t)minimumSizeHint { return QToOFDimension([self qWidget]->minimumSizeHint()); } - (int)minimumWidth { return [self qWidget]->minimumWidth(); } - (void)setMinimumWidth: (int)minimumWidth { [self qWidget]->setMinimumWidth(minimumWidth); } - (bool)isModal { return [self qWidget]->isModal(); } - (bool)hasMouseTracking { return [self qWidget]->hasMouseTracking(); } - (void)setMouseTracking: (bool)mouseTracking { [self qWidget]->setMouseTracking(mouseTracking); } - (of_rectangle_t)normalGeometry { return QToOFRectangle([self qWidget]->normalGeometry()); } - (const QPalette&)palette { return [self qWidget]->palette(); } - (void)setPalette: (const QPalette&)palette { [self qWidget]->setPalette(palette); } - (of_point_t)pos { return QToOFPoint([self qWidget]->pos()); } - (void)moveToPosition: (of_point_t)pos { [self qWidget]->move(OFToQPoint(pos)); } - (of_rectangle_t)rect { return QToOFRectangle([self qWidget]->rect()); } - (of_dimension_t)size { return QToOFDimension([self qWidget]->size()); } - (void)resizeTo: (of_dimension_t)size { [self qWidget]->resize(OFToQSize(size)); } - (of_dimension_t)sizeHint { return QToOFDimension([self qWidget]->sizeHint()); } - (of_dimension_t)sizeIncrement { return QToOFDimension([self qWidget]->sizeIncrement()); } - (void)setSizeIncrement: (of_dimension_t)sizeIncrement { [self qWidget]->setSizeIncrement(OFToQSize(sizeIncrement)); } - (QSizePolicy)sizePolicy { return [self qWidget]->sizePolicy(); } - (void)setSizePolicy: (QSizePolicy)sizePolicy { [self qWidget]->setSizePolicy(sizePolicy); } - (OFString*)statusTip { return QToOFString([self qWidget]->statusTip()); } - (void)setStatusTip: (OFString*)statusTip { [self qWidget]->setStatusTip(OFToQString(statusTip)); } - (OFString*)styleSheet { return QToOFString([self qWidget]->styleSheet()); } - (void)setStyleSheet: (OFString*)styleSheet { [self qWidget]->setStyleSheet(OFToQString(styleSheet)); } - (OFString*)toolTip { return QToOFString([self qWidget]->toolTip()); } - (void)setToolTip: (OFString*)toolTip { [self qWidget]->setToolTip(OFToQString(toolTip)); } - (int)toolTipDuration { return [self qWidget]->toolTipDuration(); } - (void)setToolTipDuration: (int)toolTipDuration { [self qWidget]->setToolTipDuration(toolTipDuration); } - (bool)updatesEnabled { return [self qWidget]->updatesEnabled(); } - (void)setUpdatesEnabled: (bool)updatesEnabled { [self qWidget]->setUpdatesEnabled(updatesEnabled); } - (bool)isVisible { return [self qWidget]->isVisible(); } - (void)setVisible: (bool)visible { [self qWidget]->setVisible(visible); } - (OFString*)whatsThis { return QToOFString([self qWidget]->whatsThis()); } - (void)setWhatsThis: (OFString*)whatsThis { [self qWidget]->setWhatsThis(OFToQString(whatsThis)); } - (int)width { return [self qWidget]->width(); } - (OFString*)windowFilePath { return QToOFString([self qWidget]->windowFilePath()); } - (void)setWindowFilePath: (OFString*)windowFilePath { [self qWidget]->setWindowFilePath(OFToQString(windowFilePath)); } - (Qt::WindowFlags)windowFlags { return [self qWidget]->windowFlags(); } - (void)setWindowFlags: (Qt::WindowFlags)windowFlags { [self qWidget]->setWindowFlags(windowFlags); } - (QIcon)windowIcon { return [self qWidget]->windowIcon(); } - (void)setWindowIcon: (QIcon)windowIcon { [self qWidget]->setWindowIcon(windowIcon); } - (Qt::WindowModality)windowModality { return [self qWidget]->windowModality(); } - (void)setWindowModality: (Qt::WindowModality)windowModality { [self qWidget]->setWindowModality(windowModality); } - (bool)isWindowModified { return [self qWidget]->isWindowModified(); } - (void)setWindowModified: (bool)windowModified { [self qWidget]->setWindowModified(windowModified); } - (double)windowOpacity { return [self qWidget]->windowOpacity(); } - (void)setWindowOpacity: (double)windowOpacity { [self qWidget]->setWindowOpacity(windowOpacity); } - (OFString*)windowTitle { return QToOFString([self qWidget]->windowTitle()); } - (void)setWindowTitle: (OFString*)windowTitle { [self qWidget]->setWindowTitle(OFToQString(windowTitle)); } - (int)x { return [self qWidget]->x(); } - (int)y { return [self qWidget]->y(); } @end |
Changes to common/helpers.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #import <ObjFW/ObjFW.h> #include <QString> inline OFString* QToOFString(const QString &qString) { return [OFString stringWithUTF8String: qString.toUtf8()]; } inline QString OFToQString(OFString *string) { return QString::fromUtf8([string UTF8String]); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #import <ObjFW/ObjFW.h> #include <QString> #include <QSize> #include <QRect> inline OFString* QToOFString(const QString &qString) { return [OFString stringWithUTF8String: qString.toUtf8()]; } inline QString OFToQString(OFString *string) { return QString::fromUtf8([string UTF8String]); } inline of_dimension_t QToOFDimension(const QSize &qSize) { return of_dimension(qSize.width(), qSize.height()); } inline of_point_t QToOFPoint(const QPoint &qPoint) { return of_point(qPoint.x(), qPoint.y()); } inline QPoint OFToQPoint(of_point_t point) { return QPoint(point.x, point.y); } inline QSize OFToQSize(of_dimension_t dimension) { return QSize(dimension.width, dimension.height); } inline of_rectangle_t QToOFRectangle(const QRect &qRect) { return of_rectangle(qRect.x(), qRect.y(), qRect.width(), qRect.height()); } inline QRect OFToQRect(of_rectangle_t rectangle) { return QRect(rectangle.origin.x, rectangle.origin.y, rectangle.size.width, rectangle.size.height); } |