Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QCalendarWidget does not propagate signals

QCalendarWidget does not propagate signals

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 848 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    StarEng
    wrote on last edited by
    #1

    Hi all,

    I am trying to work with QCalendarWidget, I need to know when somebody change date...
    But it looks like that QCalendarWindget does not send signal.

    @
    QGridLayout *mycalendarLayout = new QGridLayout();
    QCalendarWidget *calendarWidgetfrom = new QCalendarWidget();
    calendarWidgetfrom->setMinimumDate(QDate(2014,1,1));
    calendarWidgetfrom->setMaximumDate(QDate(2028,1,1));

    calendarWidgetfrom->setSelectionMode(QCalendarWidget::SelectionMode::SingleSelection);
    mycalendarLayout->addWidget(calendarWidgetfrom,0,0,Qt::AlignCenter);

    connect(calendarWidgetfrom, SIGNAL(selectionChanged()), this, SLOT(TestSignal()));

    connect(calendarWidgetfrom,SIGNAL(clicked(QDate)),this, SLOT(DataFromChanged));

    QWidget *myQWidget = new QWidget();
    myQWidget->setLayout(mycalendarLayout);
    m_toolbox->addItem(myQWidget, tr("Calendar"));
    @

    Could you please anybody tell me, what I am doing wrong?

    Thank you!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      Welcome to DevNet!

      Are there any messages in a console when you start your app?

      this one should complain about missing receiver or parentheses.
      @
      connect(calendarWidgetfrom,SIGNAL(clicked(QDate)),this, SLOT(DataFromChanged));
      @

      1 Reply Last reply
      0
      • S Offline
        S Offline
        StarEng
        wrote on last edited by
        #3

        YES, thank you.

        Correct version:
        @connect(calendarWidgetfrom,SIGNAL(clicked(QDate)),this, SLOT(DataFromChanged(const QDate&)));@

        Thank you!

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          I would suggest to use "new signal/slot syntax":http://qt-project.org/wiki/New_Signal_Slot_Syntax

          It will help to avoid such errors.
          For your example
          @
          connect(calendarWidgetfrom, &QCalendarWidget::selectionChanged, this, &Widget::TestSignal);
          connect(calendarWidgetfrom, &QCalendarWidget::clicked, this, &Widget::DataFromChanged);
          @

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved