diff options
author | JosepMaJAZ <josepma@gmail.com> | 2020-04-24 23:52:44 +0200 |
---|---|---|
committer | JosepMaJAZ <josepma@gmail.com> | 2020-04-24 23:52:44 +0200 |
commit | 652f9f2d8a28c1e028cddf8bbbec5f8e5db45677 (patch) | |
tree | 7ecba5b49f1a4ed1924d181f10ca7b07c2604625 | |
parent | ba340abe491f5dd7e9e8b4cd5296ab64e21d7a98 (diff) |
Added ifdefs for QT version and OS as suggested in the PR, plus some other suggestions.
-rw-r--r-- | src/preferences/dialog/dlgprefwaveform.cpp | 4 | ||||
-rw-r--r-- | src/waveform/waveformwidgetfactory.cpp | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/preferences/dialog/dlgprefwaveform.cpp b/src/preferences/dialog/dlgprefwaveform.cpp index c5b980edf7..f8ff29549f 100644 --- a/src/preferences/dialog/dlgprefwaveform.cpp +++ b/src/preferences/dialog/dlgprefwaveform.cpp @@ -196,13 +196,15 @@ void DlgPrefWaveform::slotSetWaveformType(int index) { if (index < 0) { return; } + WaveformWidgetFactory::instance()->setWidgetTypeFromHandle(index); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && defined __WINDOWS__ // This regenerates the waveforms twice because of a bug found on Windows // where the first one fails. // The problem is that the window of the widget thinks that it is not exposed. // (https://doc.qt.io/qt-5/qwindow.html#exposeEvent ) // TODO: Remove this when it has been fixed upstream. - WaveformWidgetFactory::instance()->setWidgetTypeFromHandle(index); WaveformWidgetFactory::instance()->setWidgetTypeFromHandle(index, true); +#endif } void DlgPrefWaveform::slotSetWaveformOverviewType(int index) { diff --git a/src/waveform/waveformwidgetfactory.cpp b/src/waveform/waveformwidgetfactory.cpp index 5ef96a8d86..0c0c3037c8 100644 --- a/src/waveform/waveformwidgetfactory.cpp +++ b/src/waveform/waveformwidgetfactory.cpp @@ -366,12 +366,14 @@ void WaveformWidgetFactory::addTimerListener(QWidget* pWidget) { void WaveformWidgetFactory::slotSkinLoaded() { + setWidgetTypeFromConfig(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && defined __WINDOWS__ // This regenerates the waveforms twice because of a bug found on Windows // where the first one fails. // The problem is that the window of the widget thinks that it is not exposed. // (https://doc.qt.io/qt-5/qwindow.html#exposeEvent ) setWidgetTypeFromConfig(); - setWidgetTypeFromConfig(); +#endif } bool WaveformWidgetFactory::setWaveformWidget(WWaveformViewer* viewer, @@ -460,7 +462,7 @@ bool WaveformWidgetFactory::setWidgetType(WaveformWidgetType::Type type, Wavefor // type is acceptable currentType = type; if (m_config) { - m_config->set(ConfigKey("[Waveform]", "WaveformType"), ConfigValue((int)(currentType))); + m_config->setValue(ConfigKey("[Waveform]", "WaveformType"), static_cast<int>(currentType)); } return true; } @@ -468,7 +470,7 @@ bool WaveformWidgetFactory::setWidgetType(WaveformWidgetType::Type type, Wavefor // fallback currentType = WaveformWidgetType::EmptyWaveform; if (m_config) { - m_config->set(ConfigKey("[Waveform]", "WaveformType"), ConfigValue((int)(currentType))); + m_config->setValue(ConfigKey("[Waveform]", "WaveformType"), static_cast<int>(currentType)); } return false; } @@ -483,7 +485,7 @@ bool WaveformWidgetFactory::setWidgetTypeFromConfig() { } bool WaveformWidgetFactory::setWidgetTypeFromHandle(int handleIndex, bool force) { - if (handleIndex < 0 || handleIndex >= (int)m_waveformWidgetHandles.size()) { + if (handleIndex < 0 || handleIndex >= m_waveformWidgetHandles.size()) { qDebug() << "WaveformWidgetFactory::setWidgetType - invalid handle --> use of 'EmptyWaveform'"; // fallback empty type setWidgetType(WaveformWidgetType::EmptyWaveform); @@ -1004,7 +1006,7 @@ void WaveformWidgetFactory::getAvailableVSyncTypes(QList<QPair<int, QString > >* WaveformWidgetType::Type WaveformWidgetFactory::findTypeFromHandleIndex(int index) { WaveformWidgetType::Type type = WaveformWidgetType::Count_WaveformwidgetType; - if (index >= 0 && index < (int)m_waveformWidgetHandles.size()) { + if (index >= 0 && index < m_waveformWidgetHandles.size()) { type = m_waveformWidgetHandles[index].m_type; } return type; |