]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/LyXToolBox.cpp
Include config.h in LyXToolBox.cpp
[lyx.git] / src / frontends / qt4 / LyXToolBox.cpp
1 // -*- C++ -*-
2 /**
3  * \file LyXToolBox.cpp
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Guillaume Munch
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "LyXToolBox.h"
15
16 #include <QApplication>
17 #include <QLayout>
18
19 #include "support/debug.h"
20
21 namespace lyx {
22 namespace frontend {
23
24
25 QSize LyXToolBox::minimumSizeHint() const
26 {
27         QSize s(0,0);
28         // Compute the max of the minimal sizes of the pages
29         QWidget * page;
30         for (int i = 0; (page = widget(i)); ++i)
31                 s = s.expandedTo(page->minimumSizeHint());
32         // Add the height of the tabs
33         if (currentWidget())
34                 s.rheight() += height() - currentWidget()->height();
35         return s;
36 }
37
38 void LyXToolBox::showEvent(QShowEvent * e)
39 {
40         // Computation of the tab height might be incorrect yet (the proper sizes of
41         // the pages have only been computed now).
42         // It might still be incorrect after this. All this would be unnecessary if
43         // QToolBox made our life easier and exposed more information; for instance
44         // let us access the scroll areas enclosing the pages (from which one can
45         // deduce the real tab height).
46         layout()->invalidate();
47         // proceed with geometry update to avoid flicker
48         qApp->processEvents(QEventLoop::ExcludeUserInputEvents, 50);
49         QToolBox::showEvent(e);
50 }
51
52
53 } // namespace frontend
54 } // namespace lyx
55
56 #include "moc_LyXToolBox.cpp"
57