KJanusWidget Class Reference
Provides a number of ready to use layouts (faces). Easy to use widget with many layouts. More...
#include <kjanuswidget.h>
Inheritance diagram for KJanusWidget:

Public Slots | |
virtual void | setFocus () |
Give the keyboard input focus to the widget. | |
Public Methods | |
KJanusWidget (QWidget *parent=0, const char *name=0, int face=Plain) | |
Constructor where you specify the face. | |
~KJanusWidget () | |
Destructor. | |
virtual bool | showPage (int index) |
Raises the page which was added by addPage(). | |
virtual int | activePageIndex () const |
Returns the index of the page that are currently displayed. | |
virtual bool | isValid () const |
Use this to verify that no memory allocation failed. | |
virtual int | face () const |
Returns the face type. | |
virtual QSize | minimumSizeHint () const |
Returns the minimum size that must be made available for the widget so that UIs can be displayed properly. | |
virtual QSize | sizeHint () const |
Returns the recommended size for the widget in order to be displayed properly. | |
virtual QFrame * | plainPage () |
Returns the empty widget that is available in Plain mode. | |
virtual QFrame * | addPage (const QString &item, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
Add a new page when the class is used in TreeList, IconList or Tabbed mode. | |
virtual QFrame * | addPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
This is like addPage just above, with the difference that the first element is a list of strings. | |
virtual QVBox * | addVBoxPage (const QString &item, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
Add a new page when the class is used in TreeList, IconList or Tabbed mode. | |
virtual QVBox * | addVBoxPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
This is like addVBoxPage just above, with the difference that the first element is a list of strings. | |
virtual QHBox * | addHBoxPage (const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
Add a new page when the class is used in TreeList, IconList or Tabbed mode. | |
virtual QHBox * | addHBoxPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
This is like addHBoxPage just above, with the difference that the first element is a list of strings. | |
virtual QGrid * | addGridPage (int n, Orientation dir, const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
Add a new page when the class is used in either TreeList or Tabbed mode. | |
virtual QGrid * | addGridPage (int n, Orientation dir, const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
This is like addGridPage just above, with the difference that the first element is a list of strings. | |
void | removePage (QWidget *page) |
Removes a page created with addPage, addVBoxPage, addHBoxPage or addGridPage. If the page has already been deleted or has already been removed, nothing happens. The widget itself is not deleted. | |
virtual int | pageIndex (QWidget *widget) const |
Returns the index of a page created with addPage , addVBoxPage , addHBoxPage or addGridPage . | |
virtual bool | setSwallowedWidget (QWidget *widget) |
Defines the widget to be swallowed. | |
virtual void | setTreeListAutoResize (bool state) |
This function has only effect in TreeList mode. | |
virtual void | setShowIconsInTreeList (bool state) |
This function has only effect in TreeList mode. | |
virtual void | setRootIsDecorated (bool state) |
This function has only effect in TreeList mode. | |
virtual void | setIconListAllVisible (bool state) |
This function has only effect in IconList mode. | |
virtual void | setFolderIcon (const QStringList &path, const QPixmap &pixmap) |
Sets the icon used in TreeList Mode for the given path. | |
Protected Methods | |
virtual void | showEvent (QShowEvent *) |
Reimplemented to handle the splitter width when the the face is TreeList. | |
virtual bool | eventFilter (QObject *o, QEvent *e) |
This function is used internally when in IconList mode. |
Detailed Description
Provides a number of ready to use layouts (faces). Easy to use widget with many layouts.It is used as an internal widget in KDialogBase, but can also used as a widget of its own.
It provides TreeList, IconList, Tabbed, Plain and Swallow layouts.
The TreeList face provides a list in the left area and pages in the right. The area are separated by a movable splitter. The style is somewhat similar to the layout in the Control Center. A page is raised by selecting the corresponding tree list item.
The IconList face provides an icon list in the left area and pages in the right. For each entry the Icon is on top with the text below. The style is somewhat similar to the layout of the Eudora configuation dialog box. A page is raised by selecting the corresponding icon list item. The preferred icon size is 32x32 pixels.
The Tabbed face is a common tabbed widget. The procedure for creating a page is similar for creating a TreeList. This has the advantage that if your widget contain too many pages it is trivial to convert it into a TreeList. Just change the face in the KJanusWidget constructor to KJanusWidget::TreeList and you have a tree list layout instead.
The Plain face provides an empty widget (QFrame) where you can place your widgets. The KJanusWidget makes no assumptions regarding the contents so you are free to add whatever you want.
The Swallow face is provided in order to simplify the usage of existing widgets and to allow changing the visible widget. You specify the widget to be displayed by setSwallowedWidget(). Your widget will be reparented inside the widget. You can specify a Null (0) widget. A empty space is then displayed.
For all modes it is important that you specify the QWidget::minimumSize() on the page, plain widget or the swallowed widget. If you use a QLayout on the page, plain widget or the swallowed widget this will be taken care of automatically. The size is used when the KJanusWidget determines its own minimum size. You get the minimum size by using the minimumSizeHint() or sizeHint() methods.
Pages that have been added in TreeList, IconList or Tabbed mode can be removed by simply deleting the page.
- Author:
- Espen Sand (espen@kde.org)
Definition at line 89 of file kjanuswidget.h.
Constructor & Destructor Documentation
|
Constructor where you specify the face.
Definition at line 69 of file kjanuswidget.cpp. References KListView::addColumn(), QString::fromLatin1(), KDialog::marginHint(), QWidget::QWidget(), QFont::setBold(), QLabel::setFont(), QFrame::setFrameStyle(), QTabWidget::setMargin(), KListView::setSorting(), setSwallowedWidget(), and KDialog::spacingHint(). |
|
Destructor.
Definition at line 177 of file kjanuswidget.cpp. |
Member Function Documentation
|
Raises the page which was added by addPage().
Definition at line 551 of file kjanuswidget.cpp. References QPtrList< QWidget >::at(). Referenced by KDialogBase::showPage(). |
|
Returns the index of the page that are currently displayed.
Definition at line 626 of file kjanuswidget.cpp. References QListBox::currentItem(), QTabWidget::currentPage(), QPtrList< QWidget >::findRef(), and QListBox::item(). Referenced by KDialogBase::activePageIndex(). |
|
Use this to verify that no memory allocation failed.
Definition at line 186 of file kjanuswidget.cpp. Referenced by KDialogBase::KDialogBase(). |
|
Returns the face type.
Definition at line 198 of file kjanuswidget.cpp. |
|
Returns the minimum size that must be made available for the widget so that UIs can be displayed properly.
Definition at line 735 of file kjanuswidget.cpp. References QSize::height(), QWidget::minimumSize(), QSize::rheight(), QSize::rwidth(), KDialog::spacingHint(), QWidget::style(), and QSize::width(). Referenced by sizeHint(). |
|
Returns the recommended size for the widget in order to be displayed properly.
Reimplemented from QWidget. Definition at line 794 of file kjanuswidget.cpp. References minimumSizeHint(). |
|
Returns the empty widget that is available in Plain mode.
Definition at line 192 of file kjanuswidget.cpp. Referenced by KDialogBase::plainPage(). |
|
Add a new page when the class is used in TreeList, IconList or Tabbed mode. The returned widget is empty and you must add your widgets as children to this widget. In most cases you must create a layout manager and associate it with this widget as well. Deleting the returned frame will cause the listitem or tab to be removed (you can re-add a page with the same name later.
Definition at line 233 of file kjanuswidget.cpp. Referenced by KDialogBase::addPage(). |
|
This is like addPage just above, with the difference that the first element is a list of strings. These strings are used to form a path of folders down to the given page. The initial elements are names for the folders, while the last element is the name of the page. Note: This does yet only work for the TreeList face. Later this may be added for the IconList face too. In other faces than the TreeList, all the strings except the last one is ignored. Deleting the returned frame will cause the listitem or tab to be removed (you can re-add a page with the same name later. Deleting the returned frame will cause the listitem or tab to be removed (you can re-add a page with the same name later. Definition at line 213 of file kjanuswidget.cpp. |
|
Add a new page when the class is used in TreeList, IconList or Tabbed mode. The returned widget is empty and you must add your widgets as children to this widget. The returned widget is a QVBox so it contains a QVBoxLayout layout that lines up the child widgets are vertically. Deleting the returned frame will cause the listitem or tab to be removed (you can re-add a page with the same name later.
Definition at line 260 of file kjanuswidget.cpp. Referenced by KDialogBase::addVBoxPage(). |
|
This is like addVBoxPage just above, with the difference that the first element is a list of strings. These strings are used to form a path of folders down to the given page. The initial elements are names for the folders, while the last element is the name of the page. Note: This does yet only work for the TreeList face. Later this may be added for the IconList face too. In other faces than the TreeList, all the strings except the last one is ignored. Deleting the returned frame will cause the listitem or tab to be removed (you can re-add a page with the same name later. Definition at line 243 of file kjanuswidget.cpp. References KDialog::spacingHint(). |
|
Add a new page when the class is used in TreeList, IconList or Tabbed mode. The returned widget is empty and you must add your widgets as children to this widget. The returned widget is a QHBox so it contains a QHBoxLayout layout that lines up the child widgets are horizontally. Deleting the returned frame will cause the listitem or tab to be removed (you can re-add a page with the same name later.
Definition at line 285 of file kjanuswidget.cpp. Referenced by KDialogBase::addHBoxPage(). |
|
This is like addHBoxPage just above, with the difference that the first element is a list of strings. These strings are used to form a path of folders down to the given page. The initial elements are names for the folders, while the last element is the name of the page. Note: This does yet only work for the TreeList face. Later this may be added for the IconList face too. In other faces than the TreeList, all the strings except the last one is ignored. Deleting the returned frame will cause the listitem or tab to be removed (you can re-add a page with the same name later. Definition at line 269 of file kjanuswidget.cpp. References QHBox::setSpacing(), and KDialog::spacingHint(). |
|
Add a new page when the class is used in either TreeList or Tabbed mode. The returned widget is empty and you must add your widgets as children to this widget. The returned widget is a QGrid so it contains a QGridLayout layout that places up the child widgets in a grid. Deleting the returned frame will cause the listitem or tab to be removed (you can re-add a page with the same name later.
Definition at line 313 of file kjanuswidget.cpp. Referenced by KDialogBase::addGridPage(). |
|
This is like addGridPage just above, with the difference that the first element is a list of strings. These strings are used to form a path of folders down to the given page. The initial elements are names for the folders, while the last element is the name of the page. Note: This does yet only work for the TreeList face. Later this may be added for the IconList face too. In other faces than the TreeList, all the strings except the last one is ignored. Deleting the returned frame will cause the listitem or tab to be removed (you can re-add a page with the same name later. Definition at line 294 of file kjanuswidget.cpp. References QGrid::setSpacing(), and KDialog::spacingHint(). |
|
Removes a page created with addPage, addVBoxPage, addHBoxPage or addGridPage. If the page has already been deleted or has already been removed, nothing happens. The widget itself is not deleted.
Definition at line 1039 of file kjanuswidget.cpp. References QMap< QListBoxItem *, QWidget * >::begin(), QMap< QListViewItem *, QWidget * >::begin(), QPtrList< QWidget >::containsRef(), QMap< QListBoxItem *, QWidget * >::end(), QMap< QListViewItem *, QWidget * >::end(), QPtrList< QWidget >::findRef(), QMap< QListBoxItem *, QWidget * >::remove(), QMap< QListViewItem *, QWidget * >::remove(), QTabWidget::removePage(), QPtrList< QWidget >::removeRef(), and QWidgetStack::removeWidget(). |
|
Returns the index of a page created with addPage , addVBoxPage , addHBoxPage or addGridPage . You can can compare this index with the value returned from activePageIndex if you need to do some page specific actions in your code. The returned index will never change so you can safely use this function once and save the value.
Definition at line 650 of file kjanuswidget.cpp. References QPtrList< QWidget >::findRef(), and QWidget::parentWidget(). Referenced by KDialogBase::pageIndex(). |
|
Defines the widget to be swallowed. This method can be used several times. Only the latest defined widget will be shown.
Definition at line 472 of file kjanuswidget.cpp. References QGridLayout::addColSpacing(), QGridLayout::addRowSpacing(), QGridLayout::addWidget(), QObject::isWidgetType(), QWidget::layout(), QWidget::minimumSize(), QWidget::reparent(), and QWidget::setMinimumSize(). Referenced by KJanusWidget(), and KDialogBase::setMainWidget(). |
|
This function has only effect in TreeList mode. Defines how the tree list is resized when the widget is resized horizontally. By default the tree list keeps its width when the widget becomes wider.
Definition at line 800 of file kjanuswidget.cpp. References QSplitter::setResizeMode(). Referenced by KDialogBase::setTreeListAutoResize(). |
|
This function has only effect in TreeList mode. This tells the widgets whether the icons given in the addPage, addVBoxPage, addHBoxPage, or addGridPage methods should be shown in the TreeList. Note: This method must be called before calling any of the methods which add icons to the page.
Definition at line 820 of file kjanuswidget.cpp. Referenced by KDialogBase::setShowIconsInTreeList(). |
|
This function has only effect in TreeList mode. This tells the widgets whether the root should be decorated. For details see QListView::setRootIsDecorated
Definition at line 825 of file kjanuswidget.cpp. Referenced by KDialogBase::setRootIsDecorated(). |
|
This function has only effect in IconList mode. Defines how the icon list widget is displayed. By default it is the widgets in the pages that decide the minimum height of the toplevel widget. A vertical scrollbar can be used in the icon list area.
Definition at line 812 of file kjanuswidget.cpp. Referenced by KDialogBase::setIconListAllVisible(). |
|
Sets the icon used in TreeList Mode for the given path.
Definition at line 464 of file kjanuswidget.cpp. References QMap< QString, QPixmap >::insert(), QStringList::join(), and KStdAccel::key(). Referenced by KDialogBase::setFolderIcon(). |
|
Give the keyboard input focus to the widget.
Reimplemented from QWidget. Definition at line 709 of file kjanuswidget.cpp. References QWidget::setFocus(). |
|
Reimplemented to handle the splitter width when the the face is TreeList.
Reimplemented from QWidget. Definition at line 833 of file kjanuswidget.cpp. References QSplitter::setResizeMode(). |
|
This function is used internally when in IconList mode. If you reimplement this class a make your own event filter, make sure to call this function from your filter.
Definition at line 848 of file kjanuswidget.cpp. References QListBox::item(), and QEvent::type(). |
The documentation for this class was generated from the following files: