Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   Qt: signals of DateTimeEdit? (http://www.velocityreviews.com/forums/t823653-qt-signals-of-datetimeedit.html)

Hadmut Danisch 08-16-2005 08:29 PM

Qt: signals of DateTimeEdit?
 
Hi,

I'm just writing an application with ruby Qt and tried to connect a
signal from a DateTimeEdit widget.

The Qt doc says it has a signal

void QDateTimeEdit::valueChanged ( const QDateTime & datetime ) [signal]


Unfortunately, ruby Qt just comes with some examples, no Docs.

How would that signal be named? Whatever I tried so far, I always get
the error message

QObject::connect: No such signal Qt::DateTimeEdit::valueChanged()


How would I list the available slots and signals?


Hadmut

Richard Dale 08-17-2005 01:08 AM

Re: Qt: signals of DateTimeEdit?
 
Hadmut Danisch wrote:

> Hi,
>
> I'm just writing an application with ruby Qt and tried to connect a
> signal from a DateTimeEdit widget.
>
> The Qt doc says it has a signal
>
> void QDateTimeEdit::valueChanged ( const QDateTime & datetime ) [signal]
>
>
> Unfortunately, ruby Qt just comes with some examples, no Docs.
>
> How would that signal be named? Whatever I tried so far, I always get
> the error message
>
> QObject::connect: No such signal Qt::DateTimeEdit::valueChanged()

You need a type signature of 'const QDateTime&' in the string passed to
SIGNAL() like this:

require 'Qt'

class DateShow < Qt::Object
slots 'dateChanged(const QDateTime&)'

def dateChanged(date)
puts "date: %s" % date.toString
end
end

app = Qt::Application.new(ARGV)
date_edit = Qt::DateTimeEdit.new()
show_date = DateShow.new
Qt::Object.connect( date_edit,
SIGNAL('valueChanged(const QDateTime&)'),
show_date,
SLOT('dateChanged(const QDateTime&)') )
app.setMainWidget(date_edit)
date_edit.show
app.exec

>
> How would I list the available slots and signals?

Use Qt::MetaObject.slotNames() and signalNames() methods:

irb(main):002:0> d = Qt::DateTimeEdit.new
=> #<Qt::DateTimeEdit:0x3044a9a0 name="unnamed", x=256, y=230, width=512,
height=307>
irb(main):003:0> d.metaObject.signalNames(true)
=> ["destroyed()", "destroyed(QObject*)", "valueChanged(const QDateTime&)"]
irb(main):004:0> d.metaObject.slotNames(true)
=> ["deleteLater()", "cleanupEventFilter(QObject*)", "setEnabled(bool)",
"setDisabled(bool)", "setCaption(const QString&)", "setIcon(const
QPixmap&)", "setIconText(const QString&)", "setMouseTracking(bool)",
"setFocus()", "clearFocus()", "setUpdatesEnabled(bool)", "update()",
"update(int,int,int,int)", "update(const QRect&)", "repaint()",
"repaint(bool)", "repaint(int,int,int,int)",
"repaint(int,int,int,int,bool)", "repaint(const QRect&)", "repaint(const
QRect&,bool)", "repaint(const QRegion&)", "repaint(const QRegion&,bool)",
"show()", "hide()", "setShown(bool)", "setHidden(bool)", "iconify()",
"showMinimized()", "showMaximized()", "showFullScreen()", "showNormal()",
"polish()", "constPolish()", "close()", "raise()", "lower()",
"stackUnder(QWidget*)", "move(int,int)", "move(const QPoint&)",
"resize(int,int)", "resize(const QSize&)", "setGeometry(int,int,int,int)",
"setGeometry(const QRect&)", "adjustSize()", "focusProxyDestroyed()",
"setDateTime(const QDateTime&)", "newValue(const QDate&)", "newValue(const
QTime&)"]

-- Richard


Hadmut Danisch 08-17-2005 07:16 PM

Re: Qt: signals of DateTimeEdit?
 
Richard Dale wrote:
> ...



Works. Thanks.

Hadmut


All times are GMT. The time now is 03:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.