![]() |
SARibbon 2.5.2
SARibbon wiki
|
自定义界面窗口 更多...
#include <SARibbonCustomizeWidget.h>
类 | |
| class | PrivateData |
| 管理SARibbonCustomizeWidget的业务逻辑 | |
Public 类型 | |
| enum | RibbonTreeShowType { ShowAllCategory , ShowMainCategory } |
| 定义ribbon树的显示类型 更多... | |
| enum | ItemRole { LevelRole = Qt::UserRole + 1 , PointerRole = Qt::UserRole + 2 , CanCustomizeRole = Qt::UserRole + 3 , CustomizeRole = Qt::UserRole + 4 , CustomizeObjNameRole = Qt::UserRole + 5 } |
| QStandardItem对应的role 更多... | |
Public 成员函数 | |
| SARibbonCustomizeWidget (SARibbonMainWindow *ribbonWindow, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
| SARibbonCustomizeWidget::SARibbonCustomizeWidget | |
| SARibbonCustomizeWidget (SARibbonBar *ribbonbar, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
| void | setupActionsManager (SARibbonActionsManager *mgr) |
| 设置action管理器 | |
| bool | isApplied () const |
| //判断用户是否有要存储的内容,对应save动作 | |
| bool | isCached () const |
| 判断用户是否有改动内容,对应apply动作 | |
| const QStandardItemModel * | model () const |
| 获取model | |
| void | updateModel () |
| 根据当前的radiobutton选项来更新model | |
| void | updateModel (RibbonTreeShowType type) |
| 更新model | |
| bool | applys () |
| 应用所有设定 | |
| bool | toXml (QXmlStreamWriter *xml) const |
| 转换为xml | |
| bool | toXml (const QString &xmlpath) const |
| 把配置写入文件中 | |
| void | fromXml (QXmlStreamReader *xml) |
| 从xml中加载QList<SARibbonCustomizeData> | |
| void | fromXml (const QString &xmlpath) |
| 从xml中加载QList<SARibbonCustomizeData> | |
| void | makeActionsApplied () |
| 清除已应用的动作 | |
| void | clearApplied () |
| 清除applied的动作,cancel操作后需要清空已应用的动作 | |
| void | clearCache () |
| 清除缓存动作 | |
| void | clear () |
| 清除所有动作,不包含本地读取的数据 | |
静态 Public 成员函数 | |
| static bool | fromXml (QXmlStreamReader *xml, SARibbonBar *bar, SARibbonActionsManager *mgr) |
| 应用xml配置 | |
Protected 成员函数 | |
| void | simplify () |
| 精简 | |
| SARibbonPanelItem::RowProportion | selectedRowProportion () const |
| 获取当前界面选中的行属性 | |
| QAction * | selectedAction () const |
| 获取listview中选中的action | |
| QAction * | itemToAction (QStandardItem *item) const |
| 把item转换为action | |
| QStandardItem * | selectedItem () const |
| 获取ribbon tree选中的item | |
| int | selectedRibbonLevel () const |
| 获取选中的ribbon tree 的level | |
| int | itemLevel (QStandardItem *item) const |
| 获取StandardItem 的level | |
| void | setSelectItem (QStandardItem *item, bool ensureVisible=true) |
| 设置某个item被选中 | |
| bool | isItemCanCustomize (QStandardItem *item) const |
| 判断itemn能否改动,可以改动返回true | |
| bool | isSelectedItemCanCustomize () const |
| bool | isCustomizeItem (QStandardItem *item) const |
| 判断itemn能否改动,可以改动返回true | |
| bool | isSelectedItemIsCustomize () const |
| void | removeItem (QStandardItem *item) |
自定义界面窗口
|
explicit |
SARibbonCustomizeWidget::SARibbonCustomizeWidget
| ribbonWindow | 传入需要管理的SARibbonMainWindow指针 |
| parent | 用于界面生成的parent,可以和SARibbonMainWindow一样 |
| f | 同QWidget::QWidget的第二个参数 |
| bool SARibbonCustomizeWidget::applys | ( | ) |
应用所有设定
| void SARibbonCustomizeWidget::clearCache | ( | ) |
清除缓存动作
在执行applys函数后,如果要继续调用,应该clear,否则会导致异常
| void SARibbonCustomizeWidget::fromXml | ( | const QString & | xmlpath | ) |
从xml中加载QList<SARibbonCustomizeData>
对于基于配置文件的设置,对话框显示前建议调用此函数,保证叠加设置的正确记录
| xmlpath |
| void SARibbonCustomizeWidget::fromXml | ( | QXmlStreamReader * | xml | ) |
从xml中加载QList<SARibbonCustomizeData>
对于基于配置文件的设置,对话框显示前建议调用此函数,保证叠加设置的正确记录
| xml |
|
static |
应用xml配置
| xml | |
| bar | SARibbonBar |
| bool SARibbonCustomizeWidget::isApplied | ( | ) | const |
//判断用户是否有要存储的内容,对应save动作
| bool SARibbonCustomizeWidget::isCached | ( | ) | const |
判断用户是否有改动内容,对应apply动作
|
protected |
判断itemn能否改动,可以改动返回true
| item |
|
protected |
判断itemn能否改动,可以改动返回true
| item |
|
protected |
获取StandardItem 的level
| item |
|
protected |
把item转换为action
| item |
| const QStandardItemModel * SARibbonCustomizeWidget::model | ( | ) | const |
获取model
|
protected |
|
protected |
获取ribbon tree选中的item
|
protected |
获取选中的ribbon tree 的level
|
protected |
获取当前界面选中的行属性
|
protected |
设置某个item被选中
| item |
| void SARibbonCustomizeWidget::setupActionsManager | ( | SARibbonActionsManager * | mgr | ) |
设置action管理器
| mgr |
| bool SARibbonCustomizeWidget::toXml | ( | const QString & | xmlpath | ) | const |
把配置写入文件中
| xmlpath |
| bool SARibbonCustomizeWidget::toXml | ( | QXmlStreamWriter * | xml | ) | const |
转换为xml
此函数仅会写element,不会写document相关内容,因此如果需要写document, 需要在此函数前调用QXmlStreamWriter::writeStartDocument(),在此函数后调用QXmlStreamWriter::writeEndDocument()