Пример #1
0
LogListView::LogListView(KConfig& cfg, QWidget *parent, const char *name)
    : K3ListView(parent)
    , partConfig(cfg)
{
	setObjectName(name);
    setAllColumnsShowFocus(true);
    setShowToolTips(false);
    setShowSortIndicator(true);
    setMultiSelection(true);
    setSorting(LogListViewItem::Revision, false);
    addColumn(i18n("Revision"));
    addColumn(i18n("Author"));
    addColumn(i18n("Date"));
    addColumn(i18n("Branch"));
    addColumn(i18n("Comment"));
    addColumn(i18n("Tags"));

    Cervisia::ToolTip* toolTip = new Cervisia::ToolTip(viewport());

    connect(toolTip, SIGNAL(queryToolTip(QPoint,QRect&,QString&)),
            this, SLOT(slotQueryToolTip(QPoint,QRect&,QString&)));

    // without this restoreLayout() can't change the column widths
    for (int i = 0; i < columns(); ++i)
        setColumnWidthMode(i, Manual);
    restoreLayout(&partConfig, QLatin1String("LogList view"));
}
Пример #2
0
//-----------------------------------------------------------------------------
ListProgress::ListProgress(QWidget *parent, const char *name) : KListView(parent, name)
{

    // enable selection of more than one item
    setMultiSelection(true);

    setAllColumnsShowFocus(true);

    m_lpcc[TB_OPERATION].title = i18n("Operation");
    m_lpcc[TB_LOCAL_FILENAME].title = i18n("Local Filename");
    m_lpcc[TB_RESUME].title = i18n("Resume", "Res.");
    m_lpcc[TB_COUNT].title = i18n("Count");
    m_lpcc[TB_PROGRESS].title = i18n("%");
    m_lpcc[TB_TOTAL].title = i18n("Size");
    m_lpcc[TB_SPEED].title = i18n("Speed");
    m_lpcc[TB_REMAINING_TIME].title = i18n("Remaining Time", "Rem. Time");
    m_lpcc[TB_ADDRESS].title = i18n("URL");
    readSettings();

    applySettings();

    // used for squeezing the text in local file name and url
    m_squeezer = new KSqueezedTextLabel(this);
    m_squeezer->hide();
    connect(header(), SIGNAL(sizeChange(int, int, int)), this, SLOT(columnWidthChanged(int)));
}
Пример #3
0
bool ListBoxDemo::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setNumRows(); break;
    case 1: setNumCols(); break;
    case 2: setRowsByHeight(); break;
    case 3: setColsByWidth(); break;
    case 4: setVariableWidth((bool)static_QUType_bool.get(_o+1)); break;
    case 5: setVariableHeight((bool)static_QUType_bool.get(_o+1)); break;
    case 6: setMultiSelection((bool)static_QUType_bool.get(_o+1)); break;
    case 7: sortAscending(); break;
    case 8: sortDescending(); break;
    default:
	return QWidget::qt_invoke( _id, _o );
    }
    return TRUE;
}
Пример #4
0
CFileList::CFileList( QWidget* parent, const char* name )
	: Q3ListView( parent, name )
#else
CFileList::CFileList( QWidget* parent, const char* name )
	: QListView( parent, name )
#endif
{
	resize( 310,230 );
	setMinimumSize( 0, 0 );
	setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	setFocusPolicy( Qt::TabFocus );
	setBackgroundMode( Qt::PaletteBackground );
#else
	setFocusPolicy( QWidget::TabFocus );
	setBackgroundMode( QWidget::PaletteBackground );
#endif
	setFrameStyle( QFrame::Box | QFrame::Raised );
#ifdef QT_V4LAYOUT
	setResizePolicy( Q3ScrollView::Manual );
	setVScrollBarMode( Q3ScrollView::Auto );
	setHScrollBarMode( Q3ScrollView::Auto );
#else
	setResizePolicy( QScrollView::Manual );
	setVScrollBarMode( QScrollView::Auto );
	setHScrollBarMode( QScrollView::Auto );
#endif
	setTreeStepSize( 20 );
	setMultiSelection( FALSE );
	setAllColumnsShowFocus( TRUE );
	setItemMargin( 1 );
	setRootIsDecorated( FALSE );
	addColumn( "File Name", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 0, Q3ListView::Maximum );
#else
	setColumnWidthMode( 0, QListView::Maximum );
#endif
	setColumnAlignment( 0, 1 );
	addColumn( "Permissions", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 1, Q3ListView::Maximum );
#else
	setColumnWidthMode( 1, QListView::Maximum );
#endif
	setColumnAlignment( 1, 1 );
	addColumn( "Owner", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 2, Q3ListView::Maximum );
#else
	setColumnWidthMode( 2, QListView::Maximum );
#endif
	setColumnAlignment( 2, 1 );
	addColumn( "Group", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 3, Q3ListView::Maximum );
#else
	setColumnWidthMode( 3, QListView::Maximum );
#endif
	setColumnAlignment( 3, 1 );
	addColumn( "Size", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 4, Q3ListView::Maximum );
#else
	setColumnWidthMode( 4, QListView::Maximum );
#endif
	setColumnAlignment( 4, 1 );
}
int Q3ListBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = Q3ScrollView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: highlighted((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: selected((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: highlighted((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: selected((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 4: highlighted((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 5: selected((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 6: selectionChanged(); break;
        case 7: selectionChanged((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 8: currentChanged((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 9: clicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 10: clicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 11: pressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 12: pressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 13: doubleClicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 14: returnPressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 15: rightButtonClicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 16: rightButtonPressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 17: mouseButtonPressed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3ListBoxItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break;
        case 18: mouseButtonClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3ListBoxItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break;
        case 19: contextMenuRequested((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 20: onItem((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 21: onViewport(); break;
        case 22: clear(); break;
        case 23: ensureCurrentVisible(); break;
        case 24: clearSelection(); break;
        case 25: selectAll((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 26: invertSelection(); break;
        case 27: clearInputString(); break;
        case 28: refreshSlot(); break;
        case 29: doAutoScroll(); break;
        case 30: adjustItems(); break;
        }
        _id -= 31;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< uint*>(_v) = count(); break;
        case 1: *reinterpret_cast< int*>(_v) = numItemsVisible(); break;
        case 2: *reinterpret_cast< int*>(_v) = currentItem(); break;
        case 3: *reinterpret_cast< QString*>(_v) = currentText(); break;
        case 4: *reinterpret_cast< int*>(_v) = topItem(); break;
        case 5: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break;
        case 6: *reinterpret_cast< bool*>(_v) = isMultiSelection(); break;
        case 7: *reinterpret_cast< LayoutMode*>(_v) = columnMode(); break;
        case 8: *reinterpret_cast< LayoutMode*>(_v) = rowMode(); break;
        case 9: *reinterpret_cast< int*>(_v) = numColumns(); break;
        case 10: *reinterpret_cast< int*>(_v) = numRows(); break;
        case 11: *reinterpret_cast< bool*>(_v) = variableWidth(); break;
        case 12: *reinterpret_cast< bool*>(_v) = variableHeight(); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 2: setCurrentItem(*reinterpret_cast< int*>(_v)); break;
        case 4: setTopItem(*reinterpret_cast< int*>(_v)); break;
        case 5: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break;
        case 6: setMultiSelection(*reinterpret_cast< bool*>(_v)); break;
        case 7: setColumnMode(*reinterpret_cast< LayoutMode*>(_v)); break;
        case 8: setRowMode(*reinterpret_cast< LayoutMode*>(_v)); break;
        case 11: setVariableWidth(*reinterpret_cast< bool*>(_v)); break;
        case 12: setVariableHeight(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 13;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Пример #6
0
bool QListView::qt_property( int id, int f, QVariant* v)
{
    switch ( id - staticMetaObject()->propertyOffset() ) {
    case 0: switch( f ) {
	case 1: *v = QVariant( this->columns() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 1: switch( f ) {
	case 0: setMultiSelection(v->asBool()); break;
	case 1: *v = QVariant( this->isMultiSelection(), 0 ); break;
	case 4: case 5: break;
	default: return FALSE;
    } break;
    case 2: switch( f ) {
	case 0: setSelectionMode((SelectionMode&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->selectionMode() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 3: switch( f ) {
	case 1: *v = QVariant( this->childCount() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 4: switch( f ) {
	case 0: setAllColumnsShowFocus(v->asBool()); break;
	case 1: *v = QVariant( this->allColumnsShowFocus(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 5: switch( f ) {
	case 0: setShowSortIndicator(v->asBool()); break;
	case 1: *v = QVariant( this->showSortIndicator(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 6: switch( f ) {
	case 0: setItemMargin(v->asInt()); break;
	case 1: *v = QVariant( this->itemMargin() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 7: switch( f ) {
	case 0: setRootIsDecorated(v->asBool()); break;
	case 1: *v = QVariant( this->rootIsDecorated(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 8: switch( f ) {
	case 0: setShowToolTips(v->asBool()); break;
	case 1: *v = QVariant( this->showToolTips(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 9: switch( f ) {
	case 0: setResizeMode((ResizeMode&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->resizeMode() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 10: switch( f ) {
	case 0: setTreeStepSize(v->asInt()); break;
	case 1: *v = QVariant( this->treeStepSize() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 11: switch( f ) {
	case 0: setDefaultRenameAction((RenameAction&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->defaultRenameAction() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    default:
	return QScrollView::qt_property( id, f, v );
    }
    return TRUE;
}