Qt. Dialog and main windows location

B

born in USSR

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?
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top