Qt: signals of DateTimeEdit?

Discussion in 'Ruby' started by Hadmut Danisch, Aug 16, 2005.

  1. 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
    Hadmut Danisch, Aug 16, 2005
    #1
    1. Advertising

  2. Hadmut Danisch

    Richard Dale Guest

    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
    Richard Dale, Aug 17, 2005
    #2
    1. Advertising

  3. Richard Dale wrote:
    > ...



    Works. Thanks.

    Hadmut
    Hadmut Danisch, Aug 17, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas

    unused bits in signals

    Thomas, Jul 6, 2003, in forum: VHDL
    Replies:
    2
    Views:
    1,061
    Mario Trams
    Jul 6, 2003
  2. Ingmar Seifert

    Delay of control signals

    Ingmar Seifert, Aug 18, 2003, in forum: VHDL
    Replies:
    0
    Views:
    1,189
    Ingmar Seifert
    Aug 18, 2003
  3. Simone Winkler

    generate testbench for array signals

    Simone Winkler, Aug 31, 2003, in forum: VHDL
    Replies:
    1
    Views:
    744
    Pedro Claro
    Sep 2, 2003
  4. walala
    Replies:
    3
    Views:
    720
    Allan Herriman
    Sep 9, 2003
  5. Sajan

    Dumping real signals in VCD

    Sajan, Sep 19, 2003, in forum: VHDL
    Replies:
    8
    Views:
    7,109
    vlsi.engg27
    Jul 21, 2007
Loading...

Share This Page