Set a lower minimum column size in the playlist again. Fixes #201

This commit is contained in:
David Sansome 2014-01-20 22:08:43 +11:00
parent dc5670edfb
commit 7a9e5b553b
2 changed files with 2 additions and 15 deletions

View File

@ -24,7 +24,7 @@
#include <cmath> #include <cmath>
#include <numeric> #include <numeric>
const int StretchHeaderView::kMinimumColumnWidth = 10; const int StretchHeaderView::kMinimumColumnWidth = 20;
const int StretchHeaderView::kMagicNumber = 0x502c950f; const int StretchHeaderView::kMagicNumber = 0x502c950f;
StretchHeaderView::StretchHeaderView(Qt::Orientation orientation, QWidget* parent) StretchHeaderView::StretchHeaderView(Qt::Orientation orientation, QWidget* parent)
@ -33,6 +33,7 @@ StretchHeaderView::StretchHeaderView(Qt::Orientation orientation, QWidget* paren
in_mouse_move_event_(false) in_mouse_move_event_(false)
{ {
connect(this, SIGNAL(sectionResized(int,int,int)), SLOT(SectionResized(int,int,int))); connect(this, SIGNAL(sectionResized(int,int,int)), SLOT(SectionResized(int,int,int)));
setMinimumSectionSize(kMinimumColumnWidth);
} }
void StretchHeaderView::setModel(QAbstractItemModel* model) { void StretchHeaderView::setModel(QAbstractItemModel* model) {
@ -90,7 +91,6 @@ void StretchHeaderView::UpdateWidths(const QList<int>& sections) {
hideSection(i); hideSection(i);
else if (pixels != 0 && isSectionHidden(i)) { else if (pixels != 0 && isSectionHidden(i)) {
showSection(i); showSection(i);
AssertMinimalColumnWidth(i);
} }
if (pixels != 0) if (pixels != 0)
@ -145,7 +145,6 @@ void StretchHeaderView::SetSectionHidden(int logical, bool hidden) {
HideSection(logical); HideSection(logical);
} else { } else {
ShowSection(logical); ShowSection(logical);
AssertMinimalColumnWidth(logical);
} }
} }
@ -225,13 +224,6 @@ void StretchHeaderView::SetColumnWidth(int logical, ColumnWidthType width) {
NormaliseWidths(other_columns); NormaliseWidths(other_columns);
} }
// makes sure the column will apear no matter what
void StretchHeaderView::AssertMinimalColumnWidth(int logical) {
if (sectionSize(logical) < kMinimumColumnWidth) {
resizeSection(logical, kMinimumColumnWidth);
}
}
bool StretchHeaderView::RestoreState(const QByteArray& data) { bool StretchHeaderView::RestoreState(const QByteArray& data) {
QDataStream s(data); QDataStream s(data);
s.setVersion(QDataStream::Qt_4_6); s.setVersion(QDataStream::Qt_4_6);

View File

@ -71,11 +71,6 @@ protected:
void resizeEvent(QResizeEvent* event); void resizeEvent(QResizeEvent* event);
private: private:
// If the width of the given column is less than a sensible threshold, resize
// it to make it bigger. Workaround for a QHeaderView oddity that means a
// column can be visible but with a width of 0.
void AssertMinimalColumnWidth(int logical);
// Scales column_widths_ values so the total is 1.0. // Scales column_widths_ values so the total is 1.0.
void NormaliseWidths(const QList<int>& sections = QList<int>()); void NormaliseWidths(const QList<int>& sections = QList<int>());