Qt started to support std::chrono since Qt 5.8.
This commit is contained in:
parent
3c1f5c04ca
commit
1a4a22849c
|
@ -391,7 +391,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
|
|||
|
||||
if (m_cmd->IsGuiEnabled())
|
||||
{
|
||||
QTimer::singleShot(SECONDS(1), this, &VPMainWindow::SetDefaultGUILanguage);
|
||||
QTimer::singleShot(V_SECONDS(1), this, &VPMainWindow::SetDefaultGUILanguage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ TMainWindow::TMainWindow(QWidget *parent)
|
|||
|
||||
if (MApplication::VApp()->IsAppInGUIMode())
|
||||
{
|
||||
QTimer::singleShot(SECONDS(1), this, &TMainWindow::SetDefaultGUILanguage);
|
||||
QTimer::singleShot(V_SECONDS(1), this, &TMainWindow::SetDefaultGUILanguage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ DialogLayoutProgress::DialogLayoutProgress(QElapsedTimer timer, qint64 timeout,
|
|||
m_progressTimer->stop();
|
||||
}
|
||||
});
|
||||
m_progressTimer->start(SECONDS(1));
|
||||
m_progressTimer->start(V_SECONDS(1));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -96,7 +96,7 @@ void VWidgetDetails::UpdateList()
|
|||
// The filling table is a very expensive operation. This optimization will postpone it.
|
||||
// Each time a new request happen we will wait 800 ms before calling it. If at this time a new request will arrive
|
||||
// we will wait 800 ms more. And so on, until nothing happens within 800ms.
|
||||
m_updateListTimer->start(MSECONDS(800));
|
||||
m_updateListTimer->start(V_MSECONDS(800));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -474,7 +474,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
if (VApplication::IsGUIMode())
|
||||
{
|
||||
QTimer::singleShot(SECONDS(1), this, &MainWindow::SetDefaultGUILanguage);
|
||||
QTimer::singleShot(V_SECONDS(1), this, &MainWindow::SetDefaultGUILanguage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2139,7 +2139,7 @@ void MainWindow::MeasurementsChanged(const QString &path)
|
|||
{
|
||||
m_mChanges = true;
|
||||
m_mChangesAsked = false;
|
||||
m_measurementsSyncTimer->start(MSECONDS(1500));
|
||||
m_measurementsSyncTimer->start(V_MSECONDS(1500));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2149,7 +2149,7 @@ void MainWindow::MeasurementsChanged(const QString &path)
|
|||
{
|
||||
m_mChanges = true;
|
||||
m_mChangesAsked = false;
|
||||
m_measurementsSyncTimer->start(MSECONDS(1500));
|
||||
m_measurementsSyncTimer->start(V_MSECONDS(1500));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6010,7 +6010,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
|
|||
{
|
||||
/* Collect garbage only after successfully parse. This way wrongly accused items have one more time to restore
|
||||
* a reference. */
|
||||
QTimer::singleShot(100, Qt::CoarseTimer, this, [this](){doc->GarbageCollector(true);});
|
||||
QTimer::singleShot(V_MSECONDS(100), Qt::CoarseTimer, this, [this](){doc->GarbageCollector(true);});
|
||||
}
|
||||
|
||||
m_patternReadOnly = doc->IsReadOnly();
|
||||
|
|
|
@ -119,6 +119,13 @@
|
|||
#include <QTimer>
|
||||
#include <functional>
|
||||
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif
|
||||
|
||||
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly");
|
||||
const QString VPattern::AttrLabelPrefix = QStringLiteral("labelPrefix");
|
||||
|
||||
|
@ -275,7 +282,7 @@ void VPattern::Parse(const Document &parse)
|
|||
}
|
||||
if (VApplication::IsGUIMode())
|
||||
{
|
||||
QTimer::singleShot(1000, Qt::VeryCoarseTimer, this, &VPattern::RefreshPieceGeometry);
|
||||
QTimer::singleShot(V_SECONDS(1), Qt::VeryCoarseTimer, this, &VPattern::RefreshPieceGeometry);
|
||||
}
|
||||
else if (VApplication::VApp()->CommandLine()->IsTestModeEnabled())
|
||||
{
|
||||
|
|
|
@ -73,4 +73,20 @@ void qAsConst(const T &&) Q_DECL_EQ_DELETE;
|
|||
#define NANOSECONDS(x) SUFFIX_APPEND(x, _ns) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#endif // __cplusplus >= 201402L
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
|
||||
#define V_HOURS(x) HOURS(x) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_MINUTES(x) MINUTES(x) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_SECONDS(x) SECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_MSECONDS(x) MSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_MICSECONDS(x) MICSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_NANOSECONDS(x) NANOSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#else
|
||||
#define V_HOURS(x) (x * 3600000) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_MINUTES(x) (x * 60000) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_SECONDS(x) (x * 1000) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_MSECONDS(x) (x) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_MICSECONDS(x) (x) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#define V_NANOSECONDS(x) (x) // NOLINT(cppcoreguidelines-macro-usage)
|
||||
#endif
|
||||
|
||||
#endif // DEFGLOBAL_H
|
||||
|
|
|
@ -74,6 +74,13 @@
|
|||
#include <QUuid>
|
||||
#include <QtMath>
|
||||
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif
|
||||
|
||||
// Current version of seam allowance tag need for backward compatibility
|
||||
const quint8 VToolSeamAllowance::pieceVersion = 2;
|
||||
|
||||
|
@ -1435,7 +1442,7 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
|
|||
|
||||
if (VAbstractApplication::VApp()->IsAppInGUIMode())
|
||||
{
|
||||
QTimer::singleShot(100, Qt::CoarseTimer, this, [this, updateChildren]()
|
||||
QTimer::singleShot(V_MSECONDS(100), Qt::CoarseTimer, this, [this, updateChildren]()
|
||||
{
|
||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
||||
UpdateDetailLabel();
|
||||
|
|
|
@ -34,7 +34,12 @@
|
|||
#include <QTimer>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "../vmisc/compatibility.h"
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -172,7 +177,7 @@ void VCompleterLineEdit::ShowCompletion()
|
|||
if (text().isEmpty())
|
||||
{
|
||||
// completion list will be hidden now; we will show it again after a delay
|
||||
QTimer::singleShot(100, this, &VCompleterLineEdit::CompletionPopup);
|
||||
QTimer::singleShot(V_MSECONDS(100), this, &VCompleterLineEdit::CompletionPopup);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user