diff options
-rw-r--r-- | vcl/CustomTarget_qt5_moc.mk | 1 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Frame.hxx | 12 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Timer.hxx | 6 | ||||
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 15 | ||||
-rw-r--r-- | vcl/qt5/Qt5Timer.cxx | 23 |
5 files changed, 36 insertions, 21 deletions
diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk index afce4d44fd2b..1ef8b89f9f48 100644 --- a/vcl/CustomTarget_qt5_moc.mk +++ b/vcl/CustomTarget_qt5_moc.mk @@ -11,6 +11,7 @@ $(eval $(call gb_CustomTarget_CustomTarget,vcl/qt5)) $(call gb_CustomTarget_get_target,vcl/qt5) : \ $(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5FilePicker.moc \ + $(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Frame.moc \ $(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Instance.moc \ $(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5MainWindow.moc \ $(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Menu.moc \ diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx index 0eb796330e38..577a9cce2fde 100644 --- a/vcl/inc/qt5/Qt5Frame.hxx +++ b/vcl/inc/qt5/Qt5Frame.hxx @@ -27,6 +27,8 @@ #include <headless/svpgdi.hxx> #include <vcl/svapp.hxx> +#include <QtCore/QObject> + class Qt5Graphics; class Qt5Instance; class Qt5Menu; @@ -37,8 +39,10 @@ class QScreen; class QImage; class SvpSalGraphics; -class VCLPLUG_QT5_PUBLIC Qt5Frame : public SalFrame +class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame { + Q_OBJECT + friend class Qt5Widget; QWidget* m_pQWidget; @@ -90,6 +94,12 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public SalFrame void TriggerPaintEvent(); void TriggerPaintEvent(QRect aRect); +private Q_SLOTS: + void setVisible(bool); + +Q_SIGNALS: + void setVisibleSignal(bool); + public: Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo); virtual ~Qt5Frame() override; diff --git a/vcl/inc/qt5/Qt5Timer.hxx b/vcl/inc/qt5/Qt5Timer.hxx index 43613d8cf4a1..9d68f0b200c5 100644 --- a/vcl/inc/qt5/Qt5Timer.hxx +++ b/vcl/inc/qt5/Qt5Timer.hxx @@ -30,10 +30,12 @@ class Qt5Timer final : public QObject, public SalTimer private Q_SLOTS: void timeoutActivated(); - void startTimer(); + void startTimer(int); + void stopTimer(); Q_SIGNALS: - void startTimerSignal(); + void startTimerSignal(int); + void stopTimerSignal(); public: Qt5Timer(); diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 3365ed4af3b8..b42ec5e08a0c 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -18,6 +18,7 @@ */ #include <Qt5Frame.hxx> +#include <Qt5Frame.moc> #include <Qt5Tools.hxx> #include <Qt5Instance.hxx> @@ -108,6 +109,7 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) } else m_pQWidget = new Qt5Widget(*this, aWinFlags); + connect(this, SIGNAL(setVisibleSignal(bool)), SLOT(setVisible(bool))); if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG)) { @@ -301,6 +303,14 @@ void Qt5Frame::DrawMenuBar() { /* not needed */} void Qt5Frame::SetExtendedFrameStyle(SalExtStyle /*nExtStyle*/) { /* not needed */} +void Qt5Frame::setVisible(bool bVisible) +{ + if (m_pTopLevel) + m_pTopLevel->setVisible(bVisible); + else + m_pQWidget->setVisible(bVisible); +} + void Qt5Frame::Show(bool bVisible, bool /*bNoActivate*/) { assert(m_pQWidget); @@ -308,10 +318,7 @@ void Qt5Frame::Show(bool bVisible, bool /*bNoActivate*/) if (m_bDefaultSize) SetDefaultSize(); - if (m_pTopLevel) - m_pTopLevel->setVisible(bVisible); - else - m_pQWidget->setVisible(bVisible); + Q_EMIT setVisibleSignal(bVisible); } void Qt5Frame::SetMinClientSize(long nWidth, long nHeight) diff --git a/vcl/qt5/Qt5Timer.cxx b/vcl/qt5/Qt5Timer.cxx index 6a9faf829342..7fcb7e17dcda 100644 --- a/vcl/qt5/Qt5Timer.cxx +++ b/vcl/qt5/Qt5Timer.cxx @@ -24,14 +24,14 @@ #include <QtCore/QThread> #include <vcl/svapp.hxx> +#include <sal/log.hxx> Qt5Timer::Qt5Timer() { m_aTimer.setSingleShot(true); - // run the timer itself in the main / creator thread - connect(&m_aTimer, SIGNAL(timeout()), this, SLOT(timeoutActivated()), Qt::QueuedConnection); - // QTimer::start() can be called only in its creator thread - connect(this, SIGNAL(startTimerSignal()), this, SLOT(startTimer()), Qt::QueuedConnection); + connect(&m_aTimer, SIGNAL(timeout()), this, SLOT(timeoutActivated())); + connect(this, SIGNAL(startTimerSignal(int)), this, SLOT(startTimer(int))); + connect(this, SIGNAL(stopTimerSignal()), this, SLOT(stopTimer())); } void Qt5Timer::timeoutActivated() @@ -40,17 +40,12 @@ void Qt5Timer::timeoutActivated() CallCallback(); } -void Qt5Timer::startTimer() { m_aTimer.start(); } +void Qt5Timer::startTimer(int nMS) { m_aTimer.start(nMS); } -void Qt5Timer::Start(sal_uIntPtr nMS) -{ - m_aTimer.setInterval(nMS); - if (qApp->thread() == QThread::currentThread()) - startTimer(); - else - Q_EMIT startTimerSignal(); -} +void Qt5Timer::Start(sal_uIntPtr nMS) { Q_EMIT startTimerSignal(nMS); } + +void Qt5Timer::stopTimer() { m_aTimer.stop(); } -void Qt5Timer::Stop() { m_aTimer.stop(); } +void Qt5Timer::Stop() { Q_EMIT stopTimerSignal(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |