本文整理汇总了C++中QDateTimeEdit::setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QDateTimeEdit::setMinimumHeight方法的具体用法?C++ QDateTimeEdit::setMinimumHeight怎么用?C++ QDateTimeEdit::setMinimumHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTimeEdit
的用法示例。
在下文中一共展示了QDateTimeEdit::setMinimumHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_btSetTime_clicked
void PosService::on_btSetTime_clicked()
{
int button_width = data->getVariables()->value(_S("standart_button_width")).toInt();
int button_height = data->getVariables()->value(_S("standart_button_height")).toInt();
int button_margin = data->getVariables()->value(_S("standart_margins")).toInt();
QDialog dlg;
QVBoxLayout* mainLayout = new QVBoxLayout();
dlg.setLayout(mainLayout);
dlg.setWindowTitle(_T("Установка времени"));
QDateTimeEdit* edit = new QDateTimeEdit(QDateTime::currentDateTime());
edit->setMaximumHeight(button_height);
edit->setMinimumHeight(button_height);
mainLayout->addWidget(edit);
QHBoxLayout *btLayout = new QHBoxLayout();
mainLayout->addLayout(btLayout);
QPushButton* bt;
bt = new QPushButton(_T("OK"), this);
bt->setMaximumSize(button_width * 2 + button_margin, button_height);
bt->setMinimumSize(button_width * 2 + button_margin, button_height);
btLayout->addWidget(bt);
connect(bt, SIGNAL(clicked()), &dlg, SLOT(accept()));
bt = new QPushButton(_T("Отмена"), this);
bt->setMaximumSize(button_width * 2 + button_margin, button_height);
bt->setMinimumSize(button_width * 2 + button_margin, button_height);
btLayout->addWidget(bt);
connect(bt, SIGNAL(clicked()), &dlg, SLOT(reject()));
int result = dlg.exec();
if(result==QDialog::Accepted)
{
QString dt = edit->dateTime().toString(data->getSettings()->value("posservice/command_setdatetime_format").toString());
QString command = data->getSettings()->value("posservice/command_setdatetime").toString().arg(dt);
if (loglevel > 0)
qDebug() << _T("%1 Устанавливаем новое время: %2 (было: %3)")
.arg(posForLog)
.arg(edit->dateTime().toString(Qt::ISODate))
.arg(QDateTime::currentDateTime().toString(Qt::ISODate));
int result = QProcess::execute(command);
if(result<0)
{
qDebug() << _T("%1 Ошибка установки нового времени. Код ошибки: %2")
.arg(posForLog)
.arg(result);
QMessageBox message;
message.setText(_T("Ошибка установки нового времени.\nКод ошибки: %1").arg(result));
message.exec();
}
}
}