Suppress -Woverloaded-virtual in QAbstractEventDispatcherV2 hierarchy

Says GCC (e.g.):

  qabstracteventdispatcher.h:122:9:
  warning: ‘virtual int QAbstractEventDispatcherV2::remainingTime(int)’ was
  hidden [-Woverloaded-virtual]

    122 |     int remainingTime(int timerId) final;
        |         ^~~~~~~~~~~~~

  qeventdispatcher_glib_p.h:47:14:
  warning: by ‘virtual QAbstractEventDispatcher::Duration
  QEventDispatcherGlib::remainingTime(Qt::TimerId) const’
  [-Woverloaded-virtual]

     47 |     Duration remainingTime(Qt::TimerId timerId) const override final;
        |              ^~~~~~~~~~~~~

The usual way to fix this warning, adding `using base::func;`, doesn't
work here, because (the int overloads of) the functions in question
are made private in QAbstractEventDispatcherV2, so the `using` fails
with "is private in this context" errors.

Since this situation is temporary (until Qt 7, when the overloading
stops), simply suppress the warnings manually.

Found that the Windows dispatcher doesn't inherit from V2, yet, and
created QTBUG-129170 to track the issue.

Amends f8da484d5741d1191504eefddf5134fd7009e16a.

Pick-to: 6.8
Task-number: QTBUG-126219
Change-Id: I0da821f08364f97fb7a17c9019586064ae58b0b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2024-09-20 13:48:51 +02:00 committed by Ahmad Samir
parent 7ae959e00a
commit 222cf3145e

View File

@ -114,12 +114,16 @@ protected:
QAbstractEventDispatcherV2(QAbstractEventDispatcherPrivate &, QObject *parent);
private:
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Woverloaded-virtual")
QT_WARNING_DISABLE_CLANG("-Woverloaded-virtual")
// final overrides from V1
void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType,
QObject *object) final;
bool unregisterTimer(int timerId) final;
QList<TimerInfo> registeredTimers(QObject *object) const final;
int remainingTime(int timerId) final;
QT_WARNING_POP
};
#else
using QAbstractEventDispatcherV2 = QAbstractEventDispatcher;