38 #include <QGraphicsGridLayout>
39 #include <QGraphicsSceneResizeEvent>
68 q->horizontalScrollBar()->setSliderSize(0.0);
87 const bool caching =
q->listItemCaching();
88 q->setListItemCaching(
false);
96 q->viewport()->setFlag(
99 q->setListItemCaching(caching);
113 QRectF listRect =
q->boundingRect();
116 q->horizontalScrollBar()->setSliderSize(0.0);
118 if (contentRect.
height()-
q->boundingRect().height() > 0) {
119 q->verticalScrollBar()->setSliderSize(contentRect.
height()-
q->boundingRect().height());
121 !
q->verticalScrollBar()->isVisible()) {
122 q->verticalScrollBar()->show();
127 q->verticalScrollBar()->setSliderSize(0.0);
128 q->verticalScrollBar()->hide();
131 q->verticalScrollBar()->setSliderSize(0.0);
141 q->verticalScrollBar()->setSliderPosition(
pos);
148 const bool caching =
q->listItemCaching();
149 q->setListItemCaching(
false);
154 for (
int i=0;
i<itemCount; ++
i) {
159 if (
filename.contains(
"contact_default_icon")) {
198 q->setListItemCaching(caching);
205 const bool caching =
q->listItemCaching();
206 q->setListItemCaching(
false);
210 for (
int i=
index;
i<itemCount; ++
i) {
222 q->setListItemCaching(caching);
233 bool cache =
q->listItemCaching();
234 q->setListItemCaching(
false);
244 for (
int i = 0;
i < moveditems.
count(); ++
i)
261 for (
int i = 0;
i<moveditems.
count(); ++
i) {
269 q->setListItemCaching(
cache);
299 d->m_content->setParentItem(0);
323 for (
int i =
d->m_layout->count()-1;
i >=
index; --
i) {
324 moveditems.
append(
d->m_layout->itemAt(
i));
325 d->m_layout->removeAt(
i);
329 for (
int i = moveditems.
count()-1;
i>=0; --
i) {
330 d->m_layout->addItem(moveditems.
at(
i),
d->m_layout->count(), 0);
337 d->resizeScrollBars();
338 d->updateListItemBackgrounds(
index);
349 for (
int i =
d->m_layout->count()-1;
i >=0; --
i) {
351 moveditems.
insert(moveditems.
begin(),
d->m_layout->itemAt(
i));
354 item->setGraphicsEffect(0);
357 d->m_layout->removeAt(
i);
360 for (
int i = 0;
i < moveditems.
count(); ++
i)
361 d->m_layout->addItem(moveditems.
at(
i),
d->m_layout->count(), 0);
363 d->resizeScrollBars();
373 if (
row >= 0 &&
d->m_layout->count() >
row) {
383 return d->m_layout->count();
389 return d->m_listItemCaching;
396 if (
d->m_listItemCaching ==
enabled)
401 for (
int i = 0;
i <
d->m_layout->count(); ++
i) {
404 item->graphicsEffect());
413 QRectF contentRect =
d->m_content->boundingRect();
415 QPointF contentPos =
d->m_content->pos();
417 qreal newy = contentPos.
y() - dy;
425 d->m_content->setPos(contentPos.
x(), newy);
433 d->resizeContents(
event->newSize());
434 d->resizeScrollBars();
442 return d->m_content->size();
451 d->updateListContents();
452 d->resizeScrollBars();
464 return d->twoColumns();
small capitals from c petite p scientific i
[1]
The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View.
void setRowSpacing(int row, qreal spacing)
void removeAt(int index) override
void setColumnSpacing(int column, qreal spacing)
void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment=Qt::Alignment())
QGraphicsLayoutItem * itemAt(int row, int column) const
void setSpacing(qreal spacing)
int count() const override
void setRotation(qreal angle)
@ ItemClipsChildrenToShape
void setParentItem(QGraphicsItem *parent)
QGraphicsItem * parentItem() const
void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom)
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts.
void setSizePolicy(const QSizePolicy &policy)
qreal preferredHeight() const
bool enabled
whether the item is enabled or not
QPointF pos
the position of the item
QGraphicsObject * parent
the parent of the item
The QGraphicsSceneResizeEvent class provides events for widget resizing in the graphics view framewor...
iterator insert(qsizetype i, parameter_type t)
const_reference at(qsizetype i) const noexcept
qsizetype count() const noexcept
void append(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
The QPointF class defines a point in the plane using floating point precision.
constexpr qreal x() const noexcept
constexpr qreal y() const noexcept
The QRectF class defines a finite rectangle in the plane using floating point precision.
constexpr qreal height() const noexcept
constexpr qreal top() const noexcept
The QSizeF class defines the size of a two-dimensional object using floating point precision.
constexpr qreal width() const noexcept
constexpr qreal height() const noexcept
The QString class provides a Unicode character string.
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & remove(qsizetype i, qsizetype len)
void insertItem(int index, QGraphicsWidget *item)
QGraphicsWidget * itemAt(int row)
void setListItemCaching(bool enabled)
void addItem(QGraphicsWidget *item)
bool listItemCaching() const
virtual void scrollContentsBy(qreal dx, qreal dy)
SimpleListView(QGraphicsWidget *parent=nullptr)
virtual ~SimpleListView()
void resizeEvent(QGraphicsSceneResizeEvent *event)
QGraphicsWidget * takeItem(int row)
void setTwoColumns(const bool twoColumns)
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
void updateListContents()
SimpleListViewPrivate(SimpleListView *button)
void setTwoColumns(const bool twoColumns)
QGraphicsWidget * m_content
void updateListItemBackgrounds(int index)
void resizeContents(QSizeF s)
QGraphicsGridLayout * m_layout
QBrush listItemBackgroundBrushEven() const
qreal iconRotation(const ListItem::IconItemPos iconPos) const
QFont font(Fonts type) const
qreal listItemBackgroundOpacityEven() const
bool isIconOpacityEffectEnabled(const ListItem::IconItemPos iconPos) const
bool isIconSmoothTransformationEnabled(const ListItem::IconItemPos iconPos) const
QSize listItemRounding() const
QString pixmapPath() const
qreal listItemBackgroundOpacityOdd() const
QBrush listItemBackgroundBrushOdd() const
QPen listItemBorderPen() const
QCache< int, Employee > cache
[0]
QT_END_INCLUDE_NAMESPACE typedef double qreal
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent