• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kompare

  • sources
  • kde-4.14
  • kdesdk
  • kompare
  • libdialogpages
pagebase.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  prefsbase.cpp
3  -------------
4  begin : Sun Mar 4 2001
5  Copyright 2001 Otto Bruggeman <otto.bruggeman@home.nl>
6  Copyright 2001 John Firebaugh <jfirebaugh@kde.org>
7  Copyright 2007 Kevin Kofler <kevin.kofler@chello.at>
8 ****************************************************************************/
9 
10 /***************************************************************************
11 **
12 ** This program is free software; you can redistribute it and/or modify
13 ** it under the terms of the GNU General Public License as published by
14 ** the Free Software Foundation; either version 2 of the License, or
15 ** (at your option) any later version.
16 **
17 ***************************************************************************/
18 
19 #include "pagebase.h"
20 
21 #include <QtCore/QObject>
22 #include <QtGui/QLayout>
23 
24 PageBase::PageBase() : KVBox()
25 {
26 
27 }
28 
29 PageBase::~PageBase()
30 {
31 
32 }
33 
35 QSize PageBase::sizeHintForWidget( QWidget* widget )
36 {
37  //
38  // The size is computed by adding the sizeHint().height() of all
39  // widget children and taking the width of the widest child and adding
40  // layout()->margin() and layout()->spacing()
41  //
42 
43  // this code in this method has been ripped out of a file in kbabel
44  // so copyright goes to the kbabel authors.
45 
46  QSize size;
47 
48  int numChild = 0;
49  QList<QObject*> l = widget->children();
50 
51 
52 
53  for( int i=0; i < l.count(); i++ )
54  {
55  QObject *o = l.at(i);
56  if( o->isWidgetType() )
57  {
58  numChild += 1;
59  QWidget *w=((QWidget*)o);
60 
61  QSize s = w->sizeHint();
62  if( s.isEmpty() == true )
63  {
64  s = QSize( 50, 100 ); // Default size
65  }
66  size.setHeight( size.height() + s.height() );
67  if( s.width() > size.width() )
68  {
69  size.setWidth( s.width() );
70  }
71  }
72  }
73 
74  if( numChild > 0 )
75  {
76  size.setHeight( size.height() + widget->layout()->spacing()*(numChild-1) );
77  size += QSize( widget->layout()->margin()*2, widget->layout()->margin()*2 + 1 );
78  }
79  else
80  {
81  size = QSize( 1, 1 );
82  }
83 
84  return( size );
85 }
86 
88 void PageBase::apply()
89 {
90 
91 }
92 
94 void PageBase::restore()
95 {
96 
97 }
98 
100 void PageBase::setDefaults()
101 {
102 
103 }
104 
105 #include "pagebase.moc"
QWidget::layout
QLayout * layout() const
QWidget
QSize::setHeight
void setHeight(int height)
KVBox
QSize::width
int width() const
pagebase.h
PageBase::PageBase
PageBase()
Definition: pagebase.cpp:24
QSize::isEmpty
bool isEmpty() const
PageBase::setDefaults
virtual void setDefaults()
No descriptions.
Definition: pagebase.cpp:100
QList::at
const T & at(int i) const
QObject::children
const QObjectList & children() const
QList::count
int count(const T &value) const
QObject
QSize::setWidth
void setWidth(int width)
PageBase::apply
virtual void apply()
No descriptions.
Definition: pagebase.cpp:88
QList
QLayout::margin
margin
PageBase::sizeHintForWidget
QSize sizeHintForWidget(QWidget *widget)
No descriptions.
Definition: pagebase.cpp:35
QSize
QWidget::sizeHint
sizeHint
PageBase::~PageBase
~PageBase()
Definition: pagebase.cpp:29
QSize::height
int height() const
QLayout::spacing
spacing
QObject::isWidgetType
bool isWidgetType() const
PageBase::restore
virtual void restore()
No descriptions.
Definition: pagebase.cpp:94
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kompare

Skip menu "kompare"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal