From: lolveley Date: 2009-05-12T06:25:00+09:00 Subject: (mandriva,eclipse,Qt) elementary problem : signals and slots hi, I would like to make a little program using Qt : it's a displayer / converter between farenheit and celsius degrees. I also want to use QtDesigner. I made a little widget with QtDesigner, and this widget contains two dials(dial and dial_2) and two spinboxes(kind of textboxes) (spinbox and spinbox_2). There are some connections : see below for the ruby file I obtained with the tool rbuic4 (which converts the ".ui" file into ".rb"). my problem is this : I want that some changes made in dial_2 modify dial (and then spinbox), eg : 0 celsius degrees => 32 farenheit degrees. here is the file made by rbuic4 and after this my try to modify the slot setValue (but it doesn't run: the value of dial is always the same as the one of dial_2. temp.rb ******************************************************************* =begin ** Form generated from reading ui file 'temp.ui' ** ** Created: lun. mai 11 21:43:04 2009 ** by: Qt User Interface Compiler version 4.5.0 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! =end class Ui_Form attr_accessor :dial attr_reader :dial_2 attr_reader :spinBox attr_reader :spinBox_2 def setupUi(form) if form.objectName.nil? form.objectName = "form" end form.resize(400, 300) @dial = Qt::Dial.new(form) @dial.objectName = "dial" @dial.geometry = Qt::Rect.new(90, 40, 91, 101) @dial_2 = Qt::Dial.new(form) @dial_2.objectName = "dial_2" @dial_2.geometry = Qt::Rect.new(230, 30, 91, 121) @spinBox = Qt::SpinBox.new(form) @spinBox.objectName = "spinBox" @spinBox.geometry = Qt::Rect.new(100, 200, 58, 28) @spinBox_2 = Qt::SpinBox.new(form) @spinBox_2.objectName = "spinBox_2" @spinBox_2.geometry = Qt::Rect.new(240, 200, 58, 28) retranslateUi(form) Qt::Object.connect(@dial_2, SIGNAL('valueChanged(int)'), @spinBox_2, SLOT('setValue(int)')) Qt::Object.connect(@dial, SIGNAL('valueChanged(int)'), @spinBox, SLOT('setValue(int)')) Qt::Object.connect(@dial_2, SIGNAL('valueChanged(int)'), @dial, SLOT('setValue(int)')) Qt::MetaObject.connectSlotsByName(form) end # setupUi def setup_ui(form) setupUi(form) end def retranslateUi(form) form.windowTitle = Qt::Application.translate("Form", "Form", nil, Qt::Application::UnicodeUTF8) end # retranslateUi def retranslate_ui(form) retranslateUi(form) end end module Ui class Form < Ui_Form end end # module Ui ******************************************************************* temp_dsc_form.rb ******************************************************************* require 'temp.rb' require 'Qt4' une_appli=Qt::Application.new(ARGV) un_wdg=Qt::Widget.new Un_form=Ui_Form.new Un_form.setupUi(un_wdg) def (Un_form.dial).setValue(v) #super((1.8*v+32).to_i) super(0) end un_wdg.show une_appli.exec ******************************************************************* can you help me? thx, lolveley. ___________________________________________________________________________ Yahoo! Mail r�invente le mail ! D�couvrez le nouveau Yahoo! Mail et son interface r�volutionnaire. http://fr.mail.yahoo.com