BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
WidgetBoxTreeWidget: A tree of categories. More...
Public Types | |
typedef QDesignerWidgetBoxInterface::Category | Category |
typedef QDesignerWidgetBoxInterface::CategoryList | CategoryList |
typedef QDesignerWidgetBoxInterface::Widget | Widget |
Public Slots | |
void | filter (const QString &) |
Signals | |
void | pressed (const QString name, const QString dom_xml, const QPoint &global_mouse_pos) |
Public Member Functions | |
WidgetBoxTreeWidget (SampleDesignerInterface *core, QWidget *parent=0) | |
virtual | ~WidgetBoxTreeWidget () |
void | addCategory (const Category &cat) |
void | addWidget (int cat_idx, const Widget &wgt) |
Category | category (int cat_idx) const |
int | categoryCount () const |
void | dropWidgets (const QList< QDesignerDnDItemInterface * > &item_list) |
QString | fileName () const |
QIcon | iconForWidget (QString iconName) const |
bool | load (QDesignerWidgetBox::LoadMode loadMode) |
bool | loadContents (const QString &contents) |
void | removeCategory (int cat_idx) |
void | removeWidget (int cat_idx, int wgt_idx) |
bool | save () |
void | setFileName (const QString &file_name) |
Widget | widget (int cat_idx, int wgt_idx) const |
int | widgetCount (int cat_idx) const |
Protected Member Functions | |
virtual void | contextMenuEvent (QContextMenuEvent *e) |
virtual void | resizeEvent (QResizeEvent *e) |
Private Types | |
typedef QHash< QString, QIcon > | IconCache |
Private Slots | |
void | deleteScratchpad () |
void | handleMousePress (QTreeWidgetItem *item) |
void | slotIconMode () |
void | slotLastScratchPadItemDeleted () |
void | slotListMode () |
void | slotSave () |
void | slotScratchPadItemDeleted () |
Private Member Functions | |
WidgetBoxCategoryListView * | addCategoryView (QTreeWidgetItem *parent, bool iconMode) |
void | addCustomCategories (bool replace) |
void | adjustSubListSize (QTreeWidgetItem *cat_item) |
WidgetBoxCategoryListView * | categoryViewAt (int idx) const |
int | ensureScratchpad () |
int | indexOfCategory (const QString &name) const |
int | indexOfScratchpad () const |
CategoryList | loadCustomCategoryList () const |
void | restoreExpandedState () |
void | saveExpandedState () const |
void | updateViewMode () |
void | writeCategories (QXmlStreamWriter &writer, const CategoryList &cat_list) const |
Static Private Member Functions | |
static bool | readCategories (const QString &fileName, const QString &xml, CategoryList *cats, QString *errorMessage) |
static bool | readWidget (Widget *w, const QString &xml, QXmlStreamReader &r) |
Private Attributes | |
SampleDesignerInterface * | m_core |
QString | m_file_name |
bool | m_iconMode |
IconCache | m_pluginIcons |
QTimer * | m_scratchPadDeleteTimer |
WidgetBoxTreeWidget: A tree of categories.
Definition at line 68 of file widgetboxtreewidget.h.
typedef QDesignerWidgetBoxInterface::Category qdesigner_internal::WidgetBoxTreeWidget::Category |
Definition at line 73 of file widgetboxtreewidget.h.
typedef QDesignerWidgetBoxInterface::CategoryList qdesigner_internal::WidgetBoxTreeWidget::CategoryList |
Definition at line 74 of file widgetboxtreewidget.h.
|
private |
Definition at line 141 of file widgetboxtreewidget.h.
typedef QDesignerWidgetBoxInterface::Widget qdesigner_internal::WidgetBoxTreeWidget::Widget |
Definition at line 72 of file widgetboxtreewidget.h.
|
explicit |
Definition at line 111 of file widgetboxtreewidget.cpp.
References handleMousePress().
|
virtual |
Definition at line 165 of file widgetboxtreewidget.cpp.
References saveExpandedState().
void qdesigner_internal::WidgetBoxTreeWidget::addCategory | ( | const Category & | cat | ) |
Definition at line 630 of file widgetboxtreewidget.cpp.
References addCategoryView(), qdesigner_internal::WidgetBoxCategoryListView::addWidget(), adjustSubListSize(), categoryViewAt(), qdesigner_internal::WidgetBoxCategoryListView::containsWidget(), ensureScratchpad(), iconForWidget(), indexOfCategory(), indexOfScratchpad(), m_iconMode, NORMAL_ITEM, setTopLevelRole(), and widgetCount().
Referenced by qdesigner_internal::WidgetBox::addCategory(), addCustomCategories(), and loadContents().
|
private |
Definition at line 240 of file widgetboxtreewidget.cpp.
References m_core, pressed(), qdesigner_internal::WidgetBoxCategoryListView::setViewMode(), slotLastScratchPadItemDeleted(), slotSave(), and slotScratchPadItemDeleted().
Referenced by addCategory(), and ensureScratchpad().
|
private |
Definition at line 314 of file widgetboxtreewidget.cpp.
References addCategory(), categoryViewAt(), loadCustomCategoryList(), and qdesigner_internal::WidgetBoxCategoryListView::removeCustomWidgets().
Referenced by load().
void qdesigner_internal::WidgetBoxTreeWidget::addWidget | ( | int | cat_idx, |
const Widget & | wgt | ||
) |
Definition at line 702 of file widgetboxtreewidget.cpp.
References qdesigner_internal::WidgetBoxCategoryListView::addWidget(), adjustSubListSize(), categoryViewAt(), iconForWidget(), SCRATCHPAD_ITEM, and topLevelRole().
Referenced by qdesigner_internal::WidgetBox::addWidget().
|
private |
Definition at line 585 of file widgetboxtreewidget.cpp.
Referenced by addCategory(), addWidget(), dropWidgets(), filter(), resizeEvent(), slotScratchPadItemDeleted(), and updateViewMode().
WidgetBoxTreeWidget::Category qdesigner_internal::WidgetBoxTreeWidget::category | ( | int | cat_idx | ) | const |
Definition at line 605 of file widgetboxtreewidget.cpp.
References qdesigner_internal::WidgetBoxCategoryListView::category(), SCRATCHPAD_ITEM, and topLevelRole().
Referenced by qdesigner_internal::WidgetBox::category(), readCategories(), save(), and writeCategories().
int qdesigner_internal::WidgetBoxTreeWidget::categoryCount | ( | ) | const |
Definition at line 600 of file widgetboxtreewidget.cpp.
Referenced by qdesigner_internal::WidgetBox::categoryCount(), ensureScratchpad(), and save().
|
private |
Definition at line 144 of file widgetboxtreewidget.cpp.
References ASSERT.
Referenced by addCategory(), addCustomCategories(), addWidget(), dropWidgets(), filter(), removeWidget(), updateViewMode(), widget(), and widgetCount().
|
protectedvirtual |
Definition at line 800 of file widgetboxtreewidget.cpp.
References m_iconMode, SCRATCHPAD_ITEM, slotIconMode(), slotListMode(), and topLevelRole().
|
privateslot |
Definition at line 751 of file widgetboxtreewidget.cpp.
References indexOfScratchpad(), and save().
Referenced by slotLastScratchPadItemDeleted().
void qdesigner_internal::WidgetBoxTreeWidget::dropWidgets | ( | const QList< QDesignerDnDItemInterface * > & | item_list | ) |
Definition at line 836 of file widgetboxtreewidget.cpp.
References qdesigner_internal::WidgetBoxCategoryListView::addWidget(), adjustSubListSize(), categoryViewAt(), qdesigner_internal::WidgetBoxCategoryListView::count(), DomWidget::elementWidget(), ensureScratchpad(), qdesigner_internal::WidgetBoxCategoryListView::FILTERED, iconForWidget(), save(), qdesigner_internal::WidgetBoxCategoryListView::setCurrentItem(), DomUI::setElementWidget(), DomUI::takeElementWidget(), and DomUI::write().
Referenced by qdesigner_internal::WidgetBox::dropWidgets().
|
private |
Definition at line 227 of file widgetboxtreewidget.cpp.
References addCategoryView(), categoryCount(), indexOfScratchpad(), SCRATCHPAD_ITEM, and setTopLevelRole().
Referenced by addCategory(), and dropWidgets().
QString qdesigner_internal::WidgetBoxTreeWidget::fileName | ( | ) | const |
Definition at line 175 of file widgetboxtreewidget.cpp.
References m_file_name.
Referenced by qdesigner_internal::WidgetBox::fileName(), load(), readCategories(), and save().
|
slot |
Definition at line 901 of file widgetboxtreewidget.cpp.
References adjustSubListSize(), categoryViewAt(), qdesigner_internal::WidgetBoxCategoryListView::count(), qdesigner_internal::WidgetBoxCategoryListView::filter(), and qdesigner_internal::WidgetBoxCategoryListView::FILTERED.
|
privateslot |
QIcon qdesigner_internal::WidgetBoxTreeWidget::iconForWidget | ( | QString | iconName | ) | const |
Definition at line 131 of file widgetboxtreewidget.cpp.
References createIconSet(), iconPrefixC, m_pluginIcons, and qtLogoC.
Referenced by addCategory(), addWidget(), dropWidgets(), and qdesigner_internal::WidgetBox::iconForWidget().
|
private |
Definition at line 267 of file widgetboxtreewidget.cpp.
References RealSpace::Particles::name().
Referenced by addCategory().
|
private |
Definition at line 256 of file widgetboxtreewidget.cpp.
References SCRATCHPAD_ITEM, and topLevelRole().
Referenced by addCategory(), deleteScratchpad(), ensureScratchpad(), and slotScratchPadItemDeleted().
bool qdesigner_internal::WidgetBoxTreeWidget::load | ( | QDesignerWidgetBox::LoadMode | loadMode | ) |
Definition at line 277 of file widgetboxtreewidget.cpp.
References addCustomCategories(), fileName(), loadContents(), qdesigner_internal::QDesignerWidgetBox::LoadCustomWidgetsOnly, qdesigner_internal::QDesignerWidgetBox::LoadReplace, and RealSpace::Particles::name().
Referenced by qdesigner_internal::WidgetBox::load().
bool qdesigner_internal::WidgetBoxTreeWidget::loadContents | ( | const QString & | contents | ) |
Definition at line 300 of file widgetboxtreewidget.cpp.
References addCategory(), qdesigner_internal::designerWarning(), m_file_name, and readCategories().
Referenced by load(), and qdesigner_internal::WidgetBox::loadContents().
|
private |
|
signal |
Referenced by addCategoryView().
|
staticprivate |
Definition at line 337 of file widgetboxtreewidget.cpp.
References category(), categoryElementC, categoryEntryElementC, customValueC, fileName(), iconAttributeC, invisibleNameC, qdesigner_internal::msgXmlError(), nameAttributeC, readWidget(), scratchPadValueC, typeAttributeC, and widgetBoxRootElementC.
Referenced by loadContents().
|
staticprivate |
Read out a widget within a category. This can either be enclosed in a <ui> element or a (legacy) <widget> element which may contain nested <widget> elements.
Examples:
<ui language="c++"> <widget class="MultiPageWidget" name="multipagewidget"> ... </widget> <customwidgets>...</customwidgets> <ui>
or
<widget> <widget> ... </widget> ... <widget>
Returns true on success, false if end was reached or an error has been encountered in which case the reader has its error flag set. If successful, the current item of the reader will be the closing element (</ui> or </widget>)
Definition at line 452 of file widgetboxtreewidget.cpp.
References RealSpace::Particles::name(), uiElementC, and widgetElementC.
Referenced by readCategories().
void qdesigner_internal::WidgetBoxTreeWidget::removeCategory | ( | int | cat_idx | ) |
Definition at line 678 of file widgetboxtreewidget.cpp.
Referenced by qdesigner_internal::WidgetBox::removeCategory().
void qdesigner_internal::WidgetBoxTreeWidget::removeWidget | ( | int | cat_idx, |
int | wgt_idx | ||
) |
Definition at line 715 of file widgetboxtreewidget.cpp.
References categoryViewAt(), qdesigner_internal::WidgetBoxCategoryListView::count(), qdesigner_internal::WidgetBoxCategoryListView::removeRow(), and qdesigner_internal::WidgetBoxCategoryListView::UNFILTERED.
Referenced by qdesigner_internal::WidgetBox::removeWidget().
|
protectedvirtual |
Definition at line 791 of file widgetboxtreewidget.cpp.
References adjustSubListSize().
|
private |
Definition at line 159 of file widgetboxtreewidget.cpp.
bool qdesigner_internal::WidgetBoxTreeWidget::save | ( | ) |
Definition at line 180 of file widgetboxtreewidget.cpp.
References category(), categoryCount(), fileName(), and writeCategories().
Referenced by deleteScratchpad(), dropWidgets(), qdesigner_internal::WidgetBox::save(), slotSave(), and slotScratchPadItemDeleted().
|
private |
Definition at line 154 of file widgetboxtreewidget.cpp.
Referenced by ~WidgetBoxTreeWidget().
void qdesigner_internal::WidgetBoxTreeWidget::setFileName | ( | const QString & | file_name | ) |
Definition at line 170 of file widgetboxtreewidget.cpp.
References m_file_name.
Referenced by qdesigner_internal::WidgetBox::setFileName().
|
privateslot |
Definition at line 766 of file widgetboxtreewidget.cpp.
References m_iconMode, and updateViewMode().
Referenced by contextMenuEvent().
|
privateslot |
Definition at line 738 of file widgetboxtreewidget.cpp.
References deleteScratchpad(), and m_scratchPadDeleteTimer.
Referenced by addCategoryView().
|
privateslot |
Definition at line 760 of file widgetboxtreewidget.cpp.
References m_iconMode, and updateViewMode().
Referenced by contextMenuEvent().
|
privateslot |
Definition at line 204 of file widgetboxtreewidget.cpp.
References save().
Referenced by addCategoryView().
|
privateslot |
Definition at line 730 of file widgetboxtreewidget.cpp.
References adjustSubListSize(), indexOfScratchpad(), and save().
Referenced by addCategoryView().
|
private |
Definition at line 772 of file widgetboxtreewidget.cpp.
References adjustSubListSize(), categoryViewAt(), m_iconMode, SCRATCHPAD_ITEM, and topLevelRole().
Referenced by slotIconMode(), and slotListMode().
WidgetBoxTreeWidget::Widget qdesigner_internal::WidgetBoxTreeWidget::widget | ( | int | cat_idx, |
int | wgt_idx | ||
) | const |
Definition at line 693 of file widgetboxtreewidget.cpp.
References categoryViewAt(), qdesigner_internal::WidgetBoxCategoryListView::UNFILTERED, and qdesigner_internal::WidgetBoxCategoryListView::widgetAt().
Referenced by qdesigner_internal::WidgetBox::widget().
int qdesigner_internal::WidgetBoxTreeWidget::widgetCount | ( | int | cat_idx | ) | const |
Definition at line 685 of file widgetboxtreewidget.cpp.
References categoryViewAt(), qdesigner_internal::WidgetBoxCategoryListView::count(), and qdesigner_internal::WidgetBoxCategoryListView::UNFILTERED.
Referenced by addCategory(), qdesigner_internal::WidgetBox::widgetCount(), and writeCategories().
|
private |
Definition at line 516 of file widgetboxtreewidget.cpp.
References category(), categoryElementC, categoryEntryElementC, defaultTypeValueC, iconAttributeC, iconPrefixC, RealSpace::Particles::name(), nameAttributeC, scratchPadValueC, typeAttributeC, widgetBoxRootElementC, widgetCount(), qdesigner_internal::WidgetBoxCategoryListView::widgetDomXml(), widgetElementC, DomUI::write(), and qdesigner_internal::QDesignerWidgetBox::xmlToUi().
Referenced by save().
|
private |
Definition at line 139 of file widgetboxtreewidget.h.
Referenced by addCategoryView().
|
private |
Definition at line 140 of file widgetboxtreewidget.h.
Referenced by fileName(), loadContents(), and setFileName().
|
private |
Definition at line 143 of file widgetboxtreewidget.h.
Referenced by addCategory(), contextMenuEvent(), slotIconMode(), slotListMode(), and updateViewMode().
|
mutableprivate |
Definition at line 142 of file widgetboxtreewidget.h.
Referenced by iconForWidget().
|
private |
Definition at line 144 of file widgetboxtreewidget.h.
Referenced by slotLastScratchPadItemDeleted().