//delete myStyleWrapper;
}
+/*!
+ Returns a table row count
+ */
+int QtxTable::rowCount() const
+{
+ return QTableWidget::rowCount();
+}
+
+/**
+ * Returns a table column count
+ */
+int QtxTable::columnCount() const
+{
+ return QTableWidget::columnCount();
+}
+
bool QtxTable::isSelectAllEnabled() const
{
return true;//mySelectAll;
*/
}
-QVariant QtxTable::headerData( const Qt::Orientation o, const int section, const int role ) const
+/* Returns a table header value
+ * @param theSection
+ * a header section
+ * @param theOrientation
+ * a horizontal or vertical orientation
+ * @param theRole
+ * a type of modification, that should be applyed to table
+ */
+QVariant QtxTable::headerData( const int theSection,
+ const Qt::Orientation theOrientation,
+ const int theRole ) const
{
- QVariant res;
+ QVariant aRes;
if ( model() )
- res = model()->headerData( section, o, role );
- return res;
+ aRes = model()->headerData( theSection, theOrientation, theRole );
+ return aRes;
}
QFont QtxTable::headerFont( const Qt::Orientation o, const int section ) const
{
QFont res = o == Qt::Horizontal ? horizontalHeader()->font() :
verticalHeader()->font();
- QVariant aVar = headerData( o, section, Qt::FontRole );
+ QVariant aVar = headerData( section, o, Qt::FontRole );
if ( aVar.isValid() && aVar.canConvert( QVariant::Font ) )
res = aVar.value<QFont>();
return res;
QColor QtxTable::headerForeground( const Qt::Orientation o, const int section ) const
{
QColor res;
- QVariant aVar = headerData( o, section, Qt::ForegroundRole );
+ QVariant aVar = headerData( section, o, Qt::ForegroundRole );
if ( aVar.isValid() && aVar.canConvert( QVariant::Color ) )
res = aVar.value<QColor>();
return res;
QColor QtxTable::headerBackground( const Qt::Orientation o, const int section ) const
{
QColor res;
- QVariant aVar = headerData( o, section, Qt::BackgroundRole );
+ QVariant aVar = headerData( section, o, Qt::BackgroundRole );
if ( aVar.isValid() && aVar.canConvert( QVariant::Color ) )
res = aVar.value<QColor>();
return res;
QIcon QtxTable::headerIcon( const Qt::Orientation o, const int section ) const
{
QIcon res;
- QVariant aVar = headerData( o, section, Qt::DecorationRole );
+ QVariant aVar = headerData( section, o, Qt::DecorationRole );
if ( aVar.isValid() && aVar.canConvert( QVariant::Icon ) )
res = aVar.value<QIcon>();
return res;
}
-void QtxTable::setHeaderData( const Qt::Orientation o, const int section, const QVariant& var,
- const int role )
+/* Sets a table header value
+ * @param theSection
+ * a header section
+ * @param theOrientation
+ * a horizontal or vertical orientation
+ * @param theValue
+ * a value
+ * @param theRole
+ * a type of modification, that should be applyed to table
+ */
+void QtxTable::setHeaderData( const int theSection,
+ const Qt::Orientation theOrientation,
+ const QVariant& theValue,
+ const int theRole )
{
QTableWidgetItem* anItem = 0;
- if ( o == Qt::Horizontal )
- anItem = horizontalHeaderItem( section );
+ if ( theOrientation == Qt::Horizontal )
+ anItem = horizontalHeaderItem( theSection );
else
- anItem = verticalHeaderItem( section );
+ anItem = verticalHeaderItem( theSection );
if ( anItem )
- anItem->setData( role, var );
+ anItem->setData( theRole, theValue );
else {
anItem = new QTableWidgetItem();
- anItem->setData( role, var );
- if ( o == Qt::Horizontal )
- setHorizontalHeaderItem( section, anItem );
+ anItem->setData( theRole, theValue );
+ if ( theOrientation == Qt::Horizontal )
+ setHorizontalHeaderItem( theSection, anItem );
else
- setVerticalHeaderItem( section, anItem );
+ setVerticalHeaderItem( theSection, anItem );
}
}
void QtxTable::setHeaderFont( const Qt::Orientation o, const int section, const QFont& font )
{
- setHeaderData( o, section, QVariant( font ), Qt::FontRole );
+ setHeaderData( section, o, QVariant( font ), Qt::FontRole );
}
void QtxTable::setHeaderForeground( const Qt::Orientation o, const int section, const QColor& c )
{
- setHeaderData( o, section, QVariant( c ), Qt::ForegroundRole );
+ setHeaderData( section, o, QVariant( c ), Qt::ForegroundRole );
}
void QtxTable::setHeaderBackground( const Qt::Orientation o, const int section, const QColor& c )
{
- setHeaderData( o, section, QVariant( c ), Qt::BackgroundRole );
+ setHeaderData( section, o, QVariant( c ), Qt::BackgroundRole );
}
void QtxTable::setHeaderIcon( const Qt::Orientation o, const int section, const QIcon& icon )
{
- setHeaderData( o, section, QVariant( icon ), Qt::DecorationRole );
+ setHeaderData( section, o, QVariant( icon ), Qt::DecorationRole );
+}
+
+/*!
+ * Returns a table cell value
+ * @param theRow
+ * a row position
+ * @param theColumn
+ * a column position
+ * @param theRole
+ * a type of modification, that should be applyed to table
+ */
+QVariant QtxTable::data( const int theRow, const int theColumn,
+ const int theRole ) const
+{
+ QVariant aValue;
+ switch ( theRole ) {
+ case Qt::DisplayRole:
+ aValue = cellData( theRow, theColumn );
+ break;
+ case Qt::FontRole:
+ aValue = cellFont( theRow, theColumn );
+ break;
+ case Qt::ForegroundRole:
+ aValue = cellForeground( theRow, theColumn );
+ break;
+ case Qt::BackgroundRole:
+ aValue = cellBackground( theRow, theColumn );
+ break;
+ default:
+ break;
+ }
+ return aValue;
}
QVariant QtxTable::cellData( const int row, const int col ) const
return res;
}
+/*!
+ * Set the value into a table cell
+ * @param theRow
+ * a row position
+ * @param theColumn
+ * a column position
+ * @param theValue
+ * a value
+ * @param theRole
+ * a type of modification, that should be applyed to table
+ */
+void QtxTable::setData( const int theRow, const int theColumn,
+ const QVariant& theValue, const int theRole )
+{
+ // to check the best solution:
+ if ( false ) {
+ QTableWidgetItem* anItem = getItem( theRow, theColumn );
+ if ( anItem ) {
+ anItem->setData( theRole, theValue );
+ }
+ }
+
+ switch ( theRole ) {
+ case Qt::DisplayRole:
+ setCellData( theRow, theColumn, theValue );
+ break;
+ case Qt::FontRole: {
+ if ( theValue.isValid() && theValue.canConvert( QVariant::Font ) )
+ setCellFont( theRow, theColumn, theValue.value<QFont>() );
+ }
+ break;
+ case Qt::ForegroundRole: {
+ if ( theValue.isValid() && theValue.canConvert( QVariant::Font ) )
+ setCellForeground( theRow, theColumn, theValue.value<QColor>() );
+ }
+ break;
+ case Qt::BackgroundRole: {
+ if ( theValue.isValid() && theValue.canConvert( QVariant::Font ) )
+ setCellBackground( theRow, theColumn, theValue.value<QColor>() );
+ }
+ break;
+ default:
+ break;
+ }
+}
+
void QtxTable::setCellData( const int row, const int col, const QVariant& val )
{
if ( !val.isValid() )
return anItem;
}
-QModelIndexList QtxTable::getSelectedIndexes()
+/*!
+ * Returns the table selection model
+ */
+QItemSelectionModel* QtxTable::selectionModel() const
+{
+ return QTableWidget::selectionModel();
+}
+
+QModelIndexList QtxTable::getSelectedIndexes() const
{
return selectedIndexes();
}
#define QTXTABLE_H
#include "Qtx.h"
+#include "QtxTableInterface.h"
#include <QMap>
#include <QVector>
#pragma warning( disable : 4251 )
#endif
-class QTX_EXPORT QtxTable : public QTableWidget
+class QTX_EXPORT QtxTable : public QTableWidget, public QtxTableInterface
{
Q_OBJECT
QtxTable( int, int, QWidget* = 0, const char* = 0 );
virtual ~QtxTable();
+ virtual int rowCount() const;
+ virtual int columnCount() const;
+
bool headerEditable( Qt::Orientation, const int = -1 ) const;
bool editHeader( Qt::Orientation, const int );
int numHeaders( const Qt::Orientation ) const;
void setNumHeaders( const Qt::Orientation, const int );
- virtual QVariant headerData( const Qt::Orientation, const int, const int = Qt::DisplayRole ) const;
+ virtual QVariant headerData( const int, const Qt::Orientation,
+ const int = Qt::DisplayRole ) const;
virtual QFont headerFont( const Qt::Orientation, const int ) const;
virtual QColor headerForeground( const Qt::Orientation, const int ) const;
virtual QColor headerBackground( const Qt::Orientation, const int ) const;
virtual QIcon headerIcon( const Qt::Orientation, const int ) const;
- virtual void setHeaderData( const Qt::Orientation, const int, const QVariant&,
+ virtual void setHeaderData( const int, const Qt::Orientation, const QVariant&,
const int = Qt::DisplayRole );
virtual void setHeaderFont( const Qt::Orientation, const int, const QFont& );
virtual void setHeaderForeground( const Qt::Orientation, const int, const QColor& );
virtual void setHeaderBackground( const Qt::Orientation, const int, const QColor& );
virtual void setHeaderIcon( const Qt::Orientation, const int, const QIcon& );
+ virtual QVariant data( const int theRow, const int theColumn,
+ const int theRole = Qt::DisplayRole ) const;
virtual QVariant cellData( const int, const int ) const;
virtual QFont cellFont( const int, const int ) const;
virtual QColor cellForeground( const int, const int ) const;
virtual QColor cellBackground( const int, const int ) const;
virtual QIcon cellIcon( const int, const int ) const;
+ virtual void setData( const int theRow, const int theColumn,
+ const QVariant& theValue,
+ const int theRole = Qt::DisplayRole );
virtual void setCellData( const int, const int, const QVariant& );
virtual void setCellFont( const int, const int, const QFont& );
virtual void setCellForeground( const int, const int, const QColor& );
virtual void setCellIcon( const int, const int, QIcon& );
virtual QTableWidgetItem* getItem( const int, const int, const bool = true );
- virtual QModelIndexList getSelectedIndexes();
+
+ virtual QItemSelectionModel* selectionModel() const;
+ virtual QModelIndexList getSelectedIndexes() const;
+
bool indexPosition( const QModelIndex&, int&, int& ) const;
//virtual void paintCell( QPainter*, int, int, const QRect&, bool, const QColorGroup& );
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: QtxTableInterface.h
+// Author: Natalia Ermolaeva
+
+#ifndef QTXTABLEINTERFACE_H
+#define QTXTABLEINTERFACE_H
+
+#include "Qtx.h"
+
+#include <QModelIndexList>
+
+class QVariant;
+class QItemSelectionModel;
+
+#ifdef WIN32
+#pragma warning( disable : 4251 )
+#endif
+
+class QTX_EXPORT QtxTableInterface
+{
+public:
+ QtxTableInterface() {};
+ virtual ~QtxTableInterface() {};
+
+ /*!
+ Returns a table row count
+ */
+ virtual int rowCount() const = 0;
+
+ /**
+ * Returns a table column count
+ */
+ virtual int columnCount() const = 0;
+
+ /* Returns a table header value
+ * @param theSection
+ * a header section
+ * @param theOrientation
+ * a horizontal or vertical orientation
+ * @param theRole
+ * a type of modification, that should be applyed to table
+ */
+ virtual QVariant headerData( const int theSection, const Qt::Orientation theOrientation,
+ const int theRole = Qt::DisplayRole ) const = 0;
+
+ /* Sets a table header value
+ * @param theSection
+ * a header section
+ * @param theOrientation
+ * a horizontal or vertical orientation
+ * @param theValue
+ * a value
+ * @param theRole
+ * a type of modification, that should be applyed to table
+ */
+ virtual void setHeaderData( const int theSection,
+ const Qt::Orientation theOrientation,
+ const QVariant& theValue,
+ const int theRole = Qt::DisplayRole ) = 0;
+
+ /*!
+ * Returns a table cell value
+ * @param theRow
+ * a row position
+ * @param theColumn
+ * a column position
+ * @param theRole
+ * a type of modification, that should be applyed to table
+ */
+ virtual QVariant data( const int theRow, const int theColumn,
+ const int theRole = Qt::DisplayRole ) const = 0;
+
+ /*!
+ * Set the value into a table cell
+ * @param theRow
+ * a row position
+ * @param theColumn
+ * a column position
+ * @param theValue
+ * a value
+ * @param theRole
+ * a type of modification, that should be applyed to table
+ */
+ virtual void setData( const int theRow, const int theColumn,
+ const QVariant& theValue,
+ const int theRole = Qt::DisplayRole ) = 0;
+
+ /*!
+ * Returns the table selection model
+ */
+ virtual QItemSelectionModel* selectionModel() const = 0;
+
+ /**
+ * Returns a list of selected indexes
+ */
+ virtual QModelIndexList getSelectedIndexes() const = 0;
+
+};
+
+#ifdef WIN32
+#pragma warning( default: 4251 )
+#endif
+
+#endif // QTXTABLE_H
#include "TableViewer_ViewWindow.h"
#include "TableViewer_ViewManager.h"
-#include <QtxTable.h>
+#include <QtxTableInterface.h>
+
/*!
Constructor
*/
void TableViewer_Viewer::initView( TableViewer_ViewWindow* theVW )
{
theVW->initLayout();
- QtxTable* tbl = theVW->table();
+ QtxTableInterface* tbl = theVW->table();
//if ( tbl && getViewManager() )
// tbl->viewport()->installEventFilter( getViewManager() );
}
#include <HTMLService_HTMLTableCell.hxx>
#include <QtxToolBar.h>
-
#include <QtxTable.h>
+#include <QtxTableInterface.h>
+
#include <QImage>
#include <QPixmap>
#include <QApplication>
{
myModel = theModel;
myToolBar = new QtxToolBar( true, tr("LBL_TOOLBAR_LABEL"), this );
-
- // fill table
- /*
- myTable->setColumnCount(3);
- myTable->setRowCount(5);
- myTable->setCellBackground( 1, 1, Qt::red );
- myTable->setCellForeground( 1, 1, Qt::blue );
- QFont aFont = myTable->font();
- aFont.setItalic( true );
- myTable->setCellFont( 1, 1, aFont );
- myTable->setCellFont( 0, 0, aFont );
-
- aFont.setUnderline( true );
- myTable->setCellFont( 0, 1, aFont );
-
- myTable->setCellBackground( 2, 2, myTable->cellBackground( 1, 1 ) );
- myTable->setCellForeground( 2, 2, myTable->cellForeground( 1, 1 ) );
- aFont = myTable->cellFont( 1, 1 );
- myTable->setCellFont( 2, 2, aFont );
- myTable->setCellBackground( 0, 1, myTable->cellBackground( 0, 0 ) );
-
- myTable->setHeaderData( Qt::Horizontal, 1, "Caption");
- myTable->setHeaderBackground( Qt::Horizontal, 1, Qt::green );
- myTable->setHeaderFont(Qt::Horizontal, 0, aFont );
-
- myTable->setHeaderFont(Qt::Vertical, 4, myTable->headerFont( Qt::Horizontal, 0 ) );
- //backgroundColor( HorizontalHeader, 1, 1 ) );
- */
}
/*!
{
}
-QtxTable* TableViewer_ViewWindow::table() const
+QtxTableInterface* TableViewer_ViewWindow::table() const
{
return myTable;
}
void TableViewer_ViewWindow::initLayout()
{
myTable = createTable();
- setCentralWidget( myTable );
+ QWidget* aWidget = dynamic_cast<QWidget*>( myTable );
+ if ( aWidget )
+ setCentralWidget( aWidget );
createActions();
createToolBar();
QImage TableViewer_ViewWindow::dumpView()
{
- return QPixmap::grabWidget( table() ).toImage();
+ QWidget* aWidget = dynamic_cast<QWidget*>( table() );
+ return aWidget ? QPixmap::grabWidget( aWidget ).toImage() : QImage();
//return QPixmap::grabWindow( table()->winId() ).toImage();
}
QString TableViewer_ViewWindow::text( const ContentType type, const int row, const int col ) const
{
- QString aTxt = "";
- switch ( type ) {
- case VerticalHeader:
- aTxt = myTable->headerData( Qt::Vertical, row ).toString();
- break;
- case HorizontalHeader:
- aTxt = myTable->headerData( Qt::Horizontal, col ).toString();
- break;
- case Cells:
- aTxt = myTable->cellData( row, col ).toString();
- break;
- default:
- break;
- }
- return aTxt;
+ QVariant aValue = value( type, row, col, Qt::DisplayRole );
+ return aValue.isValid() ? aValue.toString() : "";
}
QString TableViewer_ViewWindow::image( const ContentType, const int, const int ) const
return "";
}
-QFont TableViewer_ViewWindow::font( const ContentType type, const int row, const int col ) const
+QFont TableViewer_ViewWindow::font( const ContentType type, const int row,
+ const int col ) const
{
- QFont aFont = myTable->font();
- switch ( type ) {
- case VerticalHeader:
- aFont = myTable->headerFont( Qt::Vertical, row );
- break;
- case HorizontalHeader:
- aFont = myTable->headerFont( Qt::Horizontal, col );
- break;
- case Cells:
- aFont = myTable->cellFont( row, col );
- break;
- default:
- break;
+ QVariant aValue = value( type, row, col, Qt::FontRole );
+
+ QFont aFont;
+ if ( aValue.isValid() && aValue.canConvert( QVariant::Font ) )
+ aFont = aValue.value<QFont>();
+ else {
+ QWidget* aWidget = dynamic_cast<QWidget*>( myTable );
+ if ( aWidget )
+ aFont = aWidget->font();
}
return aFont;
}
QColor TableViewer_ViewWindow::foregroundColor( const ContentType type, const int row,
const int col ) const
{
+ QVariant aValue = value( type, row, col, Qt::ForegroundRole );
+
QColor aColor;
- switch ( type ) {
- case VerticalHeader:
- case HorizontalHeader: {
- bool aHor = type == HorizontalHeader;
- aColor = myTable->headerForeground( aHor ? Qt::Horizontal : Qt::Vertical,
- aHor ? col : row );
- }
- break;
- case Cells:
- aColor = myTable->cellForeground( row, col );
- break;
- default:
- break;
- }
+ if ( aValue.isValid() && aValue.canConvert( QVariant::Color ) )
+ aColor = aValue.value<QColor>();
+
return aColor;
}
QColor TableViewer_ViewWindow::backgroundColor( const ContentType type, const int row,
const int col ) const
{
+ QVariant aValue = value( type, row, col, Qt::BackgroundRole );
+
QColor aColor;
- switch ( type ) {
+ if ( aValue.isValid() && aValue.canConvert( QVariant::Color ) )
+ aColor = aValue.value<QColor>();
+ return aColor;
+}
+
+QVariant TableViewer_ViewWindow::value( const ContentType theType, const int theRow,
+ const int theColumn, const int theRole ) const
+{
+ QVariant aValue;
+ switch ( theType ) {
case VerticalHeader:
case HorizontalHeader: {
- bool aHor = type == HorizontalHeader;
- aColor = myTable->headerBackground( aHor ? Qt::Horizontal : Qt::Vertical,
- aHor ? col : row );
- }
- break;
+ bool aHor = theType == HorizontalHeader;
+ aValue = myTable->headerData( aHor ? theColumn : theRow,
+ aHor ? Qt::Horizontal : Qt::Vertical,
+ theRole );
+ }
+ break;
case Cells:
- aColor = myTable->cellBackground( row, col );
+ aValue = myTable->data( theRow, theColumn, theRole );
break;
default:
break;
}
- return aColor;
+ return aValue;
}
void TableViewer_ViewWindow::createToolBar()
void TableViewer_ViewWindow::selectionChanged()
{
- bool anEnable = myTable->getSelectedIndexes().count() > 0;
- myActionsMap[CopyId]->setEnabled( anEnable );
- myActionsMap[PasteId]->setEnabled( anEnable && myCopyLst.count() > 0 );
+ QModelIndexList anItems = myTable->getSelectedIndexes();
+ bool anEnable = anItems.count() > 0;
+ bool aCopyEnable = anEnable,
+ aPasteEnable = anEnable && myCopyLst.count() > 0;
+ QModelIndexList::const_iterator anIt = anItems.begin(), aLast = anItems.end();
+ int aRow, aCol;
+ for ( anIt = anItems.begin(); anIt != aLast; ++anIt ) {
+ aRow = (*anIt).row();
+ aCol = (*anIt).column();
+ aCopyEnable = aCopyEnable || canCopy( aRow, aCol );
+ aPasteEnable = aPasteEnable && canPaste( aRow, aCol, "" ); // this should be the cell value
+ }
+ myActionsMap[CopyId]->setEnabled( aCopyEnable );
+ myActionsMap[PasteId]->setEnabled( aPasteEnable );
}
void TableViewer_ViewWindow::onActivated()
for ( ; anIt != aLast; ++anIt ) {
aRow = (*anIt).row();
aCol = (*anIt).column();
- if ( !canPaste( aRow, aCol, "" ) )
+ if ( !canCopy( aRow, aCol ) )
continue;
if ( aCol < aLeftCol )
aLeftCol = aCol;
continue;
aCopyItem.myRow = aRow-aTopRow;
aCopyItem.myCol = aCol-aLeftCol;
- aCopyItem.myText = text( Cells, aRow, aCol );
- aCopyItem.myBgCol = backgroundColor( Cells, aRow, aCol );
- aCopyItem.myFgCol = foregroundColor( Cells, aRow, aCol );
- aCopyItem.myFont = font( Cells, aRow, aCol );
+ aCopyItem.myText = value( Cells, aRow, aCol, Qt::DisplayRole );
+ aCopyItem.myBgCol = value( Cells, aRow, aCol, Qt::BackgroundRole );
+ aCopyItem.myFgCol = value( Cells, aRow, aCol, Qt::ForegroundRole );
+ aCopyItem.myFont = value( Cells, aRow, aCol, Qt::FontRole );
myCopyLst.append( aCopyItem );
}
}
aCopyItem = *aCopyIt;
aCol = aCopyItem.myCol+aLeftCol;
aRow = aCopyItem.myRow+aTopRow;
- if ( !canPaste( aRow, aCol, aCopyItem.myText ) )
+ if ( !canPaste( aRow, aCol, aCopyItem.myText.toString() ) )
continue;
- myTable->setCellData( aRow, aCol, aCopyItem.myText );
- myTable->setCellBackground( aRow, aCol, aCopyItem.myBgCol );
- myTable->setCellForeground( aRow, aCol, aCopyItem.myFgCol );
- myTable->setCellFont( aRow, aCol, aCopyItem.myFont );
+ myTable->setData( aRow, aCol, aCopyItem.myText, Qt::DisplayRole );
+ myTable->setData( aRow, aCol, aCopyItem.myBgCol, Qt::BackgroundRole );
+ myTable->setData( aRow, aCol, aCopyItem.myFgCol, Qt::ForegroundRole );
+ myTable->setData( aRow, aCol, aCopyItem.myFont, Qt::FontRole );
}
}
aCopyItem = *aCopyIt;
aCol = aCopyItem.myCol+aLeftCol;
aRow = aCopyItem.myRow+aTopRow;
- aCanPaste = canPaste( aRow, aCol, aCopyItem.myText );
+ aCanPaste = canPaste( aRow, aCol, aCopyItem.myText.toString() );
}
return aCanPaste;
}
theCol < myTable->columnCount() & theCol >= 0;
}
-QtxTable* TableViewer_ViewWindow::createTable()
+QtxTableInterface* TableViewer_ViewWindow::createTable()
{
- QtxTable* aTable = new QtxTable( this );
+ QtxTableInterface* aTable = new QtxTable( this );
connect( aTable->selectionModel(), SIGNAL( selectionChanged(
const QItemSelection&, const QItemSelection& ) ),
this, SLOT( selectionChanged() ) );
class Handle(HTMLService_HTMLTable);
class QImage;
class QFont;
-class QtxTable;
+class QtxTableInterface;
class QToolBar;
-class QTableWidgetItem;
class QItemSelection;
class TABLEVIEWER_EXPORT TableViewer_ViewWindow: public SUIT_ViewWindow
TableViewer_ViewWindow( SUIT_Desktop* , TableViewer_Viewer* );
~TableViewer_ViewWindow();
- QtxTable* table() const;
+ QtxTableInterface* table() const;
QToolBar* getToolBar() { return myToolBar; }
virtual void initLayout();
virtual bool canCopy( const int, const int );
virtual bool canPaste( const int, const int, const QString& );
- virtual QtxTable* createTable();
+ virtual QtxTableInterface* createTable();
void registerAction( const int, QtxAction* );
QtxAction* createAction( const int, const QString&, const QPixmap&, const QString&,
const QString&, const int = 0, QObject* = 0 );
QColor foregroundColor( const ContentType, const int, const int ) const;
QColor backgroundColor( const ContentType, const int, const int ) const;
+ QVariant value( const ContentType theType, const int theRow,
+ const int theColumn, const int theRole ) const;
+
protected slots:
virtual void selectionChanged();
void onActivated();
public:
typedef struct {
- QString myText;
- QColor myBgCol;
- QColor myFgCol;
- QFont myFont;
- int myRow;
- int myCol;
+ QVariant myText;
+ QVariant myBgCol;
+ QVariant myFgCol;
+ QVariant myFont;
+ int myRow;
+ int myCol;
} TableDataItem;
protected:
QList<TableDataItem> myCopyLst;
private:
- QtxTable* myTable;
+ QtxTableInterface* myTable;
QToolBar* myToolBar;
};