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
4eee97f2
Commit
4eee97f2
authored
Mar 22, 2021
by
Vincent Pinon
Browse files
fix some more warnings
parent
440d9b51
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
src/scopes/audioscopes/spectrogram.cpp
View file @
4eee97f2
...
...
@@ -275,7 +275,7 @@ QImage Spectrogram::renderHUD(uint)
davinci
.
drawLine
(
x
,
topDist
,
x
,
topDist
+
m_innerScopeRect
.
height
()
+
6
);
davinci
.
drawText
(
x
-
10
,
y
,
i18n
(
"%1 kHz"
,
QString
(
"%1"
).
arg
(
(
double
)
(
m_mousePos
.
x
()
-
m_innerScopeRect
.
left
())
/
m_innerScopeRect
.
width
()
*
m_freqMax
/
1000
,
0
,
'f'
,
2
)));
i18n
(
"%1 kHz"
,
QString
(
"%1"
).
arg
(
double
(
m_mousePos
.
x
()
-
m_innerScopeRect
.
left
())
/
m_innerScopeRect
.
width
()
*
m_freqMax
/
1000
,
0
,
'f'
,
2
)));
}
// Draw the dB brightness scale
...
...
src/timeline2/view/qml/timelineitems.cpp
View file @
4eee97f2
...
...
@@ -242,14 +242,14 @@ public:
i
=
0
;
int
j
=
0
;
if
(
m_drawInPoint
>
0
)
{
j
=
m_drawInPoint
/
increment
;
j
=
int
(
m_drawInPoint
/
increment
)
;
}
if
(
pathDraw
)
{
path
.
moveTo
(
m_drawInPoint
-
1
,
y
);
}
for
(;
i
<=
width
()
&&
i
<
m_drawOutPoint
;
j
++
)
{
i
=
j
*
increment
;
int
idx
=
ceil
((
startPos
+
i
)
*
indicesPrPixel
);
int
idx
=
int
(
ceil
((
startPos
+
i
)
*
indicesPrPixel
)
)
;
idx
+=
idx
%
m_channels
;
i
-=
offset
;
idx
+=
channel
;
...
...
@@ -259,7 +259,7 @@ public:
path
.
lineTo
(
i
,
y
-
level
);
}
else
{
level
=
m_audioLevels
.
at
(
idx
)
*
scaleFactor
;
// divide height by 510 (2*255) to get height
painter
->
drawLine
(
i
,
y
-
level
,
i
,
y
+
level
);
painter
->
drawLine
(
i
nt
(
i
),
int
(
y
-
level
)
,
i
nt
(
i
),
int
(
y
+
level
)
)
;
}
}
if
(
pathDraw
)
{
...
...
@@ -269,7 +269,7 @@ public:
painter
->
drawPath
(
tr
.
map
(
path
));
}
if
(
m_firstChunk
&&
m_channels
>
1
&&
m_channels
<
7
)
{
painter
->
drawText
(
2
,
y
+
channelHeight
/
2
,
chanelNames
[
channel
]);
painter
->
drawText
(
2
,
int
(
y
+
channelHeight
/
2
)
,
chanelNames
[
channel
]);
}
}
}
...
...
src/titler/graphicsscenerectmove.cpp
View file @
4eee97f2
...
...
@@ -148,7 +148,7 @@ void MyTextItem::refreshFormat()
if
(
!
gradientData
.
isEmpty
())
{
QRectF
rect
=
boundingRect
();
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
gradientData
,
rect
.
width
(),
rect
.
height
());
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
gradientData
,
int
(
rect
.
width
()
)
,
int
(
rect
.
height
())
)
;
cformat
.
setForeground
(
QBrush
(
gr
));
}
...
...
@@ -223,7 +223,7 @@ void MyTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
paintBrush
=
QBrush
(
cursor
.
charFormat
().
foreground
().
color
());
}
else
{
QRectF
rect
=
boundingRect
();
paintBrush
=
QBrush
(
GradientWidget
::
gradientFromString
(
gradientData
,
rect
.
width
(),
rect
.
height
()));
paintBrush
=
QBrush
(
GradientWidget
::
gradientFromString
(
gradientData
,
int
(
rect
.
width
()
)
,
int
(
rect
.
height
()))
)
;
}
painter
->
fillPath
(
m_path
,
paintBrush
);
if
(
outline
>
0
)
{
...
...
@@ -282,7 +282,7 @@ void MyTextItem::updateShadow()
// Calculate position of text in parent item
path
.
translate
(
QPointF
(
2
*
m_shadowBlur
,
2
*
m_shadowBlur
));
QRectF
fullSize
=
bounding
.
united
(
path
.
boundingRect
());
QImage
shadow
(
fullSize
.
width
()
+
qAbs
(
m_shadowOffset
.
x
())
+
4
*
m_shadowBlur
,
fullSize
.
height
()
+
qAbs
(
m_shadowOffset
.
y
())
+
4
*
m_shadowBlur
,
QImage
shadow
(
int
(
fullSize
.
width
()
)
+
qAbs
(
m_shadowOffset
.
x
())
+
4
*
m_shadowBlur
,
int
(
fullSize
.
height
()
)
+
qAbs
(
m_shadowOffset
.
y
())
+
4
*
m_shadowBlur
,
QImage
::
Format_ARGB32_Premultiplied
);
shadow
.
fill
(
Qt
::
transparent
);
QPainter
painter
(
&
shadow
);
...
...
@@ -320,7 +320,7 @@ void MyTextItem::blurShadow(QImage &result, int radius)
p
+=
bpl
;
for
(
int
j
=
r1
;
j
<
r2
;
j
++
,
p
+=
bpl
)
for
(
int
i
=
i1
;
i
<=
i2
;
i
++
)
{
p
[
i
]
=
(
uchar
)
((
rgba
[
i
]
+=
((
p
[
i
]
<<
4
)
-
rgba
[
i
])
*
alpha
/
16
)
>>
4
);
p
[
i
]
=
uchar
((
rgba
[
i
]
+=
((
p
[
i
]
<<
4
)
-
rgba
[
i
])
*
alpha
/
16
)
>>
4
);
}
}
...
...
@@ -333,7 +333,7 @@ void MyTextItem::blurShadow(QImage &result, int radius)
p
+=
4
;
for
(
int
j
=
c1
;
j
<
c2
;
j
++
,
p
+=
4
)
for
(
int
i
=
i1
;
i
<=
i2
;
i
++
)
{
p
[
i
]
=
(
uchar
)
((
rgba
[
i
]
+=
((
p
[
i
]
<<
4
)
-
rgba
[
i
])
*
alpha
/
16
)
>>
4
);
p
[
i
]
=
uchar
((
rgba
[
i
]
+=
((
p
[
i
]
<<
4
)
-
rgba
[
i
])
*
alpha
/
16
)
>>
4
);
}
}
...
...
@@ -346,7 +346,7 @@ void MyTextItem::blurShadow(QImage &result, int radius)
p
-=
bpl
;
for
(
int
j
=
r1
;
j
<
r2
;
j
++
,
p
-=
bpl
)
for
(
int
i
=
i1
;
i
<=
i2
;
i
++
)
{
p
[
i
]
=
(
uchar
)
((
rgba
[
i
]
+=
((
p
[
i
]
<<
4
)
-
rgba
[
i
])
*
alpha
/
16
)
>>
4
);
p
[
i
]
=
uchar
((
rgba
[
i
]
+=
((
p
[
i
]
<<
4
)
-
rgba
[
i
])
*
alpha
/
16
)
>>
4
);
}
}
...
...
@@ -359,7 +359,7 @@ void MyTextItem::blurShadow(QImage &result, int radius)
p
-=
4
;
for
(
int
j
=
c1
;
j
<
c2
;
j
++
,
p
-=
4
)
for
(
int
i
=
i1
;
i
<=
i2
;
i
++
)
{
p
[
i
]
=
(
uchar
)
((
rgba
[
i
]
+=
((
p
[
i
]
<<
4
)
-
rgba
[
i
])
*
alpha
/
16
)
>>
4
);
p
[
i
]
=
uchar
((
rgba
[
i
]
+=
((
p
[
i
]
<<
4
)
-
rgba
[
i
])
*
alpha
/
16
)
>>
4
);
}
}
}
...
...
@@ -383,7 +383,7 @@ QRectF MyTextItem::baseBoundingRect() const
QTextCursor
cur
(
document
());
cur
.
select
(
QTextCursor
::
Document
);
QTextBlockFormat
format
=
cur
.
blockFormat
();
int
lineHeight
=
format
.
lineHeight
();
int
lineHeight
=
int
(
format
.
lineHeight
()
)
;
int
lineHeight2
=
QFontMetrics
(
font
()).
lineSpacing
();
int
lines
=
document
()
->
lineCount
();
if
(
lines
>
1
)
{
...
...
@@ -463,7 +463,7 @@ void MyRectItem::setRect(const QRectF &rectangle)
QGraphicsRectItem
::
setRect
(
rectangle
);
if
(
m_rect
!=
rectangle
&&
!
data
(
TitleDocument
::
Gradient
).
isNull
())
{
m_rect
=
rectangle
;
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
(
TitleDocument
::
Gradient
).
toString
(),
m_rect
.
width
(),
m_rect
.
height
());
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
(
TitleDocument
::
Gradient
).
toString
(),
int
(
m_rect
.
width
()
)
,
int
(
m_rect
.
height
())
)
;
setBrush
(
QBrush
(
gr
));
}
}
...
...
@@ -497,7 +497,7 @@ void MyEllipseItem::setRect(const QRectF &rectangle)
QGraphicsEllipseItem
::
setRect
(
rectangle
);
if
(
m_ellipse
!=
rectangle
&&
!
data
(
TitleDocument
::
Gradient
).
isNull
())
{
m_ellipse
=
rectangle
;
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
(
TitleDocument
::
Gradient
).
toString
(),
m_ellipse
.
width
(),
m_ellipse
.
height
());
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
(
TitleDocument
::
Gradient
).
toString
(),
int
(
m_ellipse
.
width
()
)
,
int
(
m_ellipse
.
height
())
)
;
setBrush
(
QBrush
(
gr
));
}
}
...
...
@@ -735,8 +735,8 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent *e)
return
;
}
}
int
xPos
=
(
(
int
)
e
->
scenePos
().
x
()
/
m_gridSize
)
*
m_gridSize
;
int
yPos
=
(
(
int
)
e
->
scenePos
().
y
()
/
m_gridSize
)
*
m_gridSize
;
int
xPos
=
(
int
(
e
->
scenePos
().
x
()
)
/
m_gridSize
)
*
m_gridSize
;
int
yPos
=
(
int
(
e
->
scenePos
().
y
()
)
/
m_gridSize
)
*
m_gridSize
;
m_moveStarted
=
false
;
m_clickPoint
=
e
->
scenePos
();
m_resizeMode
=
m_possibleAction
;
...
...
@@ -794,7 +794,7 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent *e)
}
else
if
(
item
->
type
()
==
QGraphicsRectItem
::
Type
||
item
->
type
()
==
QGraphicsEllipseItem
::
Type
||
item
->
type
()
==
QGraphicsSvgItem
::
Type
||
item
->
type
()
==
QGraphicsPixmapItem
::
Type
)
{
QRectF
r1
;
if
(
m_selectedItem
->
type
()
==
QGraphicsRectItem
::
Type
)
{
r1
=
((
QGraphicsRectItem
*
)
m_selectedItem
)
->
rect
().
normalized
();
r1
=
static_cast
<
QGraphicsRectItem
*
>
(
m_selectedItem
)
->
rect
().
normalized
();
}
else
{
r1
=
m_selectedItem
->
boundingRect
().
normalized
();
}
...
...
@@ -836,7 +836,7 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent *e)
if
(
e
->
button
()
==
Qt
::
LeftButton
)
{
clearTextSelection
();
MyTextItem
*
textItem
=
new
MyTextItem
(
i18n
(
"Text"
),
nullptr
);
yPos
=
((
(
int
)
e
->
scenePos
().
y
()
-
(
int
)
(
m_fontSize
/
2
))
/
m_gridSize
)
*
m_gridSize
;
yPos
=
((
int
(
e
->
scenePos
().
y
()
)
-
(
m_fontSize
/
2
))
/
m_gridSize
)
*
m_gridSize
;
textItem
->
setPos
(
xPos
,
yPos
);
addItem
(
textItem
);
textItem
->
setFlags
(
QGraphicsItem
::
ItemIsMovable
|
QGraphicsItem
::
ItemIsSelectable
);
...
...
@@ -898,12 +898,12 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
m_selectedItem
->
type
()
==
QGraphicsPixmapItem
::
Type
)
{
QRectF
newrect
;
if
(
m_selectedItem
->
type
()
==
QGraphicsRectItem
::
Type
)
{
newrect
=
((
QGraphicsRectItem
*
)
m_selectedItem
)
->
rect
();
newrect
=
static_cast
<
QGraphicsRectItem
*
>
(
m_selectedItem
)
->
rect
();
}
else
{
newrect
=
m_selectedItem
->
boundingRect
();
}
int
xPos
=
(
(
int
)
e
->
scenePos
().
x
()
/
m_gridSize
)
*
m_gridSize
;
int
yPos
=
(
(
int
)
e
->
scenePos
().
y
()
/
m_gridSize
)
*
m_gridSize
;
int
xPos
=
(
int
(
e
->
scenePos
().
x
()
)
/
m_gridSize
)
*
m_gridSize
;
int
yPos
=
(
int
(
e
->
scenePos
().
y
()
)
/
m_gridSize
)
*
m_gridSize
;
QPointF
newpoint
(
xPos
,
yPos
);
switch
(
m_resizeMode
)
{
case
BottomRight
:
...
...
@@ -933,8 +933,8 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
// Resize using aspect ratio
if
(
!
m_selectedItem
->
data
(
0
).
isNull
())
{
// we want to keep aspect ratio
double
hRatio
=
(
double
)
newrect
.
width
()
/
m_selectedItem
->
data
(
0
).
toInt
();
double
vRatio
=
(
double
)
newrect
.
height
()
/
m_selectedItem
->
data
(
1
).
toInt
();
double
hRatio
=
newrect
.
width
()
/
m_selectedItem
->
data
(
0
).
toInt
();
double
vRatio
=
newrect
.
height
()
/
m_selectedItem
->
data
(
1
).
toInt
();
if
(
hRatio
<
vRatio
)
{
newrect
.
setHeight
(
m_selectedItem
->
data
(
1
).
toInt
()
*
hRatio
);
}
else
{
...
...
@@ -950,8 +950,8 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
// Resize using aspect ratio
if
(
!
m_selectedItem
->
data
(
0
).
isNull
())
{
// we want to keep aspect ratio
double
hRatio
=
(
double
)
newrect
.
width
()
/
m_selectedItem
->
data
(
0
).
toInt
();
double
vRatio
=
(
double
)
newrect
.
height
()
/
m_selectedItem
->
data
(
1
).
toInt
();
double
hRatio
=
newrect
.
width
()
/
m_selectedItem
->
data
(
0
).
toInt
();
double
vRatio
=
newrect
.
height
()
/
m_selectedItem
->
data
(
1
).
toInt
();
if
(
hRatio
<
vRatio
)
{
newrect
.
setHeight
(
m_selectedItem
->
data
(
1
).
toInt
()
*
hRatio
);
}
else
{
...
...
@@ -994,9 +994,9 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
}
QRectF
r1
;
if
(
g
->
type
()
==
QGraphicsRectItem
::
Type
)
{
r1
=
((
const
QGraphicsRectItem
*
)
g
)
->
rect
().
normalized
();
r1
=
static_cast
<
const
QGraphicsRectItem
*
>
(
g
)
->
rect
().
normalized
();
}
else
{
r1
=
((
const
QGraphicsEllipseItem
*
)
g
)
->
rect
().
normalized
();
r1
=
static_cast
<
const
QGraphicsEllipseItem
*
>
(
g
)
->
rect
().
normalized
();
}
itemFound
=
true
;
...
...
src/titler/titledocument.cpp
View file @
4eee97f2
...
...
@@ -279,7 +279,7 @@ QDomDocument TitleDocument::xml(const QList<QGraphicsItem *> & items, int width,
content
.
setAttribute
(
QStringLiteral
(
"kdenlive-axis-y-inverted"
),
t
->
data
(
OriginYTop
).
toInt
());
}
if
(
t
->
textWidth
()
>
0
)
{
content
.
setAttribute
(
QStringLiteral
(
"alignment"
),
(
int
)
t
->
alignment
());
content
.
setAttribute
(
QStringLiteral
(
"alignment"
),
int
(
t
->
alignment
())
)
;
}
content
.
setAttribute
(
QStringLiteral
(
"shadow"
),
t
->
shadowInfo
().
join
(
QLatin1Char
(
';'
)));
...
...
@@ -357,7 +357,7 @@ QColor TitleDocument::getBackgroundColor(const QList<QGraphicsItem *> & items)
{
QColor
color
(
0
,
0
,
0
,
0
);
for
(
auto
item
:
qAsConst
(
items
))
{
if
(
(
int
)
item
->
zValue
()
==
-
1100
)
{
if
(
int
(
item
->
zValue
()
)
==
-
1100
)
{
color
=
static_cast
<
QGraphicsRectItem
*>
(
item
)
->
brush
().
color
();
return
color
;
}
...
...
@@ -517,13 +517,13 @@ int TitleDocument::loadFromXml(const QDomDocument &doc, QList<QGraphicsItem *> &
// Gradient color
QString
data
=
txtProperties
.
namedItem
(
QStringLiteral
(
"gradient"
)).
nodeValue
();
txt
->
setData
(
TitleDocument
::
Gradient
,
data
);
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
,
txt
->
boundingRect
().
width
(),
txt
->
boundingRect
().
height
());
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
,
int
(
txt
->
boundingRect
().
width
()
)
,
int
(
txt
->
boundingRect
().
height
())
)
;
cformat
.
setForeground
(
QBrush
(
gr
));
cursor
.
setCharFormat
(
cformat
);
}
if
(
!
txtProperties
.
namedItem
(
QStringLiteral
(
"alignment"
)).
isNull
())
{
txt
->
setAlignment
(
(
Qt
::
Alignment
)
txtProperties
.
namedItem
(
QStringLiteral
(
"alignment"
)).
nodeValue
().
toInt
());
txt
->
setAlignment
(
Qt
::
Alignment
(
txtProperties
.
namedItem
(
QStringLiteral
(
"alignment"
)).
nodeValue
().
toInt
())
)
;
}
if
(
!
txtProperties
.
namedItem
(
QStringLiteral
(
"kdenlive-axis-x-inverted"
)).
isNull
())
{
...
...
@@ -576,7 +576,7 @@ int TitleDocument::loadFromXml(const QDomDocument &doc, QList<QGraphicsItem *> &
// Gradient color
QString
data
=
rectProperties
.
namedItem
(
QStringLiteral
(
"gradient"
)).
nodeValue
();
rec
->
setData
(
TitleDocument
::
Gradient
,
data
);
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
,
rec
->
rect
().
width
(),
rec
->
rect
().
height
());
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
,
int
(
rec
->
rect
().
width
()
)
,
int
(
rec
->
rect
().
height
())
)
;
rec
->
setBrush
(
QBrush
(
gr
));
}
else
{
rec
->
setBrush
(
QBrush
(
stringToColor
(
br_str
)));
...
...
@@ -601,7 +601,7 @@ int TitleDocument::loadFromXml(const QDomDocument &doc, QList<QGraphicsItem *> &
// Gradient color
QString
data
=
ellipseProperties
.
namedItem
(
QStringLiteral
(
"gradient"
)).
nodeValue
();
ellipse
->
setData
(
TitleDocument
::
Gradient
,
data
);
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
,
ellipse
->
rect
().
width
(),
ellipse
->
rect
().
height
());
QLinearGradient
gr
=
GradientWidget
::
gradientFromString
(
data
,
int
(
ellipse
->
rect
().
width
()
)
,
int
(
ellipse
->
rect
().
height
())
)
;
ellipse
->
setBrush
(
QBrush
(
gr
));
}
else
{
ellipse
->
setBrush
(
QBrush
(
stringToColor
(
br_str
)));
...
...
@@ -711,7 +711,7 @@ int TitleDocument::loadFromXml(const QDomDocument &doc, QList<QGraphicsItem *> &
QColor
color
=
QColor
(
stringToColor
(
itemNode
.
attributes
().
namedItem
(
QStringLiteral
(
"color"
)).
nodeValue
()));
// color.setAlpha(itemNode.attributes().namedItem("alpha").nodeValue().toInt());
for
(
auto
sceneItem
:
qAsConst
(
gitems
))
{
if
(
(
int
)
sceneItem
->
zValue
()
==
-
1100
)
{
if
(
int
(
sceneItem
->
zValue
()
)
==
-
1100
)
{
static_cast
<
QGraphicsRectItem
*>
(
sceneItem
)
->
setBrush
(
QBrush
(
color
));
break
;
}
...
...
src/titler/titlewidget.cpp
View file @
4eee97f2
This diff is collapsed.
Click to expand it.
src/titler/unicodedialog.cpp
View file @
4eee97f2
...
...
@@ -286,7 +286,7 @@ QString UnicodeWidget::nextUnicode(const QString &text, Direction direction)
break
;
}
// Wrapping
if
(
value
==
(
uint
)
-
1
)
{
if
(
value
==
uint
(
-
1
)
)
{
value
=
MAX_UNICODE_V1
;
}
if
(
value
>
MAX_UNICODE_V1
)
{
...
...
src/utils/flowlayout.cpp
View file @
4eee97f2
...
...
@@ -155,12 +155,12 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const
int
itemCount
=
0
;
QWidget
*
wid
=
m_itemList
.
at
(
0
)
->
widget
();
QSize
min
=
wid
->
minimumSize
();
int
columns
=
qMin
(
qFloor
(
(
double
)
rect
.
width
()
/
min
.
width
()),
m_itemList
.
size
());
int
columns
=
qMin
(
qFloor
(
double
(
rect
.
width
()
)
/
min
.
width
()),
m_itemList
.
size
());
columns
=
qMax
(
1
,
columns
);
int
realWidth
=
qMin
(
wid
->
maximumWidth
(),
rect
.
width
()
/
columns
-
horizontalSpacing
());
realWidth
-=
realWidth
%
40
;
realWidth
=
qMax
(
realWidth
,
wid
->
minimumWidth
());
int
totalHeight
=
y
-
rect
.
y
()
+
mrg
.
bottom
()
+
qCeil
(
(
double
)
m_itemList
.
size
()
/
columns
)
*
(
realWidth
+
verticalSpacing
());
int
totalHeight
=
y
-
rect
.
y
()
+
mrg
.
bottom
()
+
qCeil
(
double
(
m_itemList
.
size
()
)
/
columns
)
*
(
realWidth
+
verticalSpacing
());
m_minimumSize
=
QSize
(
columns
*
realWidth
,
totalHeight
);
QSize
hint
=
QSize
(
realWidth
,
realWidth
);
if
(
testOnly
)
{
...
...
@@ -172,7 +172,7 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const
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
());
y
=
effectiveRect
.
y
()
+
qFloor
(
double
(
itemCount
)
/
columns
)
*
(
realWidth
+
verticalSpacing
());
}
return
totalHeight
;
}
...
...
src/widgets/choosecolorwidget.cpp
View file @
4eee97f2
...
...
@@ -35,10 +35,10 @@ static QColor stringToColor(QString strColor)
if
(
strColor
.
length
()
==
10
)
{
// 0xRRGGBBAA
intval
=
strColor
.
toUInt
(
&
ok
,
16
);
color
.
setRgb
((
int
)((
intval
>>
24
)
&
0xff
)
,
// r
(
intval
>>
16
)
&
0xff
,
// g
(
intval
>>
8
)
&
0xff
,
// b
intval
&
0xff
);
// a
color
.
setRgb
((
intval
>>
24
)
&
0xff
,
// r
(
intval
>>
16
)
&
0xff
,
// g
(
intval
>>
8
)
&
0xff
,
// b
intval
&
0xff
);
// a
}
else
{
// 0xRRGGBB, 0xRGB
color
.
setNamedColor
(
strColor
.
replace
(
0
,
2
,
QLatin1Char
(
'#'
)));
...
...
@@ -48,10 +48,10 @@ static QColor stringToColor(QString strColor)
// #AARRGGBB
strColor
=
strColor
.
replace
(
'#'
,
QLatin1String
(
"0x"
));
intval
=
strColor
.
toUInt
(
&
ok
,
16
);
color
.
setRgb
((
intval
>>
16
)
&
0xff
,
// r
(
intval
>>
8
)
&
0xff
,
// g
intval
&
0xff
,
// b
(
int
)(
(
intval
>>
24
)
&
0xff
)
)
;
// a
color
.
setRgb
((
intval
>>
16
)
&
0xff
,
// r
(
intval
>>
8
)
&
0xff
,
// g
intval
&
0xff
,
// b
(
intval
>>
24
)
&
0xff
);
// a
}
else
if
(
strColor
.
length
()
==
8
)
{
// 0xRRGGBB
strColor
=
strColor
.
replace
(
'#'
,
QLatin1String
(
"0x"
));
...
...
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