From: Pau Garcia i Quiles Date: 2006-06-28T22:02:18+09:00 Subject: Re: QInputDialog syntax Quoting Graham Smith : > Hi, > > I'm new to Ruby and QtRuby. I have used kdevelop to create my first Qt based > program and am struggling with the conversion between the C++ syntax used in > the Qt Reference Document and actual Ruby syntax. In particular > QInputDialog::getText > > I was wondering if someone could provide an example on how to use > QInputDialog::getText to get a string input and determine whether the user > pressed the 'Ok' or 'Cancel' button. > > Is there any Ruby documentation available for the Qt library? This is a KInputDialog example, but QInputDialog is the same: @re = Qt::RegExp.new( "^[\\d\\w][-,&/\\d\\s\\w]*") brandValidator = Qt::RegExpValidator.new(@re, self) item = KDE::InputDialog.getText("New #{@label.downcase}", \ "Enter new #{@label.downcase}", \ nil, \ true, \ self, \ "AddItem", \ brandValidator, \ nil ) I advise to buy Caleb Tennis' QtRuby book and "C++ GUI Programming with Qt3". The latter is C++, but you will need it if you want to develop anything serious with Qt without getting crazy. You won't need to know a lot of C++ to understand it. Caleb's book is a good start, but you need a lot more. You can also hang around #qtruby at freenode. Richard Dale and I are usually there. Not that I know a lot about Qt, Ruby or QtRuby yet, but he is a genius. Really.