ObjQt  Check-in [d43a881019]

Overview
Comment:Add QtAction and add more methods to QtWidget
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d43a88101962b3420aa41918ff643c83b37d19ff266633e60aaf2d36d44c9de5
User & Date: js on 2017-04-15 02:16:34
Other Links: manifest | tags
Context
2017-04-15
02:42
Make Qt project work on non-Mac systems check-in: 0df95396ff user: js tags: trunk
02:16
Add QtAction and add more methods to QtWidget check-in: d43a881019 user: js tags: trunk
2017-04-12
09:17
Add a license check-in: 01e4161d3e user: js tags: trunk
Changes

Modified ObjQt.pro from [ca2d60cd6c] to [24307d8f20].

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
	   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 += common/OFString+QString.mm	\
	   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		\







>











>







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
	   QtCore/QtChildEvent.h	\
	   QtCore/QtCoreApplication.h	\
	   QtCore/QtEvent.h		\
	   QtCore/QtObject.h		\
	   QtCore/QtThread.h		\
	   QtGui/QtGuiApplication.h	\
	   QtGui/QtPaintDevice.h	\
	   QtWidgets/QtAction.h		\
	   QtWidgets/QtApplication.h	\
	   QtWidgets/QtWidget.h

SOURCES += common/OFString+QString.mm	\
	   QtCore/QtChildEvent.mm	\
	   QtCore/QtCoreApplication.mm	\
	   QtCore/QtEvent.mm  		\
	   QtCore/QtObject.mm		\
	   QtCore/QtThread.mm		\
	   QtGui/QtGuiApplication.mm	\
	   QtGui/QtPaintDevice.mm	\
	   QtWidgets/QtAction.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		\

Modified QtCore/QtEvent.mm from [1775579049] to [a8eec8c991].

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "QtEvent.h"

@implementation QtEvent
@synthesize qEvent = _eEvent;

+ (int)registerEventType: (int)hint
{
	return QEvent::registerEventType(hint);
}

- init







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "QtEvent.h"

@implementation QtEvent
@synthesize qEvent = _qEvent;

+ (int)registerEventType: (int)hint
{
	return QEvent::registerEventType(hint);
}

- init

Modified QtCore/QtObject.mm from [5927aab5bc] to [d103de14ea].

86
87
88
89
90
91
92


93
94
95
96
97
98
99
	OFMutableArray *children = [OFMutableArray arrayWithCapacity:
	    qChildren.count()];
	void *pool = objc_autoreleasePoolPush();

	for (QObject *qChild: qChildren)
		[children addObject:
		    [[[QtObject alloc] initWithQObject: qChild] autorelease]];



	objc_autoreleasePoolPop(pool);

	return children;
}

- (QMetaObject::Connection)connectSignal: (OFString*)signal







>
>







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
	OFMutableArray *children = [OFMutableArray arrayWithCapacity:
	    qChildren.count()];
	void *pool = objc_autoreleasePoolPush();

	for (QObject *qChild: qChildren)
		[children addObject:
		    [[[QtObject alloc] initWithQObject: qChild] autorelease]];

	[children makeImmutable];

	objc_autoreleasePoolPop(pool);

	return children;
}

- (QMetaObject::Connection)connectSignal: (OFString*)signal
139
140
141
142
143
144
145


146
147
148
149
150
151
152

	for (const QByteArray &qDynamicPropertyName: qDynamicPropertyNames) {
		OFDataArray *dynamicPropertyName = [OFDataArray dataArray];
		[dynamicPropertyName addItems: qDynamicPropertyName.data()
					count: qDynamicPropertyName.count()];
		[dynamicPropertyNames addObject: dynamicPropertyName];
	}



	objc_autoreleasePoolPop(pool);

	return dynamicPropertyNames;
}

- (bool)handleEvent: (QtEvent*)event







>
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

	for (const QByteArray &qDynamicPropertyName: qDynamicPropertyNames) {
		OFDataArray *dynamicPropertyName = [OFDataArray dataArray];
		[dynamicPropertyName addItems: qDynamicPropertyName.data()
					count: qDynamicPropertyName.count()];
		[dynamicPropertyNames addObject: dynamicPropertyName];
	}

	[dynamicPropertyNames makeImmutable];

	objc_autoreleasePoolPop(pool);

	return dynamicPropertyNames;
}

- (bool)handleEvent: (QtEvent*)event

Added QtWidgets/QtAction.h version [c64a4c6e90].

Added QtWidgets/QtAction.mm version [122eed180b].

Modified QtWidgets/QtWidget.h from [4eaa9a4461] to [61a5454776].

20
21
22
23
24
25
26


27
28
29
30
31
32
33
 * POSSIBILITY OF SUCH DAMAGE.
 */

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







>
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "QtObject.h"
#import "QtPaintDevice.h"

#include <QWidget>

@class QtAction;

@interface QtWidget: QtObject
@property (readonly) QWidget *qWidget;
@property bool acceptDrops;
@property (copy) OFString *accessibleDescription;
@property (copy) OFString *accessibleName;
@property bool autoFillBackground;
82
83
84
85
86
87
88







































89















90
91
92
93
94
95
96
97
98
@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







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

<







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
@property Qt::WindowModality windowModality;
@property (getter=isWindowModified) bool windowModified;
@property double windowOpacity;
@property (copy) OFString *windowTitle;
@property (readonly) int x;
@property (readonly) int y;

- initWithQWidget: (QWidget*)qWidget;
- (OFArray OF_GENERIC(QtAction*)*)actions;
- (void)activateWindow;
- (void)addAction: (QtAction*)action;
- (void)addActions: (OFArray OF_GENERIC(QtAction*)*)actions;
- (void)adjustSize;
- (QPalette::ColorRole)backgroundRole;
- (QBackingStore*)backingStore;
- (QtWidget*)childAt: (of_point_t)point;
- (void)clearFocus;
- (void)clearMask;
- (QMargins)contentsMargins;
- (of_rectangle_t)contentsRect;
- (WId)effectiveWinId;
- (void)ensurePolished;
- (QtWidget*)focusProxy;
- (QtWidget*)focusWidget;
- (QFontInfo)fontInfo;
- (QFontMetrics)fontMetrics;
- (QPalette::ColorRole)foregroundRole;
- (QPixmap)grabRectangle: (of_rectangle_t)rectangle;
- (void)grabGesture: (Qt::GestureType)gesture;
- (void)grabGesture: (Qt::GestureType)gesture
	      flags: (Qt::GestureFlags)flags;
- (void)grabKeyboard;
- (void)grabMouse;
- (void)grabMouseWithCursor: (const QCursor&)cursor;
- (int)grabShortcutWithKey: (const QKeySequence&)key;
- (int)grabShortcutWithKey: (const QKeySequence&)key
		   context: (Qt::ShortcutContext)context;
- (QGraphicsEffect*)graphicsEffect;
- (QGraphicsProxyWidget*)graphicsProxyWidget;
#ifdef QT_KEYPAD_NAVIGATION
- (bool)hasEditFocus;
#endif
- (bool)hasHeightForWidth;
- (int)heightForWidth: (int)w;
- (QVariant)queryInputMethod: (Qt::InputMethodQuery)query;
- (void)insertAction: (QtAction*)action
	      before: (QtAction*)before;
- (void)insertActions: (OFArray OF_GENERIC(QtAction*)*)actions
	       before: (QtAction*)before;
- (bool)isAncestorOf: (QtWidget*)child;
- (bool)isEnabledTo: (QtWidget*)ancestor;
- (bool)isHidden;
- (bool)isVisibleTo: (QtWidget*)ancestor;
- (bool)isWindow;
// QPoint mapFrom(const QWidget *parent, const QPoint &pos) const
// QPoint mapFromGlobal(const QPoint &pos) const
// QPoint mapFromParent(const QPoint &pos) const
// QPoint mapTo(const QWidget *parent, const QPoint &pos) const
// QPoint mapToGlobal(const QPoint &pos) const
// QPoint mapToParent(const QPoint &pos) const
// QRegion mask() const
// ...


- (void)unsetCursor;
- (void)unsetLayoutDirection;
- (void)unsetLocale;
@end

@interface QtWidget (QtPaintDevice) <QtPaintDevice>
@end

Modified QtWidgets/QtWidget.mm from [b42c804d1c] to [87d02fdba3].

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







>












>
>
>
>
>







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
 * 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 "QtWidget.h"
#import "QtAction.h"

#import "helpers.h"

#include <QIcon>
#include <QLocale>

@implementation QtWidget
+ (void)initialize
{
	if (self == [QtWidget class])
		[self inheritMethodsFromClass: [QtPaintDevice class]];
}

- initWithQObject: (QObject*)qObject
{
	OF_INVALID_INIT_METHOD
}

- initWithQWidget: (QWidget*)qWidget
{
	return [super initWithQObject: qWidget];
}

- (QWidget*)qWidget
544
545
546
547
548
549
550








































































































































































































































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

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








































































































































































































































@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
	return [self qWidget]->x();
}

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

- (OFArray OF_GENERIC(QtAction*)*)actions
{
	const QList<QAction*> &actions = [self qWidget]->actions();
	OFMutableArray *ret =
	    [OFMutableArray arrayWithCapacity: actions.count()];
	void *pool = objc_autoreleasePoolPush();

	for (QAction *action: actions)
		[ret addObject:
		    [[[QtAction alloc] initWithQAction: action] autorelease]];

	[ret makeImmutable];

	objc_autoreleasePoolPop(pool);

	return ret;
}

- (void)activateWindow
{
	[self qWidget]->activateWindow();
}

- (void)addAction: (QtAction*)action
{
	[self qWidget]->addAction([action qAction]);
}

- (void)addActions: (OFArray OF_GENERIC(QtAction*)*)actions
{
	QList<QAction*> list;

	for (QtAction *action in actions)
		list.append([action qAction]);

	[self qWidget]->addActions(list);
}

- (void)adjustSize
{
	[self qWidget]->adjustSize();
}

- (QPalette::ColorRole)backgroundRole
{
	return [self qWidget]->backgroundRole();
}

- (QBackingStore*)backingStore
{
	return [self qWidget]->backingStore();
}

- (QtWidget*)childAt: (of_point_t)point
{
	return [[[QtWidget alloc] initWithQWidget:
	    [self qWidget]->childAt(toQt(point))] autorelease];
}

- (void)clearFocus
{
	return [self qWidget]->clearFocus();
}

- (void)clearMask
{
	[self qWidget]->clearMask();
}

- (QMargins)contentsMargins
{
	return [self qWidget]->contentsMargins();
}

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

- (WId)effectiveWinId
{
	return [self qWidget]->effectiveWinId();
}

- (void)ensurePolished
{
	[self qWidget]->ensurePolished();
}

- (QtWidget*)focusProxy
{
	return [[[QtWidget alloc] initWithQWidget:
	    [self qWidget]->focusProxy()] autorelease];
}

- (QtWidget*)focusWidget
{
	return [[[QtWidget alloc] initWithQWidget:
	    [self qWidget]->focusWidget()] autorelease];
}

- (QFontInfo)fontInfo
{
	return [self qWidget]->fontInfo();
}

- (QFontMetrics)fontMetrics
{
	return [self qWidget]->fontMetrics();
}

- (QPalette::ColorRole)foregroundRole
{
	return [self qWidget]->foregroundRole();
}

- (QPixmap)grabRectangle: (of_rectangle_t)rectangle
{
	return [self qWidget]->grab(toQt(rectangle));
}

- (void)grabGesture: (Qt::GestureType)gesture
{
	[self qWidget]->grabGesture(gesture);
}

- (void)grabGesture: (Qt::GestureType)gesture
	      flags: (Qt::GestureFlags)flags
{
	[self qWidget]->grabGesture(gesture, flags);
}

- (void)grabKeyboard
{
	[self qWidget]->grabKeyboard();
}

- (void)grabMouse
{
	[self qWidget]->grabMouse();
}

- (void)grabMouseWithCursor: (const QCursor&)cursor
{
	[self qWidget]->grabMouse(cursor);
}

- (int)grabShortcutWithKey: (const QKeySequence&)key
{
	return [self qWidget]->grabShortcut(key);
}

- (int)grabShortcutWithKey: (const QKeySequence&)key
		   context: (Qt::ShortcutContext)context
{
	return [self qWidget]->grabShortcut(key, context);
}

- (QGraphicsEffect*)graphicsEffect
{
	return [self qWidget]->graphicsEffect();
}

- (QGraphicsProxyWidget*)graphicsProxyWidget
{
	return [self qWidget]->graphicsProxyWidget();
}

#ifdef QT_KEYPAD_NAVIGATION
- (bool)hasEditFocus
{
	return [self qWidget]->hasEditFocus();
}
#endif

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

- (int)heightForWidth: (int)w
{
	return [self qWidget]->heightForWidth(w);
}

- (QVariant)queryInputMethod: (Qt::InputMethodQuery)query
{
	return [self qWidget]->inputMethodQuery(query);
}

- (void)insertAction: (QtAction*)action
	      before: (QtAction*)before
{
	[self qWidget]->insertAction([before qAction], [action qAction]);
}

- (void)insertActions: (OFArray OF_GENERIC(QtAction*)*)actions
	       before: (QtAction*)before
{
	QList<QAction*> list;

	for (QtAction *action in actions)
		list.append([action qAction]);

	[self qWidget]->insertActions([before qAction], list);
}

- (bool)isAncestorOf: (QtWidget*)child
{
	return [self qWidget]->isAncestorOf([child qWidget]);
}

- (bool)isEnabledTo: (QtWidget*)ancestor
{
	return [self qWidget]->isEnabledTo([ancestor qWidget]);
}

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

- (bool)isVisibleTo: (QtWidget*)ancestor
{
	return [self qWidget]->isVisibleTo([ancestor qWidget]);
}

- (bool)isWindow
{
	return [self qWidget]->isWindow();
}
@end