Qt. Dialog and main windows location

I’m new in Qt. I create main and dialog windows in Qt4 Designer. I want
to place dialog window in the middle of main window, and place main
window in the center of screen. Is it possible?

code:
require ‘Qt4’
require ‘mainwindow.rb’
require ‘logindialog.rb’

class MW < Qt::MainWindow
slots ‘setfocus()’
def initialize parent=nil
super
@ui = Ui_MW.new
@ui.setupUi self

end
end

class LoginDL < Qt::Dialog
slots ‘enter_click()’
def initialize parent=nil
super
@ui = Ui_LoginDL.new
@ui.setupUi self

end

end

if $0 == FILE
app = Qt::Application.new(ARGV)
$mainw = MW.new
$mainw.show

loginw=LoginDL.new
loginw.show
app.exec

end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs