Skip to content

Commit

Permalink
Code cosmetics about usages of "#if QT_VERSION"
Browse files Browse the repository at this point in the history
  • Loading branch information
HuguesDelorme committed Dec 5, 2024
1 parent ae8dd63 commit 1a357be
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/command_system_information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ QString CommandSystemInformation::data()
<< indentx2 << "useHoverEffects: " << sh->useHoverEffects() << '\n'
<< indentx2 << "wheelScrollLines: " << sh->wheelScrollLines() << '\n'
<< indentx2 << "mouseQuickSelectionThreshold: " << sh->mouseQuickSelectionThreshold() << '\n'
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
<< indentx2 << "mouseDoubleClickDistance: " << sh->mouseDoubleClickDistance() << '\n'
<< indentx2 << "touchDoubleTapDistance: " << sh->touchDoubleTapDistance() << '\n'
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/app/qtgui_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ QPixmap toQPixmap(const Image_PixMap& pixmap)
auto fnToQImageFormat = [](Image_Format occFormat) {
switch (occFormat) {
case Image_Format_RGB: return QImage::Format_RGB888;
#if (QT_VERSION>=QT_VERSION_CHECK(5,14,0))
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
case Image_Format_BGR: return QImage::Format_BGR888;
#endif
case Image_Format_RGBA: return QImage::Format_ARGB32;
Expand Down
2 changes: 1 addition & 1 deletion src/app/widget_main_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ void WidgetMainControl::reloadDocumentAfterChange(const DocumentPtr& doc)
;
const auto msgBtns = QMessageBox::Yes | QMessageBox::No;
auto msgBox = new QMessageBox(QMessageBox::Question, tr("Question"), strQuestion, msgBtns, this);
#if (QT_VERSION>=QT_VERSION_CHECK(5,14,0))
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
msgBox->setTextFormat(Qt::MarkdownText);
#else
msgBox->setTextFormat(Qt::AutoText);
Expand Down
7 changes: 6 additions & 1 deletion src/qtbackend/qt_signal_thread_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ std::any QtSignalThreadHelper::getCurrentThreadContext()

void QtSignalThreadHelper::execInThread(const std::any& context, const std::function<void()>& fn)
{
QMetaObject::invokeMethod(std::any_cast<QObject*>(context), fn, Qt::ConnectionType::QueuedConnection);
auto qobject = std::any_cast<QObject*>(context);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QTimer::singleShot(0, qobject, fn);
#else
QMetaObject::invokeMethod(qobject, fn, Qt::ConnectionType::QueuedConnection);
#endif
}

} // namespace Mayo
2 changes: 1 addition & 1 deletion src/qtcommon/qtcore_hfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ inline std::size_t hash_value(const QString& key) {

} // namespace boost

#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
namespace std {

// Specialization of C++11 std::hash<> functor for QByteArray
Expand Down

0 comments on commit 1a357be

Please sign in to comment.