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. QCalenderWidget double click event not working or am i doing wrong?
QtWS25 Last Chance

QCalenderWidget double click event not working or am i doing wrong?

Scheduled Pinned Locked Moved General and Desktop
qcalendarwidgetdoubleclickeven
2 Posts 2 Posters 1.4k Views
  • 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.
  • L Offline
    L Offline
    Lorence
    wrote on last edited by
    #1

    class Calendar : public QCalendarWidget
    {
    Q_OBJECT
    public:
    Calendar(QWidget* parent = 0);
    signals:
    void showToDoWindow();
    private:
    void mouseDoubleClickEvent(QMouseEvent*);

    };
    void Calendar::mouseDoubleClickEvent(QMouseEvent *e)
    {
    if ( e->button() == Qt::LeftButton )
    emit showToDoWindow();
    }

    connect(ui->calendarWidget,SIGNAL(showToDoWindow()),this,SLOT(showToDoWindow())); // my connection in mainwindow
    

    void MainWindow::showToDoWindow()
    {// this slot function doesnt execute when the user doubleclick a date in the calendar
    qDebug() << "s";
    } // this slot

    i have a QCalendarWidget in my ui form, im trying to do something when the user double clicks a date in calendar but doesnt work

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      The signal Activated also triggers for db clicks.
      so

      connect(ui->calendarWidget, QCalendarWidget::activated, this , MainWindow::CalendarDBClick);
      
      and the slot function
      public slots:
        void CalendarDBClick(const QDate& Date) {
         setWindowTitle(Date.toString("dd.MM.yyyy"));
        }
      

      No need to subclass, just hook up signal.

      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