How to interact with each cell in calender



  • weather i can use the same cell IN CALENDER WIDGET for two clicking instance that means if i click once it will show information on textbrowser…AND when i click again it move to the another dialog n both click is done one after another...

    i had write code for that but the problem is that..at first click it will show information on textbrowser but after that i hv to double click the cell to perform next operation...

    @#include "seecyclem.h"
    #include "ui_seecyclem.h"
    #include "setcyclem.h"
    #include "ui_setcyclem.h"
    SeeCycleM::SeeCycleM(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SeeCycleM)
    {
    ui->setupUi(this);

    connect(ui->calendarWidget,SIGNAL(clicked(QDate)),this,SLOT(showDate(QDate)));
    connect(ui->calendarWidget,SIGNAL(activated(QDate)),this,SLOT(showset()));
    

    }
    void SeeCycleM::showDate(QDate date)
    {
    ui->lineEdit->setText(date.toString());
    }
    void SeeCycleM::showset()
    {

    SetCycleM a(this);
    connect(&a,SIGNAL(setclicked()),this,SLOT(setcolors()));
    connect(&a,SIGNAL(unsetClicked()),this,SLOT(unsetColors()));
    a.show();
    a.exec();
    

    }
    void SeeCycleM::setcolors()
    {

    safedate.setBackground(Qt::green);
    
    unsafedate.setBackground(Qt::yellow);
    
    fertiledate.setBackground(Qt::red);
    
    startdate.setBackground(Qt::blue);
    
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,1),startdate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,5),safedate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,8),unsafedate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,9),fertiledate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,12),unsafedate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,14),safedate);
    

    }
    void SeeCycleM::unsetColors()
    {
    startdate.clearBackground();

    safedate.clearBackground();
    
    unsafedate.clearBackground();
    
    fertiledate.clearBackground();
    
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,1),startdate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,5),safedate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,8),unsafedate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,9),fertiledate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,12),unsafedate);
    ui->calendarWidget->setDateTextFormat(QDate(2011,4,14),safedate);
    

    }
    SeeCycleM::~SeeCycleM()
    {
    delete ui;
    }@



  • I highlighted your code (don't forget to do it by yourself next time), but it looks like part of code was lost. Can you check it and fix?



  • This is the exact same topic as "this":http://developer.qt.nokia.com/forums/viewthread/5205/P15/#31601 thread. Closing.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.