예제 #1
0
ViewHeader::ViewHeader( QAbstractItemView* parent )
    : QHeaderView( Qt::Horizontal, parent )
    , m_parent( parent )
    , m_menu( new QMenu( this ) )
    , m_sigmap( new QSignalMapper( this ) )
    , m_init( false )
{
    m_menu->setFont( TomahawkUtils::systemFont() );

#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
    setSectionResizeMode( QHeaderView::Interactive );
    setSectionsMovable( true );
#else
    setResizeMode( QHeaderView::Interactive );
    setMovable( true );
#endif
    setMinimumSectionSize( 60 );
    setDefaultAlignment( Qt::AlignLeft );
    setStretchLastSection( true );

//    m_menu->addAction( tr( "Resize columns to fit window" ), this, SLOT( onToggleResizeColumns() ) );
//    m_menu->addSeparator();

    connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( toggleVisibility( int ) ) );
}
예제 #2
0
FileListHeader::FileListHeader( Qt::Orientation orientation, QWidget *parent /*= NULL*/ )
	: QHeaderView(orientation, parent)
{
	setMovable(true);
	setStretchLastSection(true);
	setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);

	setStyleSheet(QString("border-top: 0px solid #5d6c78; border-bottom: %1px solid white;").arg(VIEWPORT_MARGIN_TOP));
	connect(this, SIGNAL(sectionDoubleClicked(int)), SLOT(sectionDoubleClickedSlot(int)));
}
int QHeaderView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractItemView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 21)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 21;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isSortIndicatorShown(); break;
        case 1: *reinterpret_cast< bool*>(_v) = highlightSections(); break;
        case 2: *reinterpret_cast< bool*>(_v) = stretchLastSection(); break;
        case 3: *reinterpret_cast< bool*>(_v) = cascadingSectionResizes(); break;
        case 4: *reinterpret_cast< int*>(_v) = defaultSectionSize(); break;
        case 5: *reinterpret_cast< int*>(_v) = minimumSectionSize(); break;
        case 6: *reinterpret_cast< Qt::Alignment*>(_v) = defaultAlignment(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setSortIndicatorShown(*reinterpret_cast< bool*>(_v)); break;
        case 1: setHighlightSections(*reinterpret_cast< bool*>(_v)); break;
        case 2: setStretchLastSection(*reinterpret_cast< bool*>(_v)); break;
        case 3: setCascadingSectionResizes(*reinterpret_cast< bool*>(_v)); break;
        case 4: setDefaultSectionSize(*reinterpret_cast< int*>(_v)); break;
        case 5: setMinimumSectionSize(*reinterpret_cast< int*>(_v)); break;
        case 6: setDefaultAlignment(*reinterpret_cast< Qt::Alignment*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
예제 #4
0
HeaderView::HeaderView(QAbstractItemView* parent)
    : QHeaderView(Qt::Horizontal, parent)
    , m_parent(parent)
    , m_menu(0)
{
#if QT_VERSION >= 0x050000
    setSectionsMovable(true);
#else
    setMovable(true);
#endif
    setStretchLastSection(true);
    setDefaultAlignment(Qt::AlignLeft);
    setMinimumSectionSize(60);
}
예제 #5
0
RDHeaderView::RDHeaderView(Qt::Orientation orient, QWidget *parent) : QHeaderView(orient, parent)
{
  m_sectionPreview = new QLabel(this);

  setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
}
예제 #6
0
/*!
 \class SpreadsheetDoubleHeaderView
 \brief Horizontal header for SpreadsheetView displaying comments in a second header

 This class is only to be used by SpreadsheetView.
 It allows for displaying two horizontal headers.
 A \c SpreadsheetDoubleHeaderView displays the column name, plot designation, and
 type icon in a normal QHeaderView and below that a second header
 which displays the column comments.

 \sa SpreadsheetCommentsHeaderView
 \sa QHeaderView

 \ingroup commonfrontend
*/
SpreadsheetHeaderView::SpreadsheetHeaderView(QWidget* parent) : QHeaderView(Qt::Horizontal, parent) {
	setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
	m_slave = new SpreadsheetCommentsHeaderView();
	m_slave->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
	m_showComments = true;
}