KJanusWidget Class Reference
Easy to use widget with many layouts. More...
#include <kjanuswidget.h>
Inheritance diagram for KJanusWidget:


Public Types | |
enum | Face { TreeList = 0, Tabbed, Plain, Swallow, IconList } |
Public Slots | |
virtual void | setFocus () |
Signals | |
void | aboutToShowPage (QWidget *page) |
Public Member Functions | |
KJanusWidget (QWidget *parent=0, const char *name=0, int face=Plain) | |
~KJanusWidget () | |
virtual bool | showPage (int index) |
virtual int | activePageIndex () const |
virtual bool | isValid () const |
virtual int | face () const |
virtual QSize | minimumSizeHint () const |
virtual QSize | sizeHint () const |
virtual QFrame * | plainPage () |
virtual QFrame * | addPage (const QString &item, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
virtual QFrame * | addPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
virtual QVBox * | addVBoxPage (const QString &item, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
virtual QVBox * | addVBoxPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
virtual QHBox * | addHBoxPage (const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
virtual QHBox * | addHBoxPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
virtual QGrid * | addGridPage (int n, Orientation dir, const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
virtual QGrid * | addGridPage (int n, Orientation dir, const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap()) |
void | removePage (QWidget *page) |
virtual int | pageIndex (QWidget *widget) const |
virtual bool | setSwallowedWidget (QWidget *widget) |
virtual void | setTreeListAutoResize (bool state) |
virtual void | setShowIconsInTreeList (bool state) |
virtual void | setRootIsDecorated (bool state) |
void | unfoldTreeList (bool persist=false) |
void | addWidgetBelowList (QWidget *widget) |
void | addButtonBelowList (const QString &text, QObject *recv, const char *slot) |
void | addButtonBelowList (const KGuiItem &guiitem, QObject *recv, const char *slot) |
virtual void | setIconListAllVisible (bool state) |
virtual void | setFolderIcon (const QStringList &path, const QPixmap &pixmap) |
QString | pageTitle (int index) const |
QWidget * | pageWidget (int index) const |
Protected Member Functions | |
virtual void | showEvent (QShowEvent *) |
virtual bool | eventFilter (QObject *o, QEvent *e) |
bool | showPage (QWidget *w) |
void | addPageWidget (QFrame *page, const QStringList &items, const QString &header, const QPixmap &pixmap) |
void | InsertTreeListItem (const QStringList &items, const QPixmap &pixmap, QFrame *page) |
QWidget * | FindParent () |
virtual void | virtual_hook (int id, void *data) |
Detailed Description
Easy to use widget with many layouts.Provides a number of ready to use layouts (faces). It is used as an internal widget in KDialogBase, but can also used as a widget of its own.
This class provides KJanusWidget::TreeList, KJanusWidget::IconList, KJanusWidget::Tabbed, KJanusWidget::Plain and KJanusWidget::Swallow layouts.
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. However, it would be preferable to use the QObject::deleteLater() function on the page as the main event loop may have optimized UI update events of the page by scheduling them for later.
- Author:
- Espen Sand (espen@kde.org)
Definition at line 67 of file kjanuswidget.h.
Member Enumeration Documentation
|
Definition at line 96 of file kjanuswidget.h. |
Constructor & Destructor Documentation
|
Constructor where you specify the face.
Definition at line 90 of file kjanuswidget.cpp. References aboutToShowPage(), KListView::addColumn(), QString::fromLatin1(), QListView::header(), IconList, KDialog::marginHint(), Plain, QWidget::QWidget(), QApplication::reverseLayout(), QFont::setBold(), QLabel::setFont(), QFrame::setFrameStyle(), QTabWidget::setMargin(), QListView::setRootIsDecorated(), KListView::setSorting(), setSwallowedWidget(), KDialog::spacingHint(), Swallow, Tabbed, and TreeList. |
|
Destructor.
Definition at line 208 of file kjanuswidget.cpp. |
Member Function Documentation
|
Raises the page which was added by addPage().
Definition at line 581 of file kjanuswidget.cpp. Referenced by addPageWidget(), and KDialogBase::showPage(). |
|
Returns the index of the page that are currently displayed.
Definition at line 647 of file kjanuswidget.cpp. References QTabWidget::currentPage(), IconList, QListView::selectedItem(), Tabbed, and TreeList. Referenced by KDialogBase::activePageIndex(). |
|
Use this to verify that no memory allocation failed.
Definition at line 214 of file kjanuswidget.cpp. Referenced by KDialogBase::KDialogBase(). |
|
Returns the face type.
Definition at line 226 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 762 of file kjanuswidget.cpp. References QSize::height(), IconList, QWidget::minimumSize(), Plain, QSize::rheight(), QSize::rwidth(), KDialog::spacingHint(), QWidget::style(), Swallow, Tabbed, TreeList, and QSize::width(). Referenced by KDialogBase::minimumSizeHint(), and sizeHint(). |
|
Returns the recommended size for the widget in order to be displayed properly.
Reimplemented from QWidget. Definition at line 817 of file kjanuswidget.cpp. References minimumSizeHint(). |
|
Returns the empty widget that is available in Plain mode.
Definition at line 220 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 267 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 241 of file kjanuswidget.cpp. References addPageWidget(), endl(), FindParent(), and kdDebug(). |
|
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 294 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 277 of file kjanuswidget.cpp. References addPageWidget(), endl(), FindParent(), kdDebug(), and 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 319 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 303 of file kjanuswidget.cpp. References addPageWidget(), endl(), FindParent(), kdDebug(), 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 347 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 328 of file kjanuswidget.cpp. References addPageWidget(), endl(), FindParent(), kdDebug(), 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 1189 of file kjanuswidget.cpp. References QMap::begin(), QMap::end(), IconList, QMap::remove(), QTabWidget::removePage(), QWidgetStack::removeWidget(), and TreeList. |
|
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 671 of file kjanuswidget.cpp. References IconList, QWidget::parentWidget(), Tabbed, and TreeList. 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 502 of file kjanuswidget.cpp. References QGridLayout::addColSpacing(), QGridLayout::addRowSpacing(), QGridLayout::addWidget(), QObject::isWidgetType(), QWidget::layout(), QWidget::minimumSize(), QWidget::reparent(), QWidget::setMinimumSize(), and Swallow. 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 823 of file kjanuswidget.cpp. References TreeList. 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 843 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 848 of file kjanuswidget.cpp. References QListView::setRootIsDecorated(), and TreeList. Referenced by KDialogBase::setRootIsDecorated(). |
|
This function has only effect in TreeList mode. This tells the TreeList to unfold the whole tree so that all entries are visible.
If the list is empty when you call this method newly created entries will not automatically be opened. If the
Definition at line 855 of file kjanuswidget.cpp. References QListView::firstChild(), QListViewItem::itemBelow(), QListViewItem::setOpen(), and TreeList. Referenced by KDialogBase::unfoldTreeList(). |
|
Add a widget at the bottom of the TreeList/IconList.
Definition at line 869 of file kjanuswidget.cpp. References IconList, QWidget::reparent(), and TreeList. Referenced by KDialogBase::addWidgetBelowList(). |
|
Add a button at the bottom of the TreeList/IconList.
Definition at line 877 of file kjanuswidget.cpp. References IconList, and TreeList. Referenced by KDialogBase::addButtonBelowList(). |
|
The same as the above function, but with a KGuiItem providing the text and icon for the button at the bottom of the TreeList/IconList.
Definition at line 886 of file kjanuswidget.cpp. |
|
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 835 of file kjanuswidget.cpp. References IconList. Referenced by KDialogBase::setIconListAllVisible(). |
|
Sets the icon used in TreeList Mode for the given path.
Definition at line 494 of file kjanuswidget.cpp. References QMap::insert(), and QStringList::join(). Referenced by KDialogBase::setFolderIcon(). |
|
Returns the title string associated with a page index in TreeList or IconList mode.
Definition at line 1235 of file kjanuswidget.cpp. |
|
Returns the page widget associated with a page index or null if there is no such page.
Definition at line 1244 of file kjanuswidget.cpp. |
|
This signal is emitted whenever the current page changes.
Referenced by KJanusWidget(). |
|
Give the keyboard input focus to the widget.
Reimplemented from QWidget. Definition at line 736 of file kjanuswidget.cpp. References IconList, Plain, QWidget::setFocus(), Swallow, Tabbed, and TreeList. |
|
Reimplemented to handle the splitter width when the the face is TreeList.
Reimplemented from QWidget. Definition at line 895 of file kjanuswidget.cpp. References TreeList. |
|
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 910 of file kjanuswidget.cpp. References QEvent::type(). |
The documentation for this class was generated from the following files: