Qt: Do not use obsolete functions
QDateTime to/from Time_t functions are deprecated in favor of 64-bit to/from seconds since epoch introduced in Qt 5.8. QLayout::setMargin() is deprecated in favor of setContentsMargin().
This commit is contained in:
parent
4b22f71f76
commit
ecaf1897aa
|
@ -61,7 +61,11 @@ QWidget * ExtArgTimestamp::createEditor(QWidget * parent)
|
|||
text = storeValue.trimmed();
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
|
||||
ts = QDateTime::fromSecsSinceEpoch(text.toInt());
|
||||
#else
|
||||
ts = QDateTime::fromTime_t(text.toInt());
|
||||
#endif
|
||||
tsBox = new QDateTimeEdit(ts, parent);
|
||||
tsBox->setDisplayFormat(QLocale::system().dateTimeFormat());
|
||||
tsBox->setCalendarPopup(true);
|
||||
|
@ -83,7 +87,11 @@ void ExtArgTimestamp::onDateTimeChanged(QDateTime t)
|
|||
|
||||
QString ExtArgTimestamp::defaultValue()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
|
||||
return QString::number(QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||
#else
|
||||
return QString::number(QDateTime::currentDateTime().toTime_t());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ExtArgTimestamp::isValid()
|
||||
|
@ -98,7 +106,11 @@ bool ExtArgTimestamp::isValid()
|
|||
|
||||
QString ExtArgTimestamp::value()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
|
||||
return QString::number(ts.toSecsSinceEpoch());
|
||||
#else
|
||||
return QString::number(ts.toTime_t());
|
||||
#endif
|
||||
}
|
||||
|
||||
QString ExtArgTimestamp::prefValue()
|
||||
|
|
|
@ -160,7 +160,7 @@ int VoipCallsInfoModel::columnCount(const QModelIndex &parent) const
|
|||
QVariant VoipCallsInfoModel::timeData(nstime_t *abs_ts, nstime_t *rel_ts) const
|
||||
{
|
||||
if (mTimeOfDay_) {
|
||||
return QDateTime::fromTime_t(nstime_to_sec(abs_ts)).toTimeSpec(Qt::LocalTime).toString("yyyy-MM-dd hh:mm:ss");
|
||||
return QDateTime::fromMSecsSinceEpoch(nstime_to_msec(abs_ts), Qt::LocalTime).toString("yyyy-MM-dd hh:mm:ss");
|
||||
} else {
|
||||
// XXX Pull digit count from capture file precision
|
||||
return QString::number(nstime_to_sec(rel_ts), 'f', 6);
|
||||
|
|
|
@ -159,7 +159,11 @@ const QString file_size_to_qstring(const gint64 size)
|
|||
|
||||
const QString time_t_to_qstring(time_t ti_time)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
|
||||
QDateTime date_time = QDateTime::fromSecsSinceEpoch(qint64(ti_time));
|
||||
#else
|
||||
QDateTime date_time = QDateTime::fromTime_t(uint(ti_time));
|
||||
#endif
|
||||
QString time_str = date_time.toLocalTime().toString("yyyy-MM-dd hh:mm:ss");
|
||||
return time_str;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ AdditionalToolBar * AdditionalToolBar::create(QWidget * parent, ext_toolbar_t *
|
|||
AdditionalToolBar * result = new AdditionalToolBar(toolbar, parent);
|
||||
result->setMovable(false);
|
||||
result->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
result->layout()->setMargin(0);
|
||||
result->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
result->layout()->setSpacing(4);
|
||||
|
||||
GList * walker = toolbar->children;
|
||||
|
@ -248,7 +248,7 @@ QWidget * AdditionalToolbarWidgetAction::createLabelFrame(ext_toolbar_t * item,
|
|||
QWidget * frame = new QWidget(parent);
|
||||
|
||||
QHBoxLayout * frameLayout = new QHBoxLayout(frame);
|
||||
frameLayout->setMargin(0);
|
||||
frameLayout->setContentsMargins(0, 0, 0, 0);
|
||||
frameLayout->setSpacing(0);
|
||||
|
||||
QLabel * strLabel = new QLabel(item->name, frame);
|
||||
|
|
Loading…
Reference in New Issue