module Qt::Internal

following are patches to QtJambi classes, mostly for compatibility with qtruby Corresponding Procs are ‘class_eval-ed’ when a Qt class is activated see companion code: qt_jbindings Qt#const_missing

'signature' calls are for documentation only (e.g. classexplorer.rb) and have
no effect on the functionality

Constants

AbstractSlider
AbstractTextDocumentLayout

QtRuby uses: Qt::AbstractTextDocumentLayout::PaintContext.new QtJambi : Qt::AbstractTextDocumentLayout_PaintContext

Application
ByteArray
DONT_ABBREVIATE
for all constants which inherit from the Enum class or are  "public static final int" fields
define a shorthand notation to be compatible with the Ruby version of qtbindings
e.g. Qt::PenStyle::SolidLine can be abbreviated to Qt::SolidLine

suppress clashing or otherwise undesirable shorthands with an entry in the DONT_ABBREVIATE hash.

DataStream
EmbeddedClasses
Packages

define here which packages to include

RUBY_extensions

keep track of RUBY extensions for classexplorer

Signature2Signal
this table overrides the default signature to method name mapping

signals mapped to an empty string are ignored

Public Class Methods

new(*args) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 619
def initialize(*args)
  if ((args.size==0) || ((args.size==1) && args[0].nil?))
    orig_initialize()
  else
    orig_initialize(*args)
  end
end
Also aliased as: orig_initialize

Private Class Methods

_singleShot(action,receiver,method) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 607
def _singleShot(action,receiver,method)
  receiver.send(method)
  @pendingactions.delete(action)
end
orig_singleShot(timeout,receiver,method)
Alias for: singleShot
singleShot(timeout,receiver,method) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 598
def singleShot(timeout,receiver,method)
  method =(md=method.match(/([^(]+)\([.]*/)) ? md[1].to_sym : method.to_sym unless method.kind_of? Symbol
    @pendingactions ||= []
    action=Qt::RubySignalAction.new(self,:_singleShot)
    action.append_args(action,receiver,method)
    @pendingactions << action
    orig_singleShot(timeout,action,'signal0()')
end
Also aliased as: orig_singleShot

Public Instance Methods

&(other) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 330
def &(other) ; int_op(other) { |a,b| a&b} ; end
<<(arg) click to toggle source
# File lib/qt_connect/qt_compat.rb, line 183
def <<(arg)
  case arg
    when String ; writeString(arg)
    when Float,Java::Float ; writeFloat(arg)
    when Fixnum,Java::Int ; writeInt(arg)
    when Java::Double ; writeDouble(arg)
    when Java::ComTrolltechQtGui::QPixmap,
          Java::ComTrolltechQtGui::QImage,
          Java::ComTrolltechQtCore::QPointF,
          Java::ComTrolltechQtCore::QPoint,
          Java::ComTrolltechQtCore::QRect,
          Java::ComTrolltechQtCore::QRectF,
          Java::ComTrolltechQtGui::QRegion,
          Java::ComTrolltechQtCore::QSize,
          Java::ComTrolltechQtCore::QSizeF
        arg.writeTo(self)
    else 
      raise "Qt::Datastream: no '<<' for #{arg.class}"
  end
  self # allows concatenation
end
==(other) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 334
def ==(other)
  o=other.respond_to?(:value) ? other.value : other
  self.value==o
end
>>(arg) click to toggle source
# File lib/qt_connect/qt_compat.rb, line 204
def >>(arg)
  case arg
    when String ; arg=readString
    when Float ; arg=readFloat
    when Fixnum ; arg=readInt
    when Java::ComTrolltechQtGui::QPixmap,
          Java::ComTrolltechQtGui::QImage,
          Java::ComTrolltechQtCore::QPointF,
          Java::ComTrolltechQtCore::QPoint,
          Java::ComTrolltechQtCore::QRect,
          Java::ComTrolltechQtCore::QRectF,
          Java::ComTrolltechQtGui::QRegion,
          Java::ComTrolltechQtCore::QSize,
          Java::ComTrolltechQtCore::QSizeF
    arg.readFrom(self)
  else
    raise "Qt::Datastream: no '>>' for #{arg.class}"
  end
  self
end
^(other) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 331
def ^(other) ; int_op(other) { |a,b| a^b} ; end
orig_setVersion(a)
Alias for: setVersion
setVersion(a) click to toggle source
# File lib/qt_connect/qt_compat.rb, line 178
def setVersion(a)
  orig_setVersion(a.respond_to?(:value) ? a.value : a)
end
Also aliased as: orig_setVersion, set_version, version=
set_version(a)
Alias for: setVersion
signature(*args) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 53
def signature(*args)
  RUBY_extensions.concat(args)
end
Also aliased as: signatures
signatures(*args)
Alias for: signature
to_i() click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 339
def to_i
  return value
end
to_int() click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 342
def to_int
  return value
end
version=(a)
Alias for: setVersion
|(other) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 329
def |(other) ; int_op(other) { |a,b| a|b} ; end
~() click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 332
def ~ ; unary_op{ |a| ~a} ; end

Private Instance Methods

*(other) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 390
def *(other) return other.map(self) if other.kind_of?(Qt::Matrix) ; end
+(other) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 416
def +(other) ;  operator_add(other) ; end
-(other) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 417
def -(other) ;  operator_subtract(other) ; end
-@() click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 439
def -@ ; cl=clone ; cl.setX(-x) ; cl.setY(-y) ; cl ; end
/(other) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 440
def /(other) ;  clone.divide(other) ; end
addAction(*a) click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 519
def addAction(*a)
  args=a.dup
  n=0
  if args.size > 2
    if args[0].kind_of?(String)
      n=1 if args[2].kind_of?(String)
    else
      n=2 if (args.size > 3) && (args[3].kind_of?(String))
    end
  end
  if n>0
    @rubysignalactions ||= []
    @rubysignalactions << Qt::RubySignalAction.new(args[n],args[n+1])
    args[n]=@rubysignalactions[-1]
    args[n+1]='signal0()'
    #args[0]=args[0].value if args[0].respond_to?(:value)
  end
  orig_addAction(*args)
end
Also aliased as: orig_addAction, orig_addAction, orig_addAction
int_op(other) { |value,respond_to?(:value) ? value : other| ... } click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 362
def int_op(other)
  r=yield(value,other.respond_to?(:value) ? other.value : other)
  return self.class.new(r) if self.class.ancestors.include? com.trolltech.qt.QFlags
  return other.class.new(r) if other.class.ancestors.include? com.trolltech.qt.QFlags
  begin
    obj=self.class.createQFlags(self)
    obj.value=r
    return obj
  rescue
  end
  begin
    obj=other.class.createQFlags(self)
    obj.value=r
    return obj
  rescue
    #raise ArgumentError, "operation not defined between #{self.class} and #{other.class}"
    return r
  end
end
orig_addAction(*a)
Alias for: addAction
orig_initialize(*args)
Alias for: new
unary_op() { |value| ... } click to toggle source

~ def coerce(other) ~ [(other.respond_to?(:value)) ? other.value : other, value] ~ end

# File lib/qt_connect/qt_jbindings.rb, line 350
def unary_op
  r=yield(value)
  return self.class.new(r) if self.class.ancestors.include? com.trolltech.qt.QFlags
  begin
    obj=self.class.createQFlags(self)
    obj.value=r
    return obj
  rescue
    return r
  end
end