You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdebindings/qtruby/rubylib/examples/passivepopup/passivepopup.rb

40 lines
937 B

#!/usr/bin/env ruby
require 'Qt'
class PassiveWindow < TQt::Frame
MARGIN = 20
def initialize(message)
super(nil, "passivedlg",
TQt::WStyle_Customize | TQt::WX11BypassWM | TQt::WStyle_StaysOnTop |
TQt::WStyle_Tool | TQt::WStyle_NoBorder)
setFrameStyle(TQt::Frame::Box| TQt::Frame::Plain)
setLineWidth(2)
setMinimumWidth(100)
layout=TQt::VBoxLayout.new(self, 6, 11)
layout.setAutoAdd(true)
TQt::Label.new(message, self)
quit=TQt::PushButton.new(tr("Close"), self)
connect(quit, SIGNAL("clicked()"), SLOT("close()"))
end
def show
super
move(TQt::Application.desktop().width() - width() - MARGIN,
TQt::Application.desktop().height() - height() - MARGIN)
end
end
if (Process.fork != nil)
exit
end
app = TQt::Application.new(ARGV)
win = PassiveWindow.new(ARGV[0])
app.mainWidget = win
win.show
app.exec