当前位置: 首页>>代码示例>>C++>>正文


C++ QTableWidgetItem::setWhatsThis方法代码示例

本文整理汇总了C++中QTableWidgetItem::setWhatsThis方法的典型用法代码示例。如果您正苦于以下问题:C++ QTableWidgetItem::setWhatsThis方法的具体用法?C++ QTableWidgetItem::setWhatsThis怎么用?C++ QTableWidgetItem::setWhatsThis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTableWidgetItem的用法示例。


在下文中一共展示了QTableWidgetItem::setWhatsThis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setPageWhatsThis

/*!
    Sets the \a whatsthis of page at \a index.

    \sa pageWhatsThis()
*/
void QxtConfigWidget::setPageWhatsThis(int index, const QString& whatsthis)
{
    QTableWidgetItem* item = qxt_d().item(index);
    if (item)
    {
        item->setWhatsThis(whatsthis);
    }
    else
    {
        qWarning("QxtConfigWidget::setPageWhatsThis(): Unknown index");
    }
}
开发者ID:npsm,项目名称:libqxt,代码行数:17,代码来源:qxtconfigwidget.cpp

示例2: jours

EmploiDuTemps::EmploiDuTemps(QDate d, QWidget *parent) :
    QDialog(parent), lundi(d),
    ui(new Ui::EmploiDuTemps)
{
    ui->setupUi(this);
    ui->stackedWidget->setHidden(true);

    ui->labelNumero->setText(QDate::shortDayName(d.dayOfWeek())+d.toString(Qt::SystemLocaleShortDate)+" au "+QDate::shortDayName(d.addDays(6).dayOfWeek())+d.addDays(6).toString(Qt::SystemLocaleShortDate));

    ui->tableWidget->setColumnCount(7);
    QStringList jours(QDate::shortDayName(d.dayOfWeek())+d.toString(Qt::SystemLocaleShortDate));
        for (unsigned int i=1; i<7; i++) {
            jours.append((QDate::shortDayName(d.addDays(i).dayOfWeek()))+(d.addDays(i)).toString(Qt::SystemLocaleShortDate));
        }
    ui->tableWidget->setHorizontalHeaderLabels(jours);
    ui->tableWidget->verticalHeader()->setHidden(true);

    unsigned int nbRow =0;
    ui->tableWidget->setRowCount(nbRow);



    QDate jour1(d.year(), d.month(), d.day());
    QDate jour7=d.addDays(7);
    unsigned int prog = 0;


    QBrush coulEvt (QColor(191,117,255));
    QBrush coulTache (QColor(85,255,127));

    for (QDate jour=jour1; jour<jour7; jour = jour.addDays(1)){
            unsigned int nb=0;
            for(QMap<QDateTime, Programmation*>::const_iterator it = ProgrammationManager::getInstance().getProgrammations().cbegin();
                it != ProgrammationManager::getInstance().getProgrammations().cend();
                it++){
                if(it.key().date()== jour){
                    //afficher
                    QTableWidgetItem* item = new QTableWidgetItem;
                    if(it.value()->getEvenement()!=0){
                        item->setWhatsThis(it.value()->getEvenement()->getNom());
                        item->setText((*it)->getTime().toString("HH:mm")+" : "+(*it)->getEvenement()->getNom()+"\n\ndurée : "+(*it)->getDuree().stringDuree()+"\n\n");
                        item->setBackground(coulEvt);
                        prog++;
                    }
                    else if (it.value()->getTache()!=0){
                        item->setWhatsThis(it.value()->getTache()->getId());
                        item->setText((*it)->getTime().toString("HH:mm")+" : "+(*it)->getTache()->getId()+"\n\ndurée : "+(*it)->getDuree().stringDuree()+" \n\n");
                        item->setBackground(coulTache);
                        prog++;
                    }
                    if(nb>=nbRow){
                        nbRow+=5;
                        ui->tableWidget->setRowCount(nbRow);
                    }
                    ui->tableWidget->setItem(nb,(jour.dayOfWeek()-1),item);

                    nb++;
                }
            }

        }


    ui->tableWidget->resizeRowsToContents();
    if(prog==0)
        QMessageBox::information(this, "Message", "Il n'y a pas encore de programmation pour la semaine choisie.");



    QObject::connect(ui->pushButtonFermer, SIGNAL(clicked()),this,SLOT(close()));
    QObject::connect(ui->pushButtonChange, SIGNAL(clicked()),this,SLOT(changeEdt()));
    QObject::connect(ui->tableWidget, SIGNAL(cellClicked(int,int)),this,SLOT(afficheInfos(int, int)));

}
开发者ID:TheoJD,项目名称:ApplicationGestionDeProjets,代码行数:74,代码来源:emploidutemps.cpp

示例3: SetDatesInCalendar

//Method to set dates in Calendar
         void MonthView::SetDatesInCalendar(QDate dtStartDate, QDate dtEndDate, bool toFillData)
         {
                m_ptr_growth_animation_timer->stop();

                 int dayStartDate = dtStartDate.day();
                 int StartMonthDays = dtStartDate.daysInMonth();//Total days in selected month


                 int dayCurrMonth = 1;
                 int dayNextMonth = 1;
                   all_week_data = 0;
                 qreal week_total = 0;
                 int data = 0;
                 int sourceData = 0;

                 for(int row = 0; row < 6; row++)
                 {
                          week_total = 0; //add_Weekly_total = true;


                         for(int col = 0; col < 7; col++)
                            {

                              if ( m_vector_vector_view_selected_day_usage_values.size() != 42)
                             {
                                  data = 0 ; sourceData =0;
                              } else
                              {
                              data = (qreal)((qreal)(50 * ( m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][0] + m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][1] + m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][2] + m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][3] + m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][4]  ) ))/MaxUnit     ; //    qrand() % ((ui->tblDates->rowHeight(0) + 1) - 5) + 5;
                              sourceData  = (qreal)((qreal)(50 * ( m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][source_name] )))/MaxUnit;//    qrand() % (((data/2) + 1) - 2) + 2;  // data % 2;
                          }
                                //Previous Month
                                 if(dayStartDate <= StartMonthDays)
                                 {
                                          QTableWidgetItem *item = new QTableWidgetItem();

                                          int day = dayStartDate++;
                                          item->setData(0,
                                                         qVariantFromValue(StarRating(day,0,0, source_name,data,sourceData)));

                                          if(dtStartDate.day() > 1)//When 3 months are displayed in Calendar, only then prev month date is grayed out
                                          {

                                              item->setData(0,
                                                             qVariantFromValue(StarRating(0,0,0, source_name,data,sourceData)));
                                              data = 0;// Make it zero as not to be added with total
                                          }

                                          item->setTextAlignment(Qt::AlignTop | Qt::AlignRight);

                                          QDate dt(dtStartDate.year(),dtStartDate.month(), locale->toInt(QString::number(day)));
                                          QString str(dt.toString());
                                          item->setWhatsThis(str);

                                          if(dt.operator >(QDate::currentDate()))
                                           {

                                               data= 0;
                                              if(dt.month() == QDate::currentDate().month() && dt.month() == StartDate.month()) //compare to current as well as calendar's month
                                               {
                                                 item->setData(0,
                                                              qVariantFromValue(StarRating(-day,data,0, source_name,data,0)));
                                               }
                                               else
                                               {
                                                   item->setData(0,
                                                                qVariantFromValue(StarRating(0,data,0, source_name,data,0)));
                                               }
                                           }
                                          ui->tblDates->setItem(row,col,item);


                                 }
                                 else
                                 {
                                         QDate date = dtStartDate.addMonths(1);
                                         int CurrentMonthDays = date.daysInMonth();
                                         //Current month
                                         if(dayCurrMonth <= CurrentMonthDays)
                                         {
                                                  QTableWidgetItem *item = new QTableWidgetItem();
                                                  int day = dayCurrMonth++;
                                                   item->setData(0,
                                                                  qVariantFromValue(StarRating(day,0,0, source_name,data,sourceData)));


                                                  if(dtStartDate.day() == 1)//When 2 months are displayed in Calendar, only then current month date is grayed out
                                                  {

                                                      item->setData(0,
                                                                     qVariantFromValue(StarRating(0,0,0, source_name,data,sourceData)));
                                                      data = 0;// Make it zero as not to be added with total

                                                  }

                                                  item->setTextAlignment(Qt::AlignTop | Qt::AlignHCenter);
                                                  QDate dt(date.year(),date.month(), locale->toInt(QString::number(day)));
                                                  QString str(dt.toString());
                                                  item->setWhatsThis(str);
//.........这里部分代码省略.........
开发者ID:NeerajDev,项目名称:GrizzlyPeak,代码行数:101,代码来源:MonthView.cpp


注:本文中的QTableWidgetItem::setWhatsThis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。