You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
533 lines
12 KiB
Plaintext
533 lines
12 KiB
Plaintext
// This is the SIP interface definition for QTable, QTableItem,
|
|
// QCheckTableItem, QComboTableItem and QTableSelection.
|
|
//
|
|
// Copyright (c) 2007
|
|
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
|
|
//
|
|
// This file is part of PyQt.
|
|
//
|
|
// This copy of PyQt is free software; you can redistribute it and/or modify it
|
|
// under the terms of the GNU General Public License as published by the Free
|
|
// Software Foundation; either version 2, or (at your option) any later
|
|
// version.
|
|
//
|
|
// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
// details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License along with
|
|
// PyQt; see the file LICENSE. If not, write to the Free Software Foundation,
|
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
%ExportedDoc
|
|
<Sect2><Title>QTable (Qt v2.2+)</Title>
|
|
<Para>
|
|
<Literal>QTable</Literal> is fully implemented.
|
|
</Para>
|
|
</Sect2>
|
|
|
|
<Sect2><Title>QTableItem (Qt v2.2+)</Title>
|
|
<Para>
|
|
<Literal>QTableItem</Literal> is fully implemented.
|
|
</Para>
|
|
</Sect2>
|
|
|
|
<Sect2><Title>QCheckTableItem (Qt v3+)</Title>
|
|
<Para>
|
|
<Literal>QCheckTableItem</Literal> is fully implemented.
|
|
</Para>
|
|
</Sect2>
|
|
|
|
<Sect2><Title>QComboTableItem (Qt v3+)</Title>
|
|
<Para>
|
|
<Literal>QComboTableItem</Literal> is fully implemented.
|
|
</Para>
|
|
</Sect2>
|
|
|
|
<Sect2><Title>QTableSelection (Qt v2.2+)</Title>
|
|
<Para>
|
|
<Literal>QTableSelection</Literal> is fully implemented.
|
|
</Para>
|
|
</Sect2>
|
|
%End
|
|
|
|
|
|
%If (Qt_TABLE)
|
|
%If (Qt_2_2_0 -)
|
|
|
|
class QTableSelection
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qtable.h>
|
|
%End
|
|
|
|
public:
|
|
QTableSelection();
|
|
%If (Qt_3_1_0 -)
|
|
QTableSelection(int,int,int,int);
|
|
%End
|
|
|
|
void init(int,int);
|
|
void expandTo(int,int);
|
|
|
|
int topRow() const;
|
|
int bottomRow() const;
|
|
int leftCol() const;
|
|
int rightCol() const;
|
|
int anchorRow() const;
|
|
int anchorCol() const;
|
|
%If (Qt_3_2_0 -)
|
|
int numRows() const;
|
|
int numCols() const;
|
|
%End
|
|
|
|
bool isActive() const;
|
|
%If (Qt_3_2_0 -)
|
|
bool isEmpty() const;
|
|
%End
|
|
};
|
|
|
|
|
|
class QTableItem : Qt
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qtable.h>
|
|
%End
|
|
|
|
public:
|
|
enum EditType {
|
|
Never,
|
|
OnTyping,
|
|
WhenCurrent,
|
|
Always
|
|
};
|
|
|
|
// Note that the Qt documentation is wrong. Ownership is only taken by
|
|
// QTable::setItem().
|
|
%If (Qt_3_2_0 -)
|
|
QTableItem(QTable *,EditType);
|
|
%End
|
|
QTableItem(QTable *,EditType,const QString &);
|
|
QTableItem(QTable *,EditType,const QString &,const QPixmap &);
|
|
|
|
%ConvertToSubClassCode
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
#if QT_VERSION >= 0x030000
|
|
int rtti = sipCpp -> rtti();
|
|
|
|
if (rtti == QCheckTableItem::RTTI)
|
|
sipClass = sipClass_QCheckTableItem;
|
|
else if (rtti == QComboTableItem::RTTI)
|
|
sipClass = sipClass_QComboTableItem;
|
|
else
|
|
sipClass = 0;
|
|
#else
|
|
sipClass = 0;
|
|
#endif
|
|
|
|
Py_END_ALLOW_THREADS
|
|
%End
|
|
|
|
virtual QPixmap pixmap() const;
|
|
virtual QString text() const;
|
|
virtual void setPixmap(const QPixmap &);
|
|
virtual void setText(const QString &);
|
|
QTable *table() const;
|
|
|
|
virtual int alignment() const;
|
|
virtual void setWordWrap(bool);
|
|
bool wordWrap() const;
|
|
|
|
EditType editType() const;
|
|
virtual QWidget *createEditor() const /Factory/;
|
|
virtual void setContentFromEditor(QWidget *);
|
|
virtual void setReplaceable(bool);
|
|
bool isReplaceable() const;
|
|
|
|
virtual QString key() const;
|
|
virtual QSize sizeHint() const;
|
|
|
|
virtual void setSpan(int,int);
|
|
int rowSpan() const;
|
|
int colSpan() const;
|
|
|
|
virtual void setRow(int);
|
|
virtual void setCol(int);
|
|
int row() const;
|
|
int col() const;
|
|
|
|
virtual void paint(QPainter *,const QColorGroup &,const QRect &,bool);
|
|
|
|
void updateEditor(int,int);
|
|
|
|
%If (Qt_3_0_0 -)
|
|
virtual void setEnabled(bool);
|
|
bool isEnabled() const;
|
|
|
|
virtual int rtti() const;
|
|
%End
|
|
|
|
protected:
|
|
%If (Qt_3_2_0 - Qt_3_3_0)
|
|
QString content() const;
|
|
%End
|
|
};
|
|
|
|
|
|
%If (Qt_3_0_0 -)
|
|
|
|
class QComboTableItem : QTableItem
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qtable.h>
|
|
%End
|
|
|
|
public:
|
|
// Note that the Qt documentation is wrong. Ownership is only taken by
|
|
// QTable::setItem().
|
|
QComboTableItem(QTable *,const QStringList &,bool = 0);
|
|
|
|
virtual QWidget *createEditor() const /Factory/;
|
|
virtual void setContentFromEditor(QWidget *);
|
|
virtual void paint(QPainter *,const QColorGroup &,const QRect &,bool);
|
|
virtual void setCurrentItem(int);
|
|
virtual void setCurrentItem(const QString &);
|
|
int currentItem() const;
|
|
QString currentText() const;
|
|
int count() const;
|
|
QString text(int) const;
|
|
virtual void setEditable(bool);
|
|
bool isEditable() const;
|
|
virtual void setStringList(const QStringList &);
|
|
|
|
int rtti() const;
|
|
|
|
%If (Qt_3_0_6 -)
|
|
QSize sizeHint() const;
|
|
%End
|
|
};
|
|
|
|
%End
|
|
|
|
|
|
%If (Qt_3_0_0 -)
|
|
|
|
class QCheckTableItem : QTableItem
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qtable.h>
|
|
%End
|
|
|
|
public:
|
|
// Note that the Qt documentation is wrong. Ownership is only taken by
|
|
// QTable::setItem().
|
|
QCheckTableItem(QTable *,const QString &);
|
|
|
|
%If (Qt_3_2_0 -)
|
|
void setText(const QString &);
|
|
%End
|
|
virtual QWidget *createEditor() const /Factory/;
|
|
virtual void setContentFromEditor(QWidget *);
|
|
virtual void paint(QPainter *,const QColorGroup &,const QRect &,bool);
|
|
virtual void setChecked(bool);
|
|
bool isChecked() const;
|
|
|
|
int rtti() const;
|
|
|
|
%If (Qt_3_0_6 -)
|
|
QSize sizeHint() const;
|
|
%End
|
|
};
|
|
|
|
%End
|
|
|
|
|
|
class QTable : QScrollView
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qtable.h>
|
|
%End
|
|
|
|
public:
|
|
QTable(QWidget * /TransferThis/ = 0,const char * = 0);
|
|
QTable(int,int,QWidget * /TransferThis/ = 0,const char * = 0);
|
|
|
|
%ConvertToSubClassCode
|
|
sipClass = (sipCpp->inherits(sipName_QTable) ? sipClass_QTable : NULL);
|
|
%End
|
|
|
|
QHeader *horizontalHeader() const;
|
|
QHeader *verticalHeader() const;
|
|
|
|
%If (- Qt_3_0_0)
|
|
enum SelectionMode {
|
|
Single,
|
|
Multi,
|
|
NoSelection
|
|
};
|
|
%End
|
|
%If (Qt_3_0_0 -)
|
|
enum SelectionMode {
|
|
Single,
|
|
Multi,
|
|
SingleRow,
|
|
MultiRow,
|
|
NoSelection
|
|
};
|
|
%End
|
|
|
|
virtual void setSelectionMode(SelectionMode);
|
|
SelectionMode selectionMode() const;
|
|
|
|
virtual void setItem(int,int,QTableItem * /Transfer/);
|
|
virtual void setText(int,int,const QString &);
|
|
virtual void setPixmap(int,int,const QPixmap &);
|
|
virtual QTableItem *item(int,int) const;
|
|
virtual QString text(int,int) const;
|
|
virtual QPixmap pixmap(int,int) const;
|
|
virtual void clearCell(int,int);
|
|
|
|
virtual QRect cellGeometry(int,int) const;
|
|
virtual int columnWidth(int) const;
|
|
virtual int rowHeight(int) const;
|
|
virtual int columnPos(int) const;
|
|
virtual int rowPos(int) const;
|
|
virtual int columnAt(int) const;
|
|
virtual int rowAt(int) const;
|
|
|
|
%If (- Qt_3_0_0)
|
|
int numRows() const;
|
|
int numCols() const;
|
|
%End
|
|
%If (Qt_3_0_0 -)
|
|
virtual int numRows() const;
|
|
virtual int numCols() const;
|
|
%End
|
|
|
|
void updateCell(int,int);
|
|
|
|
bool eventFilter(QObject *,QEvent *);
|
|
|
|
int currentRow() const;
|
|
int currentColumn() const;
|
|
void ensureCellVisible(int,int);
|
|
|
|
bool isSelected(int,int) const;
|
|
bool isRowSelected(int,bool = 0) const;
|
|
bool isColumnSelected(int,bool = 0) const;
|
|
int numSelections() const;
|
|
QTableSelection selection(int) const;
|
|
virtual int addSelection(const QTableSelection &);
|
|
virtual void removeSelection(const QTableSelection &);
|
|
virtual void removeSelection(int);
|
|
virtual int currentSelection() const;
|
|
|
|
%If (Qt_3_1_0 -)
|
|
void selectCells(int,int,int,int);
|
|
void selectRow(int);
|
|
void selectColumn(int);
|
|
%End
|
|
|
|
bool showGrid() const;
|
|
|
|
bool columnMovingEnabled() const;
|
|
bool rowMovingEnabled() const;
|
|
|
|
virtual void sortColumn(int,bool = 1,bool = 0);
|
|
|
|
bool sorting() const;
|
|
|
|
virtual void takeItem(QTableItem * /TransferBack/);
|
|
|
|
virtual void setCellWidget(int,int,QWidget * /Transfer/);
|
|
virtual QWidget *cellWidget(int,int) const;
|
|
virtual void clearCellWidget(int,int);
|
|
|
|
%If (Qt_3_0_0 -)
|
|
virtual QRect cellRect(int,int) const;
|
|
%End
|
|
|
|
virtual void paintCell(QPainter *,int,int,const QRect &,bool);
|
|
%If (Qt_3_0_0 -)
|
|
virtual void paintCell(QPainter *,int,int,const QRect &,bool,
|
|
const QColorGroup &);
|
|
%End
|
|
virtual void paintFocus(QPainter *,const QRect &);
|
|
QSize sizeHint() const;
|
|
|
|
%If (Qt_3_0_0 -)
|
|
bool isReadOnly() const;
|
|
bool isRowReadOnly(int) const;
|
|
bool isColumnReadOnly(int) const;
|
|
|
|
void setEnabled(bool);
|
|
|
|
void repaintSelections();
|
|
|
|
enum FocusStyle {
|
|
FollowStyle,
|
|
SpreadSheet
|
|
};
|
|
|
|
virtual void setFocusStyle(FocusStyle);
|
|
FocusStyle focusStyle() const;
|
|
%End
|
|
|
|
%If (Qt_3_1_0 -)
|
|
void updateHeaderStates();
|
|
%End
|
|
|
|
public slots:
|
|
virtual void setNumRows(int);
|
|
virtual void setNumCols(int);
|
|
virtual void setShowGrid(bool);
|
|
virtual void hideRow(int);
|
|
virtual void hideColumn(int);
|
|
virtual void showRow(int);
|
|
virtual void showColumn(int);
|
|
%If (Qt_3_3_0 -)
|
|
bool isRowHidden(int) const;
|
|
bool isColumnHidden(int) const;
|
|
%End
|
|
|
|
virtual void setColumnWidth(int,int);
|
|
virtual void setRowHeight(int,int);
|
|
|
|
virtual void adjustColumn(int);
|
|
virtual void adjustRow(int);
|
|
|
|
virtual void setColumnStretchable(int,bool);
|
|
virtual void setRowStretchable(int,bool);
|
|
bool isColumnStretchable(int) const;
|
|
bool isRowStretchable(int) const;
|
|
virtual void setSorting(bool);
|
|
%If (- Qt_3_0_0)
|
|
virtual void swapRows(int,int);
|
|
virtual void swapColumns(int,int);
|
|
%End
|
|
%If (Qt_3_0_0 -)
|
|
virtual void swapRows(int,int,bool = 0);
|
|
virtual void swapColumns(int,int,bool = 0);
|
|
%End
|
|
virtual void swapCells(int,int,int,int);
|
|
|
|
virtual void setLeftMargin(int);
|
|
virtual void setTopMargin(int);
|
|
virtual void setCurrentCell(int,int);
|
|
void clearSelection(bool = 1);
|
|
virtual void setColumnMovingEnabled(bool);
|
|
virtual void setRowMovingEnabled(bool);
|
|
|
|
%If (Qt_3_0_0 -)
|
|
virtual void setReadOnly(bool);
|
|
virtual void setRowReadOnly(int,bool);
|
|
virtual void setColumnReadOnly(int,bool);
|
|
|
|
virtual void setDragEnabled(bool);
|
|
bool dragEnabled() const;
|
|
|
|
virtual void insertRows(int,int = 1);
|
|
virtual void insertColumns(int,int = 1);
|
|
virtual void removeRow(int);
|
|
virtual void removeRows(const QMemArray<int> &);
|
|
virtual void removeColumn(int);
|
|
virtual void removeColumns(const QMemArray<int> &);
|
|
|
|
virtual void editCell(int,int,bool = 0);
|
|
%End
|
|
|
|
%If (Qt_3_1_0 -)
|
|
void setRowLabels(const QStringList &);
|
|
void setColumnLabels(const QStringList &);
|
|
%End
|
|
|
|
protected:
|
|
%If (Qt_3_0_0 -)
|
|
enum EditMode {
|
|
NotEditing,
|
|
Editing,
|
|
Replacing
|
|
};
|
|
%End
|
|
|
|
void drawContents(QPainter *,int,int,int,int);
|
|
void contentsMousePressEvent(QMouseEvent *);
|
|
void contentsMouseMoveEvent(QMouseEvent *);
|
|
void contentsMouseDoubleClickEvent(QMouseEvent *);
|
|
void contentsMouseReleaseEvent(QMouseEvent *);
|
|
%If (Qt_3_0_0 -)
|
|
void contentsContextMenuEvent(QContextMenuEvent *);
|
|
%End
|
|
void keyPressEvent(QKeyEvent *);
|
|
void focusInEvent(QFocusEvent *);
|
|
void focusOutEvent(QFocusEvent *);
|
|
%If (- Qt_3_0_0)
|
|
void resizeEvent(QResizeEvent *);
|
|
%End
|
|
%If (Qt_3_0_0 -)
|
|
void viewportResizeEvent(QResizeEvent *);
|
|
%End
|
|
void showEvent(QShowEvent *);
|
|
%If (Qt_3_1_0 -)
|
|
void paintEvent(QPaintEvent *);
|
|
%End
|
|
%If (Qt_3_0_0 -)
|
|
void setEditMode(EditMode,int,int);
|
|
virtual void contentsDragEnterEvent(QDragEnterEvent *);
|
|
virtual void contentsDragMoveEvent(QDragMoveEvent *);
|
|
virtual void contentsDragLeaveEvent(QDragLeaveEvent *);
|
|
virtual void contentsDropEvent(QDropEvent *);
|
|
virtual QDragObject *dragObject();
|
|
virtual void startDrag();
|
|
%End
|
|
|
|
virtual void paintEmptyArea(QPainter *,int,int,int,int);
|
|
virtual void activateNextCell();
|
|
virtual QWidget *createEditor(int,int,bool) const /Factory/;
|
|
virtual void setCellContentFromEditor(int,int);
|
|
virtual QWidget *beginEdit(int,int,bool);
|
|
virtual void endEdit(int,int,bool,bool);
|
|
|
|
virtual void resizeData(int);
|
|
virtual void insertWidget(int,int,QWidget *);
|
|
int indexOf(int,int) const;
|
|
|
|
%If (Qt_3_0_0 -)
|
|
void windowActivationChange(bool);
|
|
bool isEditing() const;
|
|
EditMode editMode() const;
|
|
int currEditRow() const;
|
|
int currEditCol() const;
|
|
%End
|
|
|
|
protected slots:
|
|
virtual void columnWidthChanged(int);
|
|
virtual void rowHeightChanged(int);
|
|
virtual void columnIndexChanged(int,int,int);
|
|
virtual void rowIndexChanged(int,int,int);
|
|
virtual void columnClicked(int);
|
|
|
|
signals:
|
|
void currentChanged(int,int);
|
|
void clicked(int,int,int,const QPoint &);
|
|
void doubleClicked(int,int,int,const QPoint &);
|
|
void pressed(int,int,int,const QPoint &);
|
|
void selectionChanged();
|
|
void valueChanged(int,int);
|
|
%If (Qt_3_0_0 -)
|
|
void contextMenuRequested(int,int,const QPoint &);
|
|
void dropped(QDropEvent *);
|
|
%End
|
|
|
|
private:
|
|
%If (Qt_3_1_0 -)
|
|
QTable(const QTable &);
|
|
%End
|
|
};
|
|
|
|
%End
|
|
%End
|