summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-08 18:26:12 +0200
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-08 18:26:12 +0200
commita95d91016de0e2d546a5e025e37b2f44bce50ea2 (patch)
tree768c263935ef1ba12a4ccdc53c6d6336cb5c7e21 /src
parent40ffc262c31fcce2544a5b9f869f5a767f731b87 (diff)
Update QtTableWidgetNG to let the QtGraphicsTableView clipt its children.
Diffstat (limited to 'src')
-rw-r--r--src/qtablewidgetng.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qtablewidgetng.cpp b/src/qtablewidgetng.cpp
index 4219332..d60c25a 100644
--- a/src/qtablewidgetng.cpp
+++ b/src/qtablewidgetng.cpp
@@ -156,15 +156,16 @@ void QtTableWidgetNGPrivate::_q_controllerChanged(QtTableController *current, Qt
void QtTableWidgetNGPrivate::updateElementsLayout(const QSizeF &size)
{
Q_Q(QtTableWidgetNG);
- // ### just put all of this in a view
Q_ASSERT(controller);
QtGraphicsHeader *horizontalHeader = controller->horizontalHeader();
QtGraphicsHeader *verticalHeader = controller->verticalHeader();
+
if (horizontalHeader && horizontalHeader->scene() == 0)
q->scene()->addItem(horizontalHeader);
if (verticalHeader && verticalHeader->scene() == 0)
q->scene()->addItem(verticalHeader);
+
qreal x = (verticalHeader ? verticalHeader->perpendicularSize() : 0);
qreal y = (horizontalHeader ? horizontalHeader->perpendicularSize() : 0);
qreal w = (verticalScrollbar ? verticalScrollbar->effectiveSizeHint(Qt::PreferredSize).width() : 0);
@@ -218,11 +219,11 @@ void QtTableWidgetNGPrivate::initialize(int rows, int columns)
q->setScene(new QGraphicsScene(q));
// horizontal scrollbar
horizontalScrollbar = new QtGraphicsScrollBar(Qt::Horizontal);
- horizontalScrollbar->setZValue(10000);
+ horizontalScrollbar->setFlag(QGraphicsItem::ItemClipsToShape, true);
q->scene()->addItem(horizontalScrollbar);
// vertical scrollbar
verticalScrollbar = new QtGraphicsScrollBar(Qt::Vertical);
- verticalScrollbar->setZValue(10000);
+ verticalScrollbar->setFlag(QGraphicsItem::ItemClipsToShape, true);
q->scene()->addItem(verticalScrollbar);
// other parts
if (!controller)
@@ -234,6 +235,7 @@ void QtTableWidgetNGPrivate::initialize(int rows, int columns)
if (!controller->view()) {
controller->setView(new QtGraphicsTableView);
controller->view()->setParent(controller);
+ controller->view()->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
}
_q_controllerChanged(controller, 0);