xca/widgets/XcaHeaderView.cpp
Christian Hohnstädt d5fa97c3bb Drop support for Qt4
Version 2.4.0 was the last one with Qt4 support
2021-05-09 12:25:32 +02:00

36 lines
658 B
C++

/* 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);
}