Debian Codegraph @

qt6/demos/abstractinfodock.cpp

raw
1 /*
2 * Copyright (C) 2008, Pino Toscano <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #include "fonts.h"
20
21 AbstractInfoDock::AbstractInfoDock(QWidget *parent) : QDockWidget(parent), m_filled(false)
22 {
23 connect(this, &AbstractInfoDock::visibilityChanged, this, &AbstractInfoDock::slotVisibilityChanged);
24 }
25
26 AbstractInfoDock::~AbstractInfoDock() = default;
27
28 void AbstractInfoDock::documentLoaded()
29 {
30 if (!isHidden()) {
31 fillInfo();
32 m_filled = true;
33 }
34 }
35
36 void AbstractInfoDock::documentClosed()
37 {
38 m_filled = false;
39 }
40
41 void AbstractInfoDock::pageChanged(int page)
42 {
43 Q_UNUSED(page)
44 }
45
46 void AbstractInfoDock::slotVisibilityChanged(bool visible)
47 {
48 if (visible && document() && !m_filled) {
49 fillInfo();
50 m_filled = true;
51 }
52 }