Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
beef4bcb
Commit
beef4bcb
authored
Nov 22, 2019
by
Jean-Baptiste Mardelle
Browse files
Better fix for color wheel resize
Related to
#453
parent
3766d4c6
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/effects/effectstack/view/collapsibleeffectview.cpp
View file @
beef4bcb
...
...
@@ -477,8 +477,8 @@ void CollapsibleEffectView::slotSwitch(bool collapse)
{
widgetFrame
->
setFixedHeight
(
collapse
?
0
:
m_view
->
height
());
setFixedHeight
(
widgetFrame
->
height
()
+
frame
->
minimumHeight
()
+
2
*
(
contentsMargins
().
top
()
+
decoframe
->
lineWidth
()));
emit
switchHeight
(
m_model
,
height
());
m_model
->
setCollapsed
(
collapse
);
emit
switchHeight
(
m_model
,
height
());
}
void
CollapsibleEffectView
::
setGroupIndex
(
int
ix
)
...
...
src/effects/effectstack/view/effectstackview.cpp
View file @
beef4bcb
...
...
@@ -59,6 +59,11 @@ void WidgetDelegate::setHeight(const QModelIndex &index, int height)
emit
sizeHintChanged
(
index
);
}
int
WidgetDelegate
::
height
(
const
QModelIndex
&
index
)
const
{
return
m_height
.
value
(
index
);
}
void
WidgetDelegate
::
paint
(
QPainter
*
painter
,
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
{
QStyleOptionViewItem
opt
(
option
);
...
...
@@ -72,18 +77,18 @@ EffectStackView::EffectStackView(AssetPanel *parent)
,
m_model
(
nullptr
)
,
m_thumbnailer
(
new
AssetIconProvider
(
true
))
{
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
);
m_lay
=
new
QVBoxLayout
(
this
);
m_lay
->
setContentsMargins
(
0
,
0
,
0
,
0
);
m_lay
->
setSpacing
(
0
);
setFont
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
SmallestReadableFont
));
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
Preferred
);
setAcceptDrops
(
true
);
/*m_builtStack = new BuiltStack(parent);
m_builtStack->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_lay->addWidget(m_builtStack);
m_builtStack->setVisible(KdenliveSettings::showbuiltstack());*/
m_effectsTree
=
new
QTreeView
(
this
);
m_effectsTree
->
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
M
in
imum
Expanding
);
m_effectsTree
->
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
M
ax
imum
);
m_effectsTree
->
setHeaderHidden
(
true
);
m_effectsTree
->
setRootIsDecorated
(
false
);
QString
style
=
QStringLiteral
(
"QTreeView {border: none;}"
);
...
...
@@ -91,7 +96,7 @@ EffectStackView::EffectStackView(AssetPanel *parent)
m_effectsTree
->
setStyleSheet
(
style
);
m_effectsTree
->
setVisible
(
!
KdenliveSettings
::
showbuiltstack
());
m_lay
->
addWidget
(
m_effectsTree
);
m_lay
->
set
Stretch
(
1
,
10
);
m_lay
->
add
Stretch
(
10
);
}
EffectStackView
::~
EffectStackView
()
...
...
@@ -241,8 +246,8 @@ void EffectStackView::loadEffects()
void
EffectStackView
::
updateTreeHeight
()
{
// For some reason, the treeview height does not update correctly, so enforce it
int
totalHeight
=
0
;
m_mutex
.
lock
();
int
totalHeight
=
0
;
for
(
int
j
=
0
;
j
<
m_model
->
rowCount
();
j
++
)
{
std
::
shared_ptr
<
AbstractEffectItem
>
item2
=
m_model
->
getEffectStackRow
(
j
);
std
::
shared_ptr
<
EffectItemModel
>
eff
=
std
::
static_pointer_cast
<
EffectItemModel
>
(
item2
);
...
...
@@ -252,8 +257,8 @@ void EffectStackView::updateTreeHeight()
totalHeight
+=
w
->
height
();
}
}
m_effectsTree
->
setFixedHeight
(
totalHeight
);
m_mutex
.
unlock
();
setMinimumHeight
(
totalHeight
);
}
void
EffectStackView
::
slotActivateEffect
(
const
std
::
shared_ptr
<
EffectItemModel
>
&
effectModel
)
...
...
@@ -289,7 +294,7 @@ void EffectStackView::slotStartDrag(const QPixmap &pix, const std::shared_ptr<Ef
drag
->
exec
(
Qt
::
CopyAction
|
Qt
::
MoveAction
,
Qt
::
CopyAction
);
}
void
EffectStackView
::
slotAdjustDelegate
(
const
std
::
shared_ptr
<
EffectItemModel
>
&
effectModel
,
int
h
eight
)
void
EffectStackView
::
slotAdjustDelegate
(
const
std
::
shared_ptr
<
EffectItemModel
>
&
effectModel
,
int
newH
eight
)
{
if
(
!
m_model
)
{
return
;
...
...
@@ -297,8 +302,8 @@ void EffectStackView::slotAdjustDelegate(const std::shared_ptr<EffectItemModel>
QModelIndex
ix
=
m_model
->
getIndexFromItem
(
effectModel
);
auto
*
del
=
static_cast
<
WidgetDelegate
*>
(
m_effectsTree
->
itemDelegate
(
ix
));
if
(
del
)
{
//QMutexLocker lock(&m_mutex
);
del
->
setHeight
(
ix
,
height
);
del
->
setHeight
(
ix
,
newHeight
);
QMetaObject
::
invokeMethod
(
this
,
"updateTreeHeight"
,
Qt
::
QueuedConnection
);
}
}
...
...
src/effects/effectstack/view/effectstackview.hpp
View file @
beef4bcb
...
...
@@ -44,6 +44,7 @@ class WidgetDelegate : public QStyledItemDelegate
public:
explicit
WidgetDelegate
(
QObject
*
parent
=
nullptr
);
void
setHeight
(
const
QModelIndex
&
index
,
int
height
);
int
height
(
const
QModelIndex
&
index
)
const
;
QSize
sizeHint
(
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
override
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
override
;
...
...
@@ -89,7 +90,6 @@ private:
*/
QSize
m_sourceFrameSize
;
const
QString
getStyleSheet
();
void
updateTreeHeight
();
private
slots
:
void
refresh
(
const
QModelIndex
&
topLeft
,
const
QModelIndex
&
bottomRight
,
const
QVector
<
int
>
&
roles
);
...
...
@@ -97,6 +97,7 @@ private slots:
void
slotStartDrag
(
const
QPixmap
&
pix
,
const
std
::
shared_ptr
<
EffectItemModel
>
&
effectModel
);
void
slotActivateEffect
(
const
std
::
shared_ptr
<
EffectItemModel
>
&
effectModel
);
void
loadEffects
();
void
updateTreeHeight
();
// void switchBuiltStack(bool show);
...
...
src/utils/flowlayout.cpp
View file @
beef4bcb
...
...
@@ -47,7 +47,7 @@ FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing)
:
QLayout
(
parent
)
,
m_hSpace
(
hSpacing
)
,
m_vSpace
(
vSpacing
)
,
m_minimumSize
(
3
00
,
200
)
,
m_minimumSize
(
2
00
,
200
)
{
setContentsMargins
(
margin
,
margin
,
margin
,
margin
);
}
...
...
@@ -113,7 +113,13 @@ Qt::Orientations FlowLayout::expandingDirections() const
bool
FlowLayout
::
hasHeightForWidth
()
const
{
return
false
;
return
true
;
}
int
FlowLayout
::
heightForWidth
(
int
width
)
const
{
int
height
=
doLayout
(
QRect
(
0
,
0
,
width
,
0
),
true
);
return
height
;
}
void
FlowLayout
::
setGeometry
(
const
QRect
&
rect
)
...
...
@@ -140,7 +146,7 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const
int
x
=
effectiveRect
.
x
();
int
y
=
effectiveRect
.
y
();
int
itemCount
=
0
;
if
(
m_itemList
.
isEmpty
())
{
if
(
m_itemList
.
isEmpty
()
||
effectiveRect
.
width
()
<=
0
||
effectiveRect
.
height
()
<=
0
)
{
return
0
;
}
...
...
@@ -149,20 +155,20 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const
int
columns
=
qMin
(
qFloor
((
double
)
rect
.
width
()
/
min
.
width
()),
m_itemList
.
size
());
int
realWidth
=
rect
.
width
()
/
columns
-
horizontalSpacing
();
int
totalHeight
=
y
-
rect
.
y
()
+
bottom
+
qCeil
((
double
)
m_itemList
.
size
()
/
columns
)
*
(
realWidth
+
verticalSpacing
());
m_minimumSize
=
QSize
(
rect
.
width
(),
totalHeight
);
if
(
testOnly
)
{
return
totalHeight
;
}
for
(
QLayoutItem
*
item
:
m_itemList
)
{
// We consider all items have the same dimensions
wid
=
item
->
widget
();
QSize
hint
=
QSize
(
qMin
(
wid
->
maximumWidth
(),
realWidth
),
qMin
(
wid
->
maximumWidth
(),
realWidth
));
if
(
!
testOnly
)
{
item
->
setGeometry
(
QRect
(
QPoint
(
x
,
y
),
hint
));
}
item
->
setGeometry
(
QRect
(
QPoint
(
x
,
y
),
hint
));
itemCount
++
;
//qDebug()<<"=== ITEM: "<<itemCount<<", POS: "<<x<<"x"<<y<<", SIZE: "<<hint;
x
=
effectiveRect
.
x
()
+
(
itemCount
%
columns
)
*
(
realWidth
+
horizontalSpacing
());
y
=
effectiveRect
.
y
()
+
qFloor
((
double
)
itemCount
/
columns
)
*
(
realWidth
+
verticalSpacing
());
}
m_minimumSize
=
QSize
(
rect
.
width
(),
totalHeight
);
return
totalHeight
;
}
int
FlowLayout
::
smartSpacing
(
QStyle
::
PixelMetric
pm
)
const
...
...
src/utils/flowlayout.h
View file @
beef4bcb
...
...
@@ -58,6 +58,7 @@ public:
int
verticalSpacing
()
const
;
Qt
::
Orientations
expandingDirections
()
const
override
;
bool
hasHeightForWidth
()
const
override
;
int
heightForWidth
(
int
)
const
override
;
int
count
()
const
override
;
QLayoutItem
*
itemAt
(
int
index
)
const
override
;
QSize
minimumSize
()
const
override
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment