ObjQt  Check-in [e9fd43644a]

Overview
Comment:Add toOF() / toQt() for easy conversion
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e9fd43644a9c75144ca95e6bfa53a7f5f0dccb3853dd2dda0aa9cf36fc60ad1b
User & Date: js on 2017-04-05 21:19:39
Other Links: manifest | tags
Context
2017-04-09
12:19
Add OFString (QString) check-in: ed8ed56b3a user: js tags: trunk
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
Changes

Modified QtCore/QtCoreApplication.mm from [1f6a27146b] to [fecb2755a1].

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
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







-
+




-
+
-




-
+










-
+




-
+





-
+




-
+




-
+
-







- (QCoreApplication*)qCoreApplication
{
	return qobject_cast<QCoreApplication*>(_qObject);
}

- (OFString*)applicationName
{
	return QToOFString([self qCoreApplication]->applicationName());
	return toOF([self qCoreApplication]->applicationName());
}

- (void)setApplicationName: (OFString*)applicationName
{
	[self qCoreApplication]->setApplicationName(
	[self qCoreApplication]->setApplicationName(toQt(applicationName));
	    OFToQString(applicationName));
}

- (OFString*)applicationVersion
{
	return QToOFString([self qCoreApplication]->applicationVersion());
	return toOF([self qCoreApplication]->applicationVersion());
}

- (void)installNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
{
	[self qCoreApplication]->installNativeEventFilter(filterObject);
}

- (void)setApplicationVersion: (OFString*)applicationVersion
{
	[self qCoreApplication]->setApplicationVersion(
	    OFToQString(applicationVersion));
	    toQt(applicationVersion));
}

- (OFString*)organizationDomain
{
	return QToOFString([self qCoreApplication]->organizationDomain());
	return toOF([self qCoreApplication]->organizationDomain());
}

- (void)setOrganizationDomain: (OFString*)organizationDomain
{
	[self qCoreApplication]->setOrganizationDomain(
	    OFToQString(organizationDomain));
	    toQt(organizationDomain));
}

- (OFString*)organizationName
{
	return QToOFString([self qCoreApplication]->organizationName());
	return toOF([self qCoreApplication]->organizationName());
}

- (void)setOrganizationName: (OFString*)organizationName
{
	[self qCoreApplication]->setOrganizationName(
	[self qCoreApplication]->setOrganizationName(toQt(organizationName));
	    OFToQString(organizationName));
}

- (void)quit
{
	[self qCoreApplication]->quit();
}

Modified QtCore/QtObject.mm from [1a4b3f6c8d] to [e38fd4c083].

41
42
43
44
45
46
47
48

49
50
51
52
53

54
55
56
57
58
59
60
41
42
43
44
45
46
47

48
49
50
51
52

53
54
55
56
57
58
59
60







-
+




-
+







{
	OF_ENSURE(_ownsObject);
	_ownsObject = false;
}

- (OFString*)objectName
{
	return QToOFString(_qObject->objectName());
	return toOF(_qObject->objectName());
}

- (void)setObjectName: (OFString*)objectName
{
	_qObject->setObjectName(OFToQString(objectName));
	_qObject->setObjectName(toQt(objectName));
}

- (bool)setBlockSignals: (bool)block
{
	return _qObject->blockSignals(block);
}

Modified QtGui/QtGuiApplication.mm from [228043c92e] to [7179d16978].

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
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







-
+





-
+




-
+




-
+
-







- (QGuiApplication*)qGuiApplication
{
	return qobject_cast<QGuiApplication*>(_qObject);
}

- (OFString*)applicationDisplayName
{
	return QToOFString([self qGuiApplication]->applicationDisplayName());
	return toOF([self qGuiApplication]->applicationDisplayName());
}

- (void)setApplicationDisplayName: (OFString*)applicationDisplayName
{
	[self qGuiApplication]->setApplicationDisplayName(
	    OFToQString(applicationDisplayName));
	    toQt(applicationDisplayName));
}

- (OFString*)desktopFileName
{
	return QToOFString([self qGuiApplication]->desktopFileName());
	return toOF([self qGuiApplication]->desktopFileName());
}

- (void)setDesktopFileName: (OFString*)desktopFileName
{
	[self qGuiApplication]->setDesktopFileName(
	[self qGuiApplication]->setDesktopFileName(toQt(desktopFileName));
	    OFToQString(desktopFileName));
}

- (double)devicePixelRatio
{
	return [self qGuiApplication]->devicePixelRatio();
}

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
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







-
+




















-
+




-
+












- (void)setLayoutDirection: (Qt::LayoutDirection)layoutDirection
{
	[self qGuiApplication]->setLayoutDirection(layoutDirection);
}

- (OFString*)platformName
{
	return QToOFString([self qGuiApplication]->platformName());
	return toOF([self qGuiApplication]->platformName());
}

- (QScreen*)primaryScreen
{
	return [self qGuiApplication]->primaryScreen();
}

- (bool)quitOnLastWindowClosed
{
	return [self qGuiApplication]->quitOnLastWindowClosed();
}

- (void)setQuitOnLastWindowClosed: (bool)quitOnLastWindowClosed
{
	[self qGuiApplication]->setQuitOnLastWindowClosed(
	    quitOnLastWindowClosed);
}

- (OFString*)sessionID
{
	return QToOFString([self qGuiApplication]->sessionId());
	return toOF([self qGuiApplication]->sessionId());
}

- (OFString*)sessionKey
{
	return QToOFString([self qGuiApplication]->sessionKey());
	return toOF([self qGuiApplication]->sessionKey());
}

- (QIcon)windowIcon
{
	return [self qGuiApplication]->windowIcon();
}

- (void)setWindowIcon: (QIcon)windowIcon
{
	[self qGuiApplication]->setWindowIcon(windowIcon);
}
@end

Modified QtWidgets/QtApplication.mm from [375a847baa] to [b3970f90b1].

46
47
48
49
50
51
52
53

54
55
56
57
58

59
60
61
62
63
64
65
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());
	return toOF([self qApplication]->globalStrut());
}

- (void)setGlobalStrut: (of_dimension_t)globalStrut
{
	[self qApplication]->setGlobalStrut(OFToQSize(globalStrut));
	[self qApplication]->setGlobalStrut(toQt(globalStrut));
}

- (int)keyboardInputInterval
{
	return [self qApplication]->keyboardInputInterval();
}

86
87
88
89
90
91
92
93

94
95
96
97
98

99
100
101
102
103
104
105
86
87
88
89
90
91
92

93
94
95
96
97

98
99
100
101
102
103
104
105







-
+




-
+







- (void)setStartDragTime: (int)startDragTime
{
	[self qApplication]->setStartDragTime(startDragTime);
}

- (OFString*)styleSheet
{
	return QToOFString([self qApplication]->styleSheet());
	return toOF([self qApplication]->styleSheet());
}

- (void)setStyleSheet: (OFString*)styleSheet
{
	[self qApplication]->setStyleSheet(OFToQString(styleSheet));
	[self qApplication]->setStyleSheet(toQt(styleSheet));
}

- (int)wheelScrollLines
{
	return [self qApplication]->wheelScrollLines();
}

Modified QtWidgets/QtWidget.mm from [037226855e] to [efa0c01fb6].

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
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







-
+




-
+
-




-
+




-
+














-
+




-
+




-
+







- (void)setAcceptDrops: (bool)acceptDrops
{
	[self qWidget]->setAcceptDrops(acceptDrops);
}

- (OFString*)accessibleDescription
{
	return QToOFString([self qWidget]->accessibleDescription());
	return toOF([self qWidget]->accessibleDescription());
}

- (void)setAccessibleDescription: (OFString*)accessibleDescription
{
	[self qWidget]->setAccessibleDescription(
	[self qWidget]->setAccessibleDescription(toQt(accessibleDescription));
	    OFToQString(accessibleDescription));
}

- (OFString*)accessibleName
{
	return QToOFString([self qWidget]->accessibleName());
	return toOF([self qWidget]->accessibleName());
}

- (void)setAccessibleName: (OFString*)accessibleName
{
	[self qWidget]->setAccessibleName(OFToQString(accessibleName));
	[self qWidget]->setAccessibleName(toQt(accessibleName));
}

- (bool)autoFillBackground
{
	return [self qWidget]->autoFillBackground();
}

- (void)setAutoFillBackground: (bool)autoFillBackground
{
	[self qWidget]->setAutoFillBackground(autoFillBackground);
}

- (of_dimension_t)baseSize
{
	return QToOFDimension([self qWidget]->baseSize());
	return toOF([self qWidget]->baseSize());
}

- (void)setBaseSize: (of_dimension_t)baseSize
{
	[self qWidget]->setBaseSize(OFToQSize(baseSize));
	[self qWidget]->setBaseSize(toQt(baseSize));
}

- (of_rectangle_t)childrenRect
{
	return QToOFRectangle([self qWidget]->childrenRect());
	return toOF([self qWidget]->childrenRect());
}

- (QRegion)childrenRegion
{
	return [self qWidget]->childrenRegion();
}

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
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







-
+




-
+









-
+




-
+







- (void)setFont: (const QFont&)font
{
	[self qWidget]->setFont(font);
}

- (of_rectangle_t)frameGeometry
{
	return QToOFRectangle([self qWidget]->frameGeometry());
	return toOF([self qWidget]->frameGeometry());
}

- (of_dimension_t)frameSize
{
	return QToOFDimension([self qWidget]->frameSize());
	return toOF([self qWidget]->frameSize());
}

- (bool)isFullScreen
{
	return [self qWidget]->isFullScreen();
}

- (of_rectangle_t)geometry
{
	return QToOFRectangle([self qWidget]->geometry());
	return toOF([self qWidget]->geometry());
}

- (void)setGeometry: (of_rectangle_t)geometry
{
	[self qWidget]->setGeometry(OFToQRect(geometry));
	[self qWidget]->setGeometry(toQt(geometry));
}

- (int)height
{
	return [self qWidget]->height();
}

231
232
233
234
235
236
237
238

239
240
241
242
243

244
245
246
247
248
249
250
230
231
232
233
234
235
236

237
238
239
240
241

242
243
244
245
246
247
248
249







-
+




-
+







- (void)setMaximumHeight: (int)maximumHeight
{
	[self qWidget]->setMaximumHeight(maximumHeight);
}

- (of_dimension_t)maximumSize
{
	return QToOFDimension([self qWidget]->maximumSize());
	return toOF([self qWidget]->maximumSize());
}

- (void)setMaximumSize: (of_dimension_t)maximumSize
{
	[self qWidget]->setMaximumSize(OFToQSize(maximumSize));
	[self qWidget]->setMaximumSize(toQt(maximumSize));
}

- (int)maximumWidth
{
	return [self qWidget]->maximumWidth();
}

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
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







-
+




-
+




-
+







- (void)setMinimumHeight: (int)minimumHeight
{
	[self qWidget]->setMinimumHeight(minimumHeight);
}

- (of_dimension_t)minimumSize
{
	return QToOFDimension([self qWidget]->minimumSize());
	return toOF([self qWidget]->minimumSize());
}

- (void)setMinimumSize: (of_dimension_t)minimumSize
{
	[self qWidget]->setMinimumSize(OFToQSize(minimumSize));
	[self qWidget]->setMinimumSize(toQt(minimumSize));
}

- (of_dimension_t)minimumSizeHint
{
	return QToOFDimension([self qWidget]->minimumSizeHint());
	return toOF([self qWidget]->minimumSizeHint());
}

- (int)minimumWidth
{
	return [self qWidget]->minimumWidth();
}

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
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







-
+














-
+




-
+




-
+




-
+




-
+




-
+




-
+




-
+














-
+




-
+




-
+




-
+




-
+




-
+







- (void)setMouseTracking: (bool)mouseTracking
{
	[self qWidget]->setMouseTracking(mouseTracking);
}

- (of_rectangle_t)normalGeometry
{
	return QToOFRectangle([self qWidget]->normalGeometry());
	return toOF([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());
	return toOF([self qWidget]->pos());
}

- (void)moveToPosition: (of_point_t)pos
{
	[self qWidget]->move(OFToQPoint(pos));
	[self qWidget]->move(toQt(pos));
}

- (of_rectangle_t)rect
{
	return QToOFRectangle([self qWidget]->rect());
	return toOF([self qWidget]->rect());
}

- (of_dimension_t)size
{
	return QToOFDimension([self qWidget]->size());
	return toOF([self qWidget]->size());
}

- (void)resizeTo: (of_dimension_t)size
{
	[self qWidget]->resize(OFToQSize(size));
	[self qWidget]->resize(toQt(size));
}

- (of_dimension_t)sizeHint
{
	return QToOFDimension([self qWidget]->sizeHint());
	return toOF([self qWidget]->sizeHint());
}

- (of_dimension_t)sizeIncrement
{
	return QToOFDimension([self qWidget]->sizeIncrement());
	return toOF([self qWidget]->sizeIncrement());
}

- (void)setSizeIncrement: (of_dimension_t)sizeIncrement
{
	[self qWidget]->setSizeIncrement(OFToQSize(sizeIncrement));
	[self qWidget]->setSizeIncrement(toQt(sizeIncrement));
}

- (QSizePolicy)sizePolicy
{
	return [self qWidget]->sizePolicy();
}

- (void)setSizePolicy: (QSizePolicy)sizePolicy
{
	[self qWidget]->setSizePolicy(sizePolicy);
}

- (OFString*)statusTip
{
	return QToOFString([self qWidget]->statusTip());
	return toOF([self qWidget]->statusTip());
}

- (void)setStatusTip: (OFString*)statusTip
{
	[self qWidget]->setStatusTip(OFToQString(statusTip));
	[self qWidget]->setStatusTip(toQt(statusTip));
}

- (OFString*)styleSheet
{
	return QToOFString([self qWidget]->styleSheet());
	return toOF([self qWidget]->styleSheet());
}

- (void)setStyleSheet: (OFString*)styleSheet
{
	[self qWidget]->setStyleSheet(OFToQString(styleSheet));
	[self qWidget]->setStyleSheet(toQt(styleSheet));
}

- (OFString*)toolTip
{
	return QToOFString([self qWidget]->toolTip());
	return toOF([self qWidget]->toolTip());
}

- (void)setToolTip: (OFString*)toolTip
{
	[self qWidget]->setToolTip(OFToQString(toolTip));
	[self qWidget]->setToolTip(toQt(toolTip));
}

- (int)toolTipDuration
{
	return [self qWidget]->toolTipDuration();
}

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
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







-
+




-
+









-
+




-
+







- (void)setVisible: (bool)visible
{
	[self qWidget]->setVisible(visible);
}

- (OFString*)whatsThis
{
	return QToOFString([self qWidget]->whatsThis());
	return toOF([self qWidget]->whatsThis());
}

- (void)setWhatsThis: (OFString*)whatsThis
{
	[self qWidget]->setWhatsThis(OFToQString(whatsThis));
	[self qWidget]->setWhatsThis(toQt(whatsThis));
}

- (int)width
{
	return [self qWidget]->width();
}

- (OFString*)windowFilePath
{
	return QToOFString([self qWidget]->windowFilePath());
	return toOF([self qWidget]->windowFilePath());
}

- (void)setWindowFilePath: (OFString*)windowFilePath
{
	[self qWidget]->setWindowFilePath(OFToQString(windowFilePath));
	[self qWidget]->setWindowFilePath(toQt(windowFilePath));
}

- (Qt::WindowFlags)windowFlags
{
	return [self qWidget]->windowFlags();
}

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
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







-
+




-
+












- (void)setWindowOpacity: (double)windowOpacity
{
	[self qWidget]->setWindowOpacity(windowOpacity);
}

- (OFString*)windowTitle
{
	return QToOFString([self qWidget]->windowTitle());
	return toOF([self qWidget]->windowTitle());
}

- (void)setWindowTitle: (OFString*)windowTitle
{
	[self qWidget]->setWindowTitle(OFToQString(windowTitle));
	[self qWidget]->setWindowTitle(toQt(windowTitle));
}

- (int)x
{
	return [self qWidget]->x();
}

- (int)y
{
	return [self qWidget]->y();
}
@end

Modified common/helpers.h from [f5be4fa690] to [0f97c8adb0].

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
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)
static OF_INLINE OFString*
toOF(const QString &qString)
{
	return [OFString stringWithUTF8String: qString.toUtf8()];
}

inline QString
OFToQString(OFString *string)
static OF_INLINE QString
toQt(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)
static OF_INLINE of_point_t
toOF(const QPoint &qPoint)
{
	return of_point(qPoint.x(), qPoint.y());
}

inline QPoint
OFToQPoint(of_point_t point)
static OF_INLINE QPoint
toQt(of_point_t point)
{
	return QPoint(point.x, point.y);
}

static OF_INLINE of_dimension_t
toOF(const QSize &qSize)
{
	return of_dimension(qSize.width(), qSize.height());
}

inline QSize
OFToQSize(of_dimension_t dimension)
static OF_INLINE QSize
toQt(of_dimension_t dimension)
{
	return QSize(dimension.width, dimension.height);
}

inline of_rectangle_t
QToOFRectangle(const QRect &qRect)
static OF_INLINE of_rectangle_t
toOF(const QRect &qRect)
{
	return of_rectangle(qRect.x(), qRect.y(),
	    qRect.width(), qRect.height());
}

inline QRect
OFToQRect(of_rectangle_t rectangle)
static OF_INLINE QRect
toQt(of_rectangle_t rectangle)
{
	return QRect(rectangle.origin.x, rectangle.origin.y,
	    rectangle.size.width, rectangle.size.height);
}