Class: Qt::Base

Inherits:
Object show all
Defined in:
lib/Qt/qtruby4.rb,
lib/qttest/qttest.rb

Direct Known Subclasses

AbstractSlider, AbstractSocket, AbstractTextDocumentLayout, AccessibleEvent, Action, ActionEvent, Application, Buffer, ButtonGroup, ByteArray, CheckBox, ChildEvent, CloseEvent, Color, Connection, ContextMenuEvent, CoreApplication, Cursor, CustomEvent, DBusArgument, DBusConnection, DBusConnectionInterface, DBusError, DBusInterface, DBusMessage, Date, DateTime, Dial, Dialog, Dir, DomAttr, DomDocumentType, DoubleSpinBox, DoubleValidator, DragEnterEvent, DragLeaveEvent, DropEvent, Event, EventLoop, File, FileIconProvider, FileOpenEvent, FocusEvent, Font, FontDatabase, Ftp, GLContext, GLPixelBuffer, GLWidget, GenericArgument, Gradient, GraphicsEllipseItem, GraphicsItem, GraphicsItemGroup, GraphicsLineItem, GraphicsPathItem, GraphicsPixmapItem, GraphicsPolygonItem, GraphicsProxyWidget, GraphicsRectItem, GraphicsSceneContextMenuEvent, GraphicsSceneHelpEvent, GraphicsSceneHoverEvent, GraphicsSceneMouseEvent, GraphicsSceneWheelEvent, GraphicsSimpleTextItem, GraphicsSvgItem, GraphicsTextItem, GraphicsWidget, HelpEvent, HideEvent, HoverEvent, Http, HttpRequestHeader, IODevice, IconDragEvent, Image, ImageIOHandler, ImageReader, ImageWriter, InputEvent, InputMethodEvent, IntValidator, ItemSelection, ItemSelectionModel, KeyEvent, KeySequence, LCDNumber, Library, Line, LineF, ListWidgetItem, Locale, Menu, MetaClassInfo, MetaEnum, MetaMethod, MetaObject, MetaProperty, MetaType, ModelIndex, MouseEvent, MoveEvent, Movie, NetworkProxy, Object, PageSetupDialog, PaintEvent, Picture, PictureIO, Pixmap, PluginLoader, Point, PointF, Polygon, PolygonF, PrintDialog, Printer, Process, ProgressBar, ProgressDialog, PushButton, RadioButton, Rect, RectF, ResizeEvent, ScrollBar, Shortcut, ShortcutEvent, ShowEvent, Size, SizeF, SizePolicy, Slider, SocketNotifier, SpinBox, SqlDatabase, SqlError, SqlField, SqlIndex, SqlQuery, SqlResult, SqlTableModel, StandardItem, StandardItemModel, StatusTipEvent, StyleHintReturn, StyleOption, SyntaxHighlighter, TableWidgetItem, TemporaryFile, Test, TextCursor, TextDocument, TextFormat, TextImageFormat, TextInlineObject, TextLength, TextList, TextObject, TextTable, TextTableCell, Time, TimeLine, TimerEvent, ToolButton, Translator, TreeWidget, TreeWidgetItem, TreeWidgetItemIterator, Url, UrlInfo, Uuid, Variant, WhatsThisClickedEvent, Widget, WindowStateChangeEvent, XmlAttributes

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ancestorsObject



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/Qt/qtruby4.rb', line 183

def self.ancestors
	klass = self
	classid = nil
	loop do
		classid = Qt::Internal::find_pclassid(klass.name)
		break if classid.index
    
		klass = klass.superclass
		if klass.nil?
			return super
		end
	end

	klasses = super
	klasses.delete(Qt::Base)
	klasses.delete(self)
	ids = []
	Qt::Internal::getAllParents(classid, ids)
	return [self] + ids.map {|id| Qt::Internal.find_class(Qt::Internal.classid2name(id))} + klasses
end

.private_slots(*slot_list) ⇒ Object



74
75
76
77
78
# File 'lib/Qt/qtruby4.rb', line 74

def self.private_slots(*slot_list)
	meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
	meta.add_slots(slot_list, Internal::MethodSlot | Internal::AccessPrivate)
	meta.changed = true
end

.q_classinfo(key, value) ⇒ Object



92
93
94
95
96
# File 'lib/Qt/qtruby4.rb', line 92

def self.q_classinfo(key, value)
	meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
	meta.add_classinfo(key, value)
	meta.changed = true
end

.q_signal(signal) ⇒ Object



80
81
82
83
84
# File 'lib/Qt/qtruby4.rb', line 80

def self.q_signal(signal)
	meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
	meta.add_signals([signal], Internal::MethodSignal | Internal::AccessProtected)
	meta.changed = true
end

.q_slot(slot) ⇒ Object



86
87
88
89
90
# File 'lib/Qt/qtruby4.rb', line 86

def self.q_slot(slot)
	meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
	meta.add_slots([slot], Internal::MethodSlot | Internal::AccessPublic)
	meta.changed = true
end

.signals(*signal_list) ⇒ Object



62
63
64
65
66
# File 'lib/Qt/qtruby4.rb', line 62

def self.signals(*signal_list)
	meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
	meta.add_signals(signal_list, Internal::MethodSignal | Internal::AccessProtected)
	meta.changed = true
end

.slots(*slot_list) ⇒ Object



68
69
70
71
72
# File 'lib/Qt/qtruby4.rb', line 68

def self.slots(*slot_list)
	meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
	meta.add_slots(slot_list, Internal::MethodSlot | Internal::AccessPublic)
	meta.changed = true
end

Instance Method Details

#%(a) ⇒ Object



119
120
121
# File 'lib/Qt/qtruby4.rb', line 119

def %(a)
	return Qt::%(self, a)
end

#&(a) ⇒ Object



128
129
130
# File 'lib/Qt/qtruby4.rb', line 128

def &(a)
	return Qt::&(self, a)
end

#*(a) ⇒ Object



113
114
115
# File 'lib/Qt/qtruby4.rb', line 113

def *(a)
	return Qt::*(self, a)
end

#**(a) ⇒ Object



98
99
100
# File 'lib/Qt/qtruby4.rb', line 98

def **(a)
	return Qt::**(self, a)
end

#+(a) ⇒ Object



101
102
103
# File 'lib/Qt/qtruby4.rb', line 101

def +(a)
	return Qt::+(self, a)
end

#-(a) ⇒ Object



110
111
112
# File 'lib/Qt/qtruby4.rb', line 110

def -(a)
	return Qt::-(self, a)
end

#-@Object



107
108
109
# File 'lib/Qt/qtruby4.rb', line 107

def -@()
	return Qt::-(self)
end

#/(a) ⇒ Object



116
117
118
# File 'lib/Qt/qtruby4.rb', line 116

def /(a)
	return Qt::/(self, a)
end

#<(a) ⇒ Object

Module has ‘<’, ‘<=’, ‘>’ and ‘>=’ operator instance methods, so pretend they don’t exist by calling method_missing() explicitely



140
141
142
143
144
145
146
# File 'lib/Qt/qtruby4.rb', line 140

def <(a)
	begin
		Qt::method_missing(:<, self, a)
	rescue
		super(a)
	end
end

#<<(a) ⇒ Object



125
126
127
# File 'lib/Qt/qtruby4.rb', line 125

def <<(a)
	return Qt::<<(self, a)
end

#<=(a) ⇒ Object



148
149
150
151
152
153
154
# File 'lib/Qt/qtruby4.rb', line 148

def <=(a)
	begin
		Qt::method_missing(:<=, self, a)
	rescue
		super(a)
	end
end

#==(a) ⇒ Object

Object has a ‘==’ operator instance method, so pretend it don’t exist by calling method_missing() explicitely



174
175
176
177
178
179
180
181
# File 'lib/Qt/qtruby4.rb', line 174

def ==(a)
	return false if a.nil?
	begin
		Qt::method_missing(:==, self, a)
	rescue
		super(a)
	end
end

#>(a) ⇒ Object



156
157
158
159
160
161
162
# File 'lib/Qt/qtruby4.rb', line 156

def >(a)
	begin
		Qt::method_missing(:>, self, a)
	rescue
		super(a)
	end
end

#>=(a) ⇒ Object



164
165
166
167
168
169
170
# File 'lib/Qt/qtruby4.rb', line 164

def >=(a)
	begin
		Qt::method_missing(:>=, self, a)
	rescue
		super(a)
	end
end

#>>(a) ⇒ Object



122
123
124
# File 'lib/Qt/qtruby4.rb', line 122

def >>(a)
	return Qt::>>(self, a)
end

#^(a) ⇒ Object



131
132
133
# File 'lib/Qt/qtruby4.rb', line 131

def ^(a)
	return Qt::^(self, a)
end

#is_a?(mod) ⇒ Boolean Also known as: kind_of?

Change the behaviors of is_a? and kind_of? (alias of is_a?) to use above self.ancestors method Note: this definition also affects Object#===

Returns:



206
207
208
# File 'lib/Qt/qtruby4.rb', line 206

def is_a?(mod)
	super || self.class.ancestors.include?(mod)
end

#methods(regular = true) ⇒ Object



211
212
213
214
215
216
217
# File 'lib/Qt/qtruby4.rb', line 211

def methods(regular=true)
	if !regular
		return singleton_methods
	end
	
	qt_methods(super, 0x0)
end

#protected_methodsObject



219
220
221
222
# File 'lib/Qt/qtruby4.rb', line 219

def protected_methods
	# From smoke.h, Smoke::mf_protected 0x80
	qt_methods(super, 0x80)
end

#public_methodsObject



224
225
226
# File 'lib/Qt/qtruby4.rb', line 224

def public_methods
	methods
end

#QCOMPARE(actual, expected) ⇒ Object



134
135
136
137
138
139
# File 'lib/qttest/qttest.rb', line 134

def QCOMPARE(actual, expected)
  file, line = caller(1)[0].split(':')
  if !Qt::Test.qCompare(eval(actual, Qt::Test.current_binding), eval(expected, Qt::Test.current_binding), actual, expected, file, line.to_i)    
    return eval('return', Qt::Test.current_binding)
  end
end

#QEXPECT_FAIL(dataIndex, comment, mode) ⇒ Object



147
148
149
150
151
152
# File 'lib/qttest/qttest.rb', line 147

def QEXPECT_FAIL(dataIndex, comment, mode)
  file, line = caller(1)[0].split(':')
  if !Qt::Test.qExpectFail(dataIndex, comment, mode, file, line.to_i)
    return eval('return', Qt::Test.current_binding)
  end
end

#QFAIL(message) ⇒ Object



115
116
117
118
119
# File 'lib/qttest/qttest.rb', line 115

def QFAIL(message)
  file, line = caller(1)[0].split(':')
  Qt::Test.qFail(message, file, line.to_i)
  return eval('return', Qt::Test.current_binding)
end

#QSKIP(statement, mode) ⇒ Object



141
142
143
144
145
# File 'lib/qttest/qttest.rb', line 141

def QSKIP(statement, mode)
  file, line = caller(1)[0].split(':')
  Qt::Test.qSkip(statement, mode, file, line.to_i)
  return eval('return', Qt::Test.current_binding)
end

#QTEST(actual, testElement) ⇒ Object



154
155
156
157
158
159
# File 'lib/qttest/qttest.rb', line 154

def QTEST(actual, testElement)
  file, line = caller(1)[0].split(':')
  if !Qt::Test.qTest(eval(actual, Qt::Test.current_binding), eval(testElement, Qt::Test.current_binding), actual, testElement, file, line.to_i)
    return eval('return', Qt::Test.current_binding)
  end
end

#QVERIFY(statement) ⇒ Object



108
109
110
111
112
113
# File 'lib/qttest/qttest.rb', line 108

def QVERIFY(statement)
  file, line = caller(1)[0].split(':')
  if !Qt::Test.qVerify(eval(statement, Qt::Test.current_binding), statement, "", file, line.to_i)
      return eval('return', Qt::Test.current_binding)
  end
end

#QVERIFY2(statement, description) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/qttest/qttest.rb', line 121

def QVERIFY2(statement, description)
  file, line = caller(1)[0].split(':')
  if eval(statement, Qt::Test.current_binding)
    if !Qt::Test.qVerify(true, statement, description, file, line.to_i)
      return eval('return', Qt::Test.current_binding)
    end
  else
    if !Qt::Test.qVerify(false, statement, description, file, line.to_i)
      return eval('return', Qt::Test.current_binding)
    end
  end
end

#QWARN(msg) ⇒ Object



161
162
163
# File 'lib/qttest/qttest.rb', line 161

def QWARN(msg)
  Qt::Test.qWarn(msg)
end

#singleton_methodsObject



228
229
230
231
# File 'lib/Qt/qtruby4.rb', line 228

def singleton_methods
	# From smoke.h, Smoke::mf_static 0x01
	qt_methods(super, 0x01)
end

#|(a) ⇒ Object



134
135
136
# File 'lib/Qt/qtruby4.rb', line 134

def |(a)
	return Qt::|(self, a)
end

#~(a) ⇒ Object



104
105
106
# File 'lib/Qt/qtruby4.rb', line 104

def ~(a)
	return Qt::~(self, a)
end