Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
79b10b2b
Commit
79b10b2b
authored
Oct 01, 2009
by
dt
Browse files
Add some painting to the details widget.
parent
74a3828f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/utils/detailswidget.cpp
View file @
79b10b2b
...
...
@@ -3,6 +3,7 @@
#include
<QtGui/QGridLayout>
#include
<QtCore/QStack>
#include
<QtGui/QPainter>
using
namespace
Utils
;
...
...
@@ -12,7 +13,7 @@ DetailsWidget::DetailsWidget(QWidget *parent)
m_toolWidget
(
0
)
{
m_grid
=
new
QGridLayout
(
this
);
m_grid
->
setMargin
(
0
);
//
m_grid->setMargin(0);
m_summaryLabel
=
new
QLabel
(
this
);
m_summaryLabel
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
);
m_detailsButton
=
new
DetailsButton
(
this
);
...
...
@@ -29,6 +30,51 @@ DetailsWidget::~DetailsWidget()
}
void
DetailsWidget
::
paintEvent
(
QPaintEvent
*
paintEvent
)
{
//TL--> ___________ <-- TR
// | |
//ML-> ______________| <--MM |
// | |
//BL-> |_________________________| <-- BR
QWidget
::
paintEvent
(
paintEvent
);
if
(
!
m_detailsButton
->
isToggled
())
return
;
QRect
detailsGeometry
=
m_detailsButton
->
geometry
();
QRect
widgetGeometry
=
m_widget
->
geometry
();
QPoint
tl
(
detailsGeometry
.
topLeft
());
tl
+=
QPoint
(
-
3
,
-
3
);
QPoint
tr
(
detailsGeometry
.
topRight
());
tr
+=
QPoint
(
3
,
-
3
);
QPoint
mm
(
detailsGeometry
.
left
()
-
3
,
widgetGeometry
.
top
()
-
3
);
QPoint
ml
(
1
,
mm
.
y
());
int
bottom
=
geometry
().
height
()
-
3
;
QPoint
bl
(
1
,
bottom
);
QPoint
br
(
tr
.
x
(),
bottom
);
QPainter
p
(
this
);
p
.
setPen
(
Qt
::
NoPen
);
QColor
c
=
palette
().
color
(
QPalette
::
Background
);
c
=
c
.
darker
(
115
);
p
.
setBrush
(
c
);
//p.setBrush(palette().button());
// QPolygon polygon;
// polygon << tl << tr << br << bl << ml << mm;
// p.drawConvexPolygon(polygon);
p
.
drawRoundedRect
(
QRect
(
tl
,
br
),
5
,
5
);
p
.
drawRoundedRect
(
QRect
(
ml
,
br
),
5
,
5
);
}
void
DetailsWidget
::
detailsButtonClicked
()
{
if
(
m_widget
)
...
...
src/libs/utils/detailswidget.h
View file @
79b10b2b
...
...
@@ -20,6 +20,7 @@ public:
void
setSummaryText
(
const
QString
&
text
);
void
setWidget
(
QWidget
*
widget
);
void
setToolWidget
(
QWidget
*
widget
);
void
paintEvent
(
QPaintEvent
*
paintEvent
);
private
slots
:
void
detailsButtonClicked
();
private:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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