QtCanpool 3.3.0
载入中...
搜索中...
未找到
ribbongallerygroup.h
浏览该文件的文档.
1
5#pragma once
6
7#include "qxribbon_global.h"
8#include <QListView>
9
10class QActionGroup;
11
13
14class RibbonGalleryGroupPrivate;
15
21class QX_RIBBON_EXPORT RibbonGalleryGroup : public QListView
22{
23 Q_OBJECT
24public:
33
38 DisplayOneRow = 1,
39 DisplayTwoRow = 2,
40 DisplayThreeRow = 3
41 };
42public:
43 explicit RibbonGalleryGroup(QWidget *w = Q_NULLPTR);
44 virtual ~RibbonGalleryGroup();
45
46 void setRecalcGridSizeBlock(bool on = true);
47 bool isRecalcGridSizeBlock() const;
48 void recalcGridSize();
49 void recalcGridSize(int galleryHeight);
50
51 void setGalleryGroupStyle(GalleryGroupStyle style);
52 GalleryGroupStyle galleryGroupStyle() const;
53
54 void addItem(const QString &text, const QIcon &icon);
55 void addItem(QAction *act);
56 void addItems(const QList<QAction *> &acts);
57
58 void setGroupTitle(const QString &title);
59 QString groupTitle() const;
60
61 void selectByIndex(int i);
62
63 void setDisplayRow(DisplayRow r);
64 DisplayRow displayRow() const;
65
66 void setGridMinimumWidth(int w);
67 int gridMinimumWidth() const;
68
69 void setGridMaximumWidth(int w);
70 int gridMaximumWidth() const;
71
72 QSize sizeHint() const override;
73
74 QActionGroup *actionGroup() const;
75private Q_SLOTS:
76 void onItemClicked(const QModelIndex &index);
77 void onItemEntered(const QModelIndex &index);
78Q_SIGNALS:
79 void groupTitleChanged(const QString &title);
85 void triggered(QAction *action);
93 void hovered(QAction *action);
94private:
96};
97
DisplayRow
定义Gallery在一个group下面显示的图标行数
void triggered(QAction *action)
等同QActionGroup的triggered 所有加入RibbonGalleryGroup的action都会被一个QActionGroup管理,可以通过
void hovered(QAction *action)
等同QActionGroup的hovered 所有加入RibbonGalleryGroup的action都会被一个QActionGroup管理,可以通过
GalleryGroupStyle
GalleryGroup显示的样式
@ IconWithWordWrapText
图标带文字,文字会换行显示,此模式只会对DisplayOneRow生效,如果不是DisplayOneRow,等同IconWithText
void groupTitleChanged(const QString &title)
#define QX_DECLARE_PRIVATE(Class)
#define Q_NULLPTR
Copyleft (C) 2025 maminjie canpool@163.com SPDX-License-Identifier: MulanPSL-2.0
#define QX_RIBBON_EXPORT
#define QX_RIBBON_END_NAMESPACE
#define QX_RIBBON_BEGIN_NAMESPACE
QColor text