File indexing completed on 2024-04-28 15:40:27
0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org> 0002 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 #include "InfoBoxResizer.h" 0006 0007 #include "InfoBox.h" 0008 0009 Viewer::InfoBoxResizer::InfoBoxResizer(Viewer::InfoBox *infoBox) 0010 : m_infoBox(infoBox) 0011 { 0012 } 0013 0014 void Viewer::InfoBoxResizer::setPos(QPoint pos) 0015 { 0016 QRect rect = m_infoBox->geometry(); 0017 pos = m_infoBox->mapToParent(pos); 0018 0019 if (m_left) 0020 rect.setLeft(pos.x()); 0021 if (m_right) 0022 rect.setRight(pos.x()); 0023 if (m_top) 0024 rect.setTop(pos.y()); 0025 if (m_bottom) 0026 rect.setBottom(pos.y()); 0027 0028 if (rect.width() > 100 && rect.height() > 50) 0029 m_infoBox->setGeometry(rect); 0030 } 0031 0032 void Viewer::InfoBoxResizer::setup(bool left, bool right, bool top, bool bottom) 0033 { 0034 m_left = left; 0035 m_right = right; 0036 m_top = top; 0037 m_bottom = bottom; 0038 m_active = true; 0039 } 0040 0041 void Viewer::InfoBoxResizer::deactivate() 0042 { 0043 m_active = false; 0044 } 0045 0046 bool Viewer::InfoBoxResizer::isActive() const 0047 { 0048 return m_active; 0049 } 0050 // vi:expandtab:tabstop=4 shiftwidth=4: