Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • interface
toolboxlayout.cpp
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6Copyright (C) 2024-2099 Oliver S. Larsen
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; version 2 of the License.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17*/
18#include "toolboxlayout.h"
19
20ToolBoxLayout::ToolBoxLayout(QWidget* parent, int margin, int hSpacing, int vSpacing)
21 : FlowLayout(parent, margin, hSpacing, vSpacing)
22{
23
24}
25
26void ToolBoxLayout::lastLineAlignment(int startIndex, int count, RowLayoutInfo rowInfo, const QRect &effectiveRect) const
27{
28 alignRowFromRowInfo(startIndex, count, rowInfo);
29}
30
31void ToolBoxLayout::alignRowFromRowInfo(int startIndex, int count, RowLayoutInfo rowInfo) const
32{
33 int x = rowInfo.startX;
34
35 for (int i = startIndex; i < startIndex + count; i += 1) {
36
37 if (i > itemList.length() - 1) {
38 break;
39 }
40 QLayoutItem *item = itemList.at(i);
41 QSize size = item->geometry().size();
42 item->setGeometry(QRect(QPoint(x, item->geometry().y()), size));
43 x += size.width() + rowInfo.spacing;
44 }
45}
FlowLayout
Definition: flowlayout.h:81
QLayoutItem
QLayoutItem::geometry
virtual QRect geometry() const const=0
QLayoutItem::setGeometry
virtual void setGeometry(const QRect &r)=0
QList::at
const T & at(int i) const const
QList::length
int length() const const
QPoint
QRect
QRect::size
QSize size() const const
QRect::y
int y() const const
QSize
QSize::width
int width() const const
QWidget
RowLayoutInfo
Definition: flowlayout.h:74
Generated on Thu Jun 5 2025 14:06:43 for Pencil2D by doxygen 1.9.6 based on revision 4c63407997b2c03e5048716586dec6fbbb755173