fix: include QElapsedTimer for Windows build without HAVE_SERIALPORT#2195
Merged
ten9876 merged 1 commit intoten9876:mainfrom May 1, 2026
Merged
Conversation
QElapsedTimer was included only inside #ifdef HAVE_SERIALPORT, but m_debounceTimer is declared inside #if defined(HAVE_SERIALPORT) || defined(Q_OS_WIN). On Windows when Qt6::SerialPort is not present, Q_OS_WIN is true but the include was skipped, causing a build failure. Move the QElapsedTimer include to match the broader guard. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Contributor
There was a problem hiding this comment.
Looks good — clean, minimal fix for a real build break.
The analysis is correct: #include <QElapsedTimer> at line 7 is guarded by #ifdef HAVE_SERIALPORT, but m_debounceTimer (line 118) lives inside the broader #if defined(HAVE_SERIALPORT) || defined(Q_OS_WIN) block. On Windows without Qt6::SerialPort, the member compiles but the include is skipped.
Moving the include to match the member's guard is the right fix. No scope creep, no bugs introduced.
Thanks for catching this @NF0T — nice write-up in the PR description too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a Windows build failure introduced by #2147 (serial PTT Win32 rewrite).
Problem
QElapsedTimeris included inside#ifdef HAVE_SERIALPORTinSerialPortController.h, butm_debounceTimeris declared inside the broader#if defined(HAVE_SERIALPORT) || defined(Q_OS_WIN)guard. On Windows whenQt6::SerialPortis not present (HAVE_SERIALPORTundefined),Q_OS_WINis still true so the member block is compiled, but theQElapsedTimerinclude was skipped — resulting in:Fix
Move the
#include <QElapsedTimer>to use the same#if defined(HAVE_SERIALPORT) || defined(Q_OS_WIN)guard as the member that depends on it.Test Plan
Qt6::SerialPortdisabled🤖 Generated with Claude Code