// **************************************************************************** bool CViewTextFormated::parse(xmlNodePtr cur,CInterfaceGroup * parentGroup) { if (!CViewText::parse(cur, parentGroup)) return false; CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"format" )); if (prop) setFormatString(ucstring((const char *) prop)); else setFormatString(ucstring("$t")); return true; }
//! [6] void Window::createDateTimeEdits() { editsGroup = new QGroupBox(tr("Date and time spin boxes")); QLabel *dateLabel = new QLabel; QDateEdit *dateEdit = new QDateEdit(QDate::currentDate()); dateEdit->setDateRange(QDate(2005, 1, 1), QDate(2010, 12, 31)); dateLabel->setText(tr("Appointment date (between %0 and %1):") .arg(dateEdit->minimumDate().toString(Qt::ISODate)) .arg(dateEdit->maximumDate().toString(Qt::ISODate))); //! [6] //! [7] QLabel *timeLabel = new QLabel; QTimeEdit *timeEdit = new QTimeEdit(QTime::currentTime()); timeEdit->setTimeRange(QTime(9, 0, 0, 0), QTime(16, 30, 0, 0)); timeLabel->setText(tr("Appointment time (between %0 and %1):") .arg(timeEdit->minimumTime().toString(Qt::ISODate)) .arg(timeEdit->maximumTime().toString(Qt::ISODate))); //! [7] //! [8] meetingLabel = new QLabel; meetingEdit = new QDateTimeEdit(QDateTime::currentDateTime()); //! [8] //! [9] QLabel *formatLabel = new QLabel(tr("Format string for the meeting date " "and time:")); QComboBox *formatComboBox = new QComboBox; formatComboBox->addItem("yyyy-MM-dd hh:mm:ss (zzz 'ms')"); formatComboBox->addItem("hh:mm:ss MM/dd/yyyy"); formatComboBox->addItem("hh:mm:ss dd/MM/yyyy"); formatComboBox->addItem("hh:mm:ss"); formatComboBox->addItem("hh:mm ap"); //! [9] //! [10] connect(formatComboBox, SIGNAL(activated(QString)), this, SLOT(setFormatString(QString))); //! [10] setFormatString(formatComboBox->currentText()); //! [11] QVBoxLayout *editsLayout = new QVBoxLayout; editsLayout->addWidget(dateLabel); editsLayout->addWidget(dateEdit); editsLayout->addWidget(timeLabel); editsLayout->addWidget(timeEdit); editsLayout->addWidget(meetingLabel); editsLayout->addWidget(meetingEdit); editsLayout->addWidget(formatLabel); editsLayout->addWidget(formatComboBox); editsGroup->setLayout(editsLayout); }
void CViewTextFormated::setProperty( const std::string &name, const std::string &value ) { if( name == "format" ) { setFormatString( value ); return; } else CViewText::setProperty( name, value ); }