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
|
#import "helpers.h"
using ObjQt::toOF;
using ObjQt::toQt;
@implementation QtPushButton
- initWithQAbstractButton: (QAbstractButton *)qAbstractButton
{
OF_INVALID_INIT_METHOD
}
- initWithQPushButton: (QPushButton *)qPushButton
{
return [super initWithQAbstractButton: qPushButton];
}
- initWithText: (OFString *)text
{
try {
self = [self initWithQPushButton:
new QPushButton(toQt(text))];
[self takeOwnership];
return self;
} catch (const std::bad_alloc &e) {
self = [self initWithQPushButton: NULL];
[self release];
throw;
}
}
- initWithIcon: (QIcon)icon
text: (OFString *)text
{
try {
self = [self initWithQPushButton:
new QPushButton(icon, toQt(text))];
[self takeOwnership];
|
|
|
|
|
|
|
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
|
#import "helpers.h"
using ObjQt::toOF;
using ObjQt::toQt;
@implementation QtPushButton
- (instancetype)initWithQAbstractButton: (QAbstractButton *)qAbstractButton
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithQPushButton: (QPushButton *)qPushButton
{
return [super initWithQAbstractButton: qPushButton];
}
- (instancetype)initWithText: (OFString *)text
{
try {
self = [self initWithQPushButton:
new QPushButton(toQt(text))];
[self takeOwnership];
return self;
} catch (const std::bad_alloc &e) {
self = [self initWithQPushButton: NULL];
[self release];
throw;
}
}
- (instancetype)initWithIcon: (QIcon)icon
text: (OFString *)text
{
try {
self = [self initWithQPushButton:
new QPushButton(icon, toQt(text))];
[self takeOwnership];
|