Class: Qt::Base

Inherits:
Object show all
Defined in:
lib/Qt/qtruby4.rb,
lib/qttest/qttest.rb,
ext/ruby/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, GraphicsSceneDragDropEvent, 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, Timer, 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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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

#&(a) ⇒ Object



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

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

#*(a) ⇒ Object



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

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

#**(a) ⇒ Object



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

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

#+(a) ⇒ Object



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

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

#-(a) ⇒ Object



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

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

#-@Object



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

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

#/(a) ⇒ Object



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

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() explicitly


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

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

#<<(a) ⇒ Object



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

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

#<=(a) ⇒ Object



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

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() explicitly


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

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

#>(a) ⇒ Object



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

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

#>=(a) ⇒ Object



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

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

#>>(a) ⇒ Object



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

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

#^(a) ⇒ Object



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

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:



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

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

#methods(regular = true) ⇒ Object



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

def methods(regular=true)
  if !regular
    return singleton_methods
  end

  qt_methods(super, 0x0)
end

#protected_methods(all = true) ⇒ Object



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

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

#public_methods(all = true) ⇒ Object



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

def public_methods(all=true)
  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_methods(all = true) ⇒ Object



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

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

#|(a) ⇒ Object



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

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

#~(a) ⇒ Object



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

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