File indexing completed on 2024-04-28 04:37:31

0001 /*
0002     SPDX-FileCopyrightText: 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only
0005 */
0006 
0007 #include "holdupdates.h"
0008 #include <QWidget>
0009 
0010 namespace Sublime {
0011     
0012 HoldUpdates::HoldUpdates(QWidget* w)
0013     : m_wasupdating(w->updatesEnabled()), m_done(false), m_w(w)
0014 {
0015     if(m_wasupdating) w->setUpdatesEnabled(false);
0016 }
0017 
0018 void HoldUpdates::stop()
0019 {
0020     if(!m_done)
0021         m_w->setUpdatesEnabled(m_wasupdating);
0022     m_done=true;
0023 }
0024 
0025 HoldUpdates::~HoldUpdates()
0026 {
0027     stop();
0028 }
0029 
0030 }
0031