1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
/* vi: set sw=4 ts=4:
*
* Copyright (C) 2015 Christian Hohnstaedt.
*
* All rights reserved.
*/
#include "XcaHeaderView.h"
#include "XcaTreeView.h"
#include <QContextMenuEvent>
XcaHeaderView::XcaHeaderView()
:QHeaderView(Qt::Horizontal)
{
setSectionsMovable(true);
}
void XcaHeaderView::contextMenuEvent(QContextMenuEvent *e)
{
XcaTreeView *tv = static_cast<XcaTreeView *>(parentWidget());
if (tv)
tv->headerEvent(e, logicalIndexAt(e->pos()));
}
void XcaHeaderView::resetMoves()
{
for (int i=0; i<count(); i++) {
if (i != visualIndex(i)) {
moveSection(visualIndex(i), i);
i=0;
}
}
resizeSections(QHeaderView::ResizeToContents);
}
|