- qtgui
- qtdbus
- qtwidgets
- qtcore
- dtkcore
- qsettingbackend_zh
- dobject_zh
- abstractappender_zh
- abstractstringappender_zh
- dfilewatcher_zh
- outputdebugappender_zh
- dsettingsbackend_zh
- drecentmanager_zh
- ddesktopentry_zh
- consoleappender_zh
- gsettingsbackend_zh
- dsettingsgroup_zh
- dlogmanager_zh
- fileappender_zh
- dsettings_zh
- dfilesystemwatcher_zh
- dfilewatchermanager_zh
- dbasefilewatcher_zh
- dtkgui
- dtkwidget
- dviewitemaction_zh
- dstandarditem_zh
- dfiledialog_zh
- dclipeffectwidget_zh
- danchors_zh
- dgraphicsclipeffect_zh
- dstyle_zh
- dcoloredprogressbar_zh
- dbuttonboxbutton_zh
- dlabel_zh
- dtiplabel_zh
- darrowlinedrawer_zh
- daboutdialog_zh
- dsettingswidgetfactory_zh
- dsearchcombobox_zh
- dcrumbedit_zh
- dcommandlinkbutton_zh
- dsettingsdialog_zh
- dwindowoptionbutton_zh
- dspinner_zh
- dsimplelistview_zh
- dwaterprogress_zh
- dmainwindow_zh
- dhidpihelper_zh
- dslider_zh
- dpasswordedit_zh
- danchorinfo_zh
- dmpriscontrol_zh
- darrowbutton_zh
- dbackgroundgroup_zh
- dcircleprogress_zh
- dwarningbutton_zh
- dwindowclosebutton_zh
- dvideowidget_zh
- dfilechooseredit_zh
- dblureffectwidget_zh
- darrowrectangle_zh
- dsearchedit_zh
- dfloatingmessage_zh
- dswitchlineexpand_zh
- dtabbar_zh
- dlineedit_zh
- danchorsbase_zh
- dstylediconengine_zh
- dwindowmaxbutton_zh
- dpageindicator_zh
- dsuggestbutton_zh
- dapplicationsettings_zh
- dtooltip_zh
- dwindowminbutton_zh
- ddrawer_zh
- dtitlebar_zh
- dsimplelistitem_zh
- dpicturesequenceview_zh
dviewitemaction_zh
Class::DViewItemAction
暂无该属性
Detailed Description
是一个 action 活动, 其默认是不能被点击的. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
setActionList(Qt::BottomEdge, *list) 的 BottomEdge 为水平方向的枚举值时候: LeftEdge, RightEdge, 其对应 alignment 枚举数值只有如下的有效:
其参数 alignment 为如下值时候(才有效):
AlignTop
AlignVCenter
AlignBottom
此处举一个小例子, 可以自行修改相关参数, 查看结果, 理解参数:
QMainWindow *wid = new QMainWindow();
wid->resize(800, 600);
//视图和模型
DListView *view = new DListView(wid);
QStandardItemModel *model = new QStandardItemModel(view);
view->setModel(model);
//标准DStandardItem item
DStandardItem *item = new DStandardItem();
item->setText("@1:这是同一个item 的text\n@2:这是同一个item 的text\n@3:这是同一个item 的text\n@4:这是同一个item 的text\n@5:这是同一个item 的text\n@6:这是同一个item 的text");
//DViewItemAction() 的形参: 其参数 alignment = AlignLeft 或 AlignHCenter 或 AlignRight; 设置为 AlignTop, AlignVCenter, AlignBottom 也是无效的
DViewItemAction *act1 = new DViewItemAction(Qt::AlignBottom, QSize(15, 15), QSize(50, 50));
act1->setText("act1");
act1->setIcon(QIcon("/home/yuanyi/Desktop/dog.jpg"));
DViewItemAction *act2 = new DViewItemAction(Qt::AlignVCenter, QSize(15, 15), QSize());
act2->setText("act2");
act2->setIcon(QIcon("/home/yuanyi/Desktop/dog.jpg"));
DViewItemAction *act3 = new DViewItemAction(Qt::AlignTop, QSize(15, 15), QSize(100, 50));
act3->setText("act3");
act3->setIcon(QIcon("/home/yuanyi/Desktop/dog.jpg"));
DViewItemAction *act4 = new DViewItemAction(Qt::AlignBottom, QSize(15, 15), QSize(100, 50));
act4->setText("act4");
act4->setIcon(QIcon("/home/yuanyi/Desktop/dog.jpg"));
DViewItemActionList *list = new DViewItemActionList();
list->append(act1);
list->append(act2);
list->append(act3);
list->append(act4);
//edge实参: TopEdg, BottomEdge (主要设置前面两个参数), LeftEdge, RightEdge
item->setActionList(Qt::LeftEdge, *list);
model->appendRow(item);
wid->setCentralWidget(view);
wid->show();
上代码示例 code 效果图如下:
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
setActionList(Qt::BottomEdge, *list) 的 BottomEdge 为竖直方向的枚举值时候: TopEdge, BottomEdge, 其对应 alignment 枚举数值只有如下的有效:
其参数 alignment 为如下值时候(才有效):
AlignLeft
AlignHCenter
AlignRight
此处举一个小例子, 可以自行修改相关参数, 查看结果, 理解参数:
QMainWindow *wid = new QMainWindow();
wid->resize(800, 600);
//视图和模型
DListView *view = new DListView(wid);
QStandardItemModel *model = new QStandardItemModel(view);
view->setModel(model);
//标准DStandardItem item
DStandardItem *item = new DStandardItem();
item->setText("这是一个item 的text");
//DViewItemAction() 的形参: 其参数 alignment = AlignLeft 或 AlignHCenter 或 AlignRight; 设置为 AlignTop, AlignVCenter, AlignBottom 也是无效的
DViewItemAction *act1 = new DViewItemAction(Qt::AlignLeft, QSize(15, 15), QSize(50, 50));
act1->setText("act1");
act1->setIcon(QIcon("/home/yuanyi/Desktop/dog.jpg"));
DViewItemAction *act2 = new DViewItemAction(Qt::AlignRight, QSize(15, 15), QSize());
act2->setText("act2");
act2->setIcon(QIcon("/home/yuanyi/Desktop/dog.jpg"));
DViewItemAction *act3 = new DViewItemAction(Qt::AlignHCenter, QSize(15, 15), QSize(100, 50));
act3->setText("act3");
act3->setIcon(QIcon("/home/yuanyi/Desktop/dog.jpg"));
DViewItemAction *act4 = new DViewItemAction(Qt::AlignLeft, QSize(15, 15), QSize(100, 50));
act4->setText("act4");
act4->setIcon(QIcon("/home/yuanyi/Desktop/dog.jpg"));
DViewItemActionList *list = new DViewItemActionList();
list->append(act1);
list->append(act2);
list->append(act3);
list->append(act4);
//edge实参: TopEdg, BottomEdge (主要设置前面两个参数), LeftEdge, RightEdge
item->setActionList(Qt::BottomEdge, *list);
model->appendRow(item);
wid->setCentralWidget(view);
wid->show();
上代码示例 code 效果图如下:
alignment 设置本控件对象(在父控件的)方向位置: 居左, 居中, 居右 (其他枚举值此处无效) [out] iconSize 本控件的图标 icon 的大小
DViewItemAction::D_DECLARE_PRIVATE
int D_DECLARE_PRIVATE(DViewItemAction )
DViewItemAction::DViewItemAction
DViewItemAction(int alignment, const int &iconSize, const int &maxSize, bool clickable, int *parent)
DViewItemAction::alignment
int alignment() const
获取 DViewItemAction 放置的(水平)位置 Returns 返回 DViewItemAction 放置的(水平)位置
DViewItemAction::iconSize
int iconSize() const
获取图标 icon 的矩形大小 Returns 返回图标 icon 的矩形大小
DViewItemAction::maximumSize
int maximumSize() const
获取最大的矩形大小 Returns 返回最大的矩形大小
DViewItemAction::clickAreaMargins
int clickAreaMargins() const
获取点击区域范围 Returns 返回点击区域范围
DViewItemAction::setClickAreaMargins
void setClickAreaMargins(const int &margins)
设置点击区域范围(eg: 只有图标 icon 时候,会点击区域比较小, 不方便点击, 可以将点击范围设置大一点,便于点击) margins 将被设置的点击区域间隔数值
DViewItemAction::setTextColorRole
void setTextColorRole(int role)
设置文本颜色的角色枚举数值 (QPalette) role 文本颜色的枚举值
DViewItemAction::textColorType
int textColorType() const
获取文本颜色类型 Returns 返回文本颜色的类型
DViewItemAction::textColorRole
int textColorRole() const
获取文本颜色角色 Returns 返回文本颜色角色
DViewItemAction::setFontSize
void setFontSize(int size)
设置字体大小 size 将要设置的字体大小值
DViewItemAction::font
int font() const
获取字体 Returns 返回字体
DViewItemAction::isClickable
bool isClickable() const
获取是否允许被点击的状态(即:如果可以被点击返回true,否则返回false) Returns 返回是否允许被点击的状态
DViewItemAction::setWidget
void setWidget(int *widget)
设置 QWidget widget 被添加进来的 QWidget
DViewItemAction::widget
int * widget() const
获取 QWidget 控件对象 Returns 返回 QWidget 控件对象