29#include <tqlineedit.h>
30#include <tqcombobox.h>
33#include <tqpopupmenu.h>
38#include <tqwhatsthis.h>
43#include <tdeapplication.h>
44#include <kiconloader.h>
45#include <tdemessagebox.h>
51#include "kexitableview.h"
52#include <kexiutils/utils.h>
53#include <kexiutils/validator.h>
55#include "kexicelleditorfactory.h"
56#include "kexitableviewheader.h"
57#include "kexitableview_p.h"
58#include <widget/utils/kexirecordmarker.h>
59#include <widget/utils/kexidisplayutils.h>
60#include <kexidb/cursor.h>
62KexiTableView::Appearance::Appearance(TQWidget *widget)
63 : alternateBackgroundColor( TDEGlobalSettings::alternateBackgroundColor() )
67 TQPalette p = widget ? widget->palette() : tqApp->palette();
68 baseColor = p.active().base();
69 textColor = p.active().text();
70 borderColor = TQColor(200,200,200);
71 emptyAreaColor = p.active().color(TQColorGroup::Base);
74 rowMouseOverAlternateHighlightingColor =
KexiUtils::blendedColors(p.active().highlight(), alternateBackgroundColor, 10, 90);
75 rowHighlightingTextColor = textColor;
76 rowMouseOverHighlightingTextColor = textColor;
78 backgroundAltering =
true;
79 rowMouseOverHighlightingEnabled =
true;
80 rowHighlightingEnabled =
true;
81 persistentSelections =
true;
82 navigatorEnabled =
true;
83 fullRowSelection =
false;
90class KexiTableView::WhatsThis :
public TQWhatsThis
100 virtual TQString text(
const TQPoint & pos)
102 const int leftMargin = m_tv->verticalHeaderVisible() ? m_tv->verticalHeader()->width() : 0;
106 return i18n(
"Contains a pointer to the currently selected row");
109 return i18n(
"Row navigator");
112 KexiDB::Field *f = m_tv->field( m_tv->columnAt(pos.x()-leftMargin) );
123KexiTableViewCellToolTip::KexiTableViewCellToolTip(
KexiTableView * tableView )
124 : TQToolTip(tableView->viewport())
125 , m_tableView(tableView)
129KexiTableViewCellToolTip::~KexiTableViewCellToolTip()
131 remove(parentWidget());
134void KexiTableViewCellToolTip::maybeTip(
const TQPoint & p )
136 const TQPoint cp( m_tableView->viewportToContents( p ) );
137 const int row = m_tableView->rowAt( cp.y(),
true );
138 const int col = m_tableView->columnAt( cp.x() );
141 if (col>=0 && row>=0) {
142 KexiTableEdit *editor = m_tableView->tableEditorWidget( col );
143 const bool insertRowSelected = m_tableView->isInsertingEnabled() && row==m_tableView->rows();
144 KexiTableItem *item = insertRowSelected ? m_tableView->m_insertItem : m_tableView->itemAt( row );
145 if (editor && item && (col < (
int)item->count())) {
146 int w = m_tableView->columnWidth( col );
147 int h = m_tableView->rowHeight();
150 int align = TQt::SingleLine | TQt::AlignVCenter;
154 if (!m_tableView->getVisibleLookupValue(cellValue, editor, item, tvcol))
156 const bool focused = m_tableView->selectedItem() == item && col == m_tableView->currentColumn();
157 editor->
setupContents( 0, focused, cellValue, txtValue, align, x, y_offset, w, h );
158 TQRect realRect(m_tableView->columnPos(col)-m_tableView->contentsX(),
159 m_tableView->rowPos(row)-m_tableView->contentsY(), w, h);
161 txtValue.isEmpty() ? item->at(col) : TQVariant(txtValue),
162 realRect, m_tableView->fontMetrics(), focused))
164 TQString squeezedTxtValue;
165 if (txtValue.length() > 50)
166 squeezedTxtValue = txtValue.left(100) +
"...";
168 squeezedTxtValue = txtValue;
169 tip( realRect, squeezedTxtValue );
177KexiTableView::KexiTableView(
KexiTableViewData* data, TQWidget* parent,
const char* name)
178: TQScrollView(parent, name, TQt::WStaticContents )
185 d =
new KexiTableViewPrivate(
this);
187 connect( kapp, TQ_SIGNAL( settingsChanged(
int) ), TQ_SLOT( slotSettingsChanged(
int) ) );
188 slotSettingsChanged(TDEApplication::SETTINGS_SHORTCUTS);
193 setResizePolicy(Manual);
194 viewport()->setBackgroundMode(TQt::NoBackground);
196 viewport()->setFocusPolicy(TQWidget::WheelFocus);
197 setFocusPolicy(TQWidget::WheelFocus);
201 viewport()->installEventFilter(
this);
204 setBackgroundMode(TQt::PaletteBackground);
212 d->diagonalGrayPattern = TQBrush(d->appearance.borderColor, TQt::BDiagPattern);
215 horizontalScrollBar()->installEventFilter(
this);
216 horizontalScrollBar()->raise();
217 verticalScrollBar()->raise();
220 m_popupMenu =
new TDEPopupMenu(
this,
"contextMenu");
222 d->menu_id_addRecord = m_popupMenu->insertItem(i18n(
"Add Record"),
this, TQ_SLOT(addRecord()), TQt::CTRL+TQt::Key_Insert);
223 d->menu_id_removeRecord = m_popupMenu->insertItem(
224 kapp->iconLoader()->loadIcon(
"button_cancel", TDEIcon::Small),
225 i18n(
"Remove Record"),
this, TQ_SLOT(removeRecord()), TQt::CTRL+TQt::Key_Delete);
229 d->rowHeight = fontMetrics().lineSpacing() + 4;
231 d->rowHeight = fontMetrics().lineSpacing() + 1;
234 if(d->rowHeight < 17)
237 d->pUpdateTimer =
new TQTimer(
this);
243 m_horizontalHeader->setSelectionBackgroundColor( palette().active().highlight() );
244 m_horizontalHeader->setOrientation(TQt::Horizontal);
245 m_horizontalHeader->setTracking(
false);
246 m_horizontalHeader->setMovingEnabled(
false);
247 connect(m_horizontalHeader, TQ_SIGNAL(sizeChange(
int,
int,
int)),
this, TQ_SLOT(slotTopHeaderSizeChange(
int,
int,
int)));
250 m_verticalHeader->setSelectionBackgroundColor( palette().active().highlight() );
251 m_verticalHeader->setCellHeight(d->rowHeight);
253 m_verticalHeader->setCurrentRow(-1);
256 TQMIN(m_horizontalHeader->sizeHint().height(), d->rowHeight),
257 m_horizontalHeader->sizeHint().height(), 0, 0);
270 d->scrollTimer =
new TQTimer(
this);
271 connect(d->scrollTimer, TQ_SIGNAL(timeout()),
this, TQ_SLOT(slotAutoScroll()));
277 setAcceptDrops(
true);
278 viewport()->setAcceptDrops(
true);
281 connect(horizontalScrollBar(), TQ_SIGNAL(valueChanged(
int)), m_horizontalHeader, TQ_SLOT(setOffset(
int)));
282 connect(verticalScrollBar(), TQ_SIGNAL(valueChanged(
int)), m_verticalHeader, TQ_SLOT(setOffset(
int)));
283 connect(m_horizontalHeader, TQ_SIGNAL(sizeChange(
int,
int,
int)),
this, TQ_SLOT(slotColumnWidthChanged(
int,
int,
int)));
284 connect(m_horizontalHeader, TQ_SIGNAL(sectionHandleDoubleClicked(
int)),
this, TQ_SLOT(slotSectionHandleDoubleClicked(
int)));
285 connect(m_horizontalHeader, TQ_SIGNAL(clicked(
int)),
this, TQ_SLOT(sortColumnInternal(
int)));
287 connect(d->pUpdateTimer, TQ_SIGNAL(timeout()),
this, TQ_SLOT(slotUpdate()));
300 setAppearance(d->appearance);
302 d->cellToolTip =
new KexiTableViewCellToolTip(
this);
306KexiTableView::~KexiTableView()
336 m_navPanel->setSizePolicy(TQSizePolicy::Minimum,TQSizePolicy::Preferred);
349 const TQIconSet& icon,
int width)
357 if (!description.isEmpty())
363 TQSize s(tableSize());
364 resizeContents(s.width(), s.height());
367void KexiTableView::slotRowsDeleted(
const TQValueList<int> &rows )
369 viewport()->repaint();
383 TQScrollView::setFont(font);
390 d->rowHeight = fontMetrics().lineSpacing() + 4;
392 d->rowHeight = fontMetrics().lineSpacing() + 1;
394 if (d->appearance.fullRowSelection) {
397 if(d->rowHeight < 17)
417 int r = rowAt(clipper()->height()+contentsY());
424 updateContents( columnPos( leftcol ), rowPos(row),
425 clipper()->width(), clipper()->height() - (rowPos(row) - contentsY()) );
428void KexiTableView::clearColumnsInternal(
bool )
468 m_horizontalHeader->setSortIndicator(col, (order==1) ? TQt::Ascending : TQt::Descending);
478 int cw = columnWidth(m_curCol);
479 int rh = rowHeight();
482 center(columnPos(m_curCol) + cw / 2, rowPos(
m_curRow) + rh / 2);
491TQSizePolicy KexiTableView::sizePolicy()
const
494 return TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding);
497TQSize KexiTableView::sizeHint()
const
499 const TQSize &ts = tableSize();
500 int w = TQMAX( ts.width() + leftMargin()+
verticalScrollBar()->sizeHint().width() + 2*2,
502 int h = TQMAX( ts.height()+topMargin()+horizontalScrollBar()->sizeHint().height(),
503 minimumSizeHint().height() );
504 w = TQMIN( w, tqApp->desktop()->width()*3/4 );
505 h = TQMIN( h, tqApp->desktop()->height()*3/4 );
519TQSize KexiTableView::minimumSizeHint()
const
522 leftMargin() + ((
columns()>0)?columnWidth(0):KEXI_DEFAULT_DATA_COLUMN_WIDTH) + 2*2,
527void KexiTableView::createBuffer(
int width,
int height)
530 d->pBufferPm =
new TQPixmap(width, height);
532 if(d->pBufferPm->width() < width || d->pBufferPm->height() < height)
533 d->pBufferPm->resize(width, height);
539 TQPainter *pb,
int r,
int rowp,
int cx,
int cy,
540 int colfirst,
int collast,
int maxwc)
552 int transly = rowp-cy;
554 if (d->appearance.rowHighlightingEnabled && r ==
m_curRow && !d->appearance.fullRowSelection) {
555 pb->fillRect(0, transly, maxwc, d->rowHeight, d->appearance.rowHighlightingColor);
557 else if (d->appearance.rowMouseOverHighlightingEnabled && r == d->highlightedRow) {
558 if(d->appearance.backgroundAltering && (r%2 != 0))
559 pb->fillRect(0, transly, maxwc, d->rowHeight, d->appearance.rowMouseOverAlternateHighlightingColor);
561 pb->fillRect(0, transly, maxwc, d->rowHeight, d->appearance.rowMouseOverHighlightingColor);
564 if(d->appearance.backgroundAltering && (r%2 != 0))
565 pb->fillRect(0, transly, maxwc, d->rowHeight, d->appearance.alternateBackgroundColor);
567 pb->fillRect(0, transly, maxwc, d->rowHeight, d->appearance.baseColor);
570 for(
int c = colfirst; c <= collast; c++)
573 int colp = columnPos(c);
576 int colw = columnWidth(c);
577 int translx = colp-cx;
580 pb->saveWorldMatrix();
581 pb->translate(translx, transly);
582 paintCell( pb, item, c, r, TQRect(colp, rowp, colw, d->rowHeight));
583 pb->restoreWorldMatrix();
589 y_line = transly+d->rowHeight-3;
595 RasterOp op = pb->rasterOp();
596 pb->setRasterOp(XorROP);
597 pb->setPen( TQPen(TQt::white, 3) );
598 pb->drawLine(0, y_line, maxwc, y_line);
606 if (d->disableDrawContents)
608 int colfirst = columnAt(cx);
609 int rowfirst = rowAt(cy);
610 int collast = columnAt(cx + cw-1);
611 int rowlast = rowAt(cy + ch-1);
613 bool plus1row =
false;
614 bool paintOnlyInsertRow =
false;
620 rowlast =
rows() - 1;
621 plus1row = inserting;
622 if (rowfirst == -1) {
623 if (rowAt(cy - d->rowHeight) != -1) {
624 paintOnlyInsertRow =
true;
635 if (colfirst>collast) {
640 if (rowfirst>rowlast) {
650 if (rowfirst == -1 || colfirst == -1) {
651 if (!paintOnlyInsertRow && !plus1row) {
652 paintEmptyArea(p, cx, cy, cw, ch);
657 createBuffer(cw, ch);
658 if(d->pBufferPm->isNull())
660 TQPainter *pb =
new TQPainter(d->pBufferPm,
this);
664 int maxwc = columnPos(
columns() - 1) + columnWidth(
columns() - 1);
667 pb->fillRect(cx, cy, cw, ch, d->appearance.baseColor);
671 if (paintOnlyInsertRow) {
676 TQPtrListIterator<KexiTableItem> it =
m_data->iterator();
678 rowp = rowPos(rowfirst);
679 for (r = rowfirst;r <= rowlast; r++, ++it, rowp+=d->rowHeight) {
680 paintRow(it.current(), pb, r, rowp, cx, cy, colfirst, collast, maxwc);
690 p->drawPixmap(cx,cy,*d->pBufferPm, 0,0,cw,ch);
693 paintEmptyArea(p, cx, cy, cw, ch);
696bool KexiTableView::isDefaultValueDisplayed(KexiTableItem *item,
int col, TQVariant* value)
700 if (cursorAtInsertRowOrEditingNewRow
701 && (tvcol =
m_data->column(col))
702 && hasDefaultValueAt(*tvcol)
728 if (d->appearance.gridEnabled) {
729 p->setPen(d->appearance.borderColor);
730 p->drawLine( x2, 0, x2, y2 );
731 p->drawLine( 0, y2, x2, y2 );
735 if (m_editor && row ==
m_curRow && col == m_curCol
749 int align = TQt::SingleLine | TQt::AlignVCenter;
755 if (col < (
int)item->count()) {
757 if (m_editor && row ==
m_curRow && col == m_curCol
763 cellValue = m_editor->
value();
768 cellValue = *bufferedValueAt(col);
772 cellValue = item->at(col);
776 bool defaultValueDisplayed = isDefaultValueDisplayed(item, col);
783 defaultValueDisplayed =
true;
787 const bool columnReadOnly = tvcol->
isReadOnly();
788 const bool dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted
789 = d->appearance.rowHighlightingEnabled && !d->appearance.persistentSelections
795 if (defaultValueDisplayed) {
796 if (col == m_curCol && row ==
m_curRow && usesSelectedTextColor)
797 defaultPen = TQPen(d->defaultValueDisplayParameters.selectedTextColor);
799 defaultPen = TQPen(d->defaultValueDisplayParameters.textColor);
801 else if (d->appearance.fullRowSelection
802 && (row == d->highlightedRow || (row ==
m_curRow && d->highlightedRow==-1))
803 && usesSelectedTextColor )
805 defaultPen = TQPen(d->appearance.rowHighlightingTextColor);
807 else if (d->appearance.fullRowSelection && row ==
m_curRow && usesSelectedTextColor)
809 defaultPen = TQPen(d->appearance.textColor);
811 else if (
m_currentItem == item && col == m_curCol && !columnReadOnly
812 && !dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted
813 && usesSelectedTextColor)
815 defaultPen = TQPen(colorGroup().highlightedText());
817 else if (d->appearance.rowHighlightingEnabled && row ==
m_curRow
818 && !dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted
819 && usesSelectedTextColor)
821 defaultPen = TQPen(d->appearance.rowHighlightingTextColor);
823 else if (d->appearance.rowMouseOverHighlightingEnabled && row == d->highlightedRow
824 && !dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted
825 && usesSelectedTextColor)
827 defaultPen = TQPen(d->appearance.rowMouseOverHighlightingTextColor);
830 defaultPen = TQPen(d->appearance.textColor);
833 if (defaultValueDisplayed)
834 p->setFont( d->defaultValueDisplayParameters.font );
835 p->setPen( defaultPen );
841 cellValue, txt, align, x, y_offset, w, h );
843 if (!d->appearance.gridEnabled)
846 if (d->appearance.fullRowSelection && d->appearance.fullRowSelection) {
849 if (
m_currentItem == item && (col == m_curCol || d->appearance.fullRowSelection)) {
850 if (edit && ((d->appearance.rowHighlightingEnabled && !d->appearance.fullRowSelection) || (row ==
m_curRow && d->highlightedRow==-1 && d->appearance.fullRowSelection)))
852 isEnabled() ? colorGroup().highlight() : TQColor(200,200,200),
853 p->fontMetrics(), columnReadOnly, d->appearance.fullRowSelection );
857 p->fillRect(0, 0, x2, y2, d->diagonalGrayPattern);
862 && !d->appearance.fullRowSelection)
867 p->setPen(d->appearance.textColor);
870 TQPen gray_pen(p->pen());
871 gray_pen.setColor(d->appearance.borderColor);
877 p->drawRect(0, 0, x2, y2);
890 x, y_offset, w - x - x - ((align & TQt::AlignLeft)?2:0), h, align);
896 if (!txt.isEmpty()) {
897 if (defaultValueDisplayed)
898 p->setFont( d->defaultValueDisplayParameters.font );
899 p->setPen( defaultPen );
900 p->drawText(x, y_offset, w - (x + x)- ((align & TQt::AlignLeft)?2:0), h,
906TQPoint KexiTableView::contentsToViewport2(
const TQPoint &p )
908 return TQPoint( p.x() - contentsX(), p.y() - contentsY() );
911void KexiTableView::contentsToViewport2(
int x,
int y,
int& vx,
int& vy )
913 const TQPoint v = contentsToViewport2( TQPoint( x, y ) );
918TQPoint KexiTableView::viewportToContents2(
const TQPoint& vp )
920 return TQPoint( vp.x() + contentsX(),
921 vp.y() + contentsY() );
924void KexiTableView::paintEmptyArea( TQPainter *p,
int cx,
int cy,
int cw,
int ch )
930 TQSize ts( tableSize() );
940 contentsToViewport2( cx, cy, cx, cy );
941 TQRegion reg( TQRect( cx, cy, cw, ch ) );
947 reg = reg.subtract( TQRect( TQPoint( 0, 0 ), ts
948 -TQSize(0,TQMAX((
m_navPanel ?
m_navPanel->height() : 0), horizontalScrollBar()->sizeHint().height())
949 - (horizontalScrollBar()->isVisible() ? horizontalScrollBar()->sizeHint().height()/2 : 0)
950 + (horizontalScrollBar()->isVisible() ? 0 :
951 d->internal_bottomMargin
962 TQMemArray<TQRect> r = reg.rects();
963 for (
int i = 0; i < (int)r.count(); i++ ) {
964 TQRect rect( viewportToContents2(r[i].topLeft()), r[i].size() );
969 p->fillRect( rect, d->appearance.emptyAreaColor );
974void KexiTableView::contentsMouseDoubleClickEvent(TQMouseEvent *e)
978 contentsMousePressEvent(e);
998void KexiTableView::contentsMousePressEvent( TQMouseEvent* e )
1003 TQScrollView::contentsMousePressEvent( e );
1007 if (columnAt(e->pos().x())==-1) {
1008 TQScrollView::contentsMousePressEvent( e );
1020 if (!d->moveCursorOnMouseRelease) {
1021 if (!handleContentsMousePressOrRelease(e,
false))
1026 if(e->button() == TQt::RightButton)
1030 else if(e->button() == TQt::LeftButton)
1035 int s = TQMAX(d->rowHeight - 5, 12);
1036 s = TQMIN( d->rowHeight-3, s );
1037 s = TQMIN( columnWidth(m_curCol)-3, s );
1038 const TQRect r( columnPos(m_curCol) + TQMAX( columnWidth(m_curCol)/2 - s/2, 0 ), rowPos(
m_curRow) +d->rowHeight/2 - s/2 , s, s);
1040 if (r.contains(e->pos())) {
1056void KexiTableView::contentsMouseReleaseEvent( TQMouseEvent* e )
1062 if (d->moveCursorOnMouseRelease)
1063 handleContentsMousePressOrRelease(e,
true);
1065 int col = columnAt(e->pos().x());
1066 int row = rowAt(e->pos().y());
1071 TQScrollView::contentsMouseReleaseEvent( e );
1076bool KexiTableView::handleContentsMousePressOrRelease(TQMouseEvent* e,
bool release)
1080 int oldCol = m_curCol;
1081 kdDebug(44021) <<
"oldRow=" << oldRow <<
" oldCol=" << oldCol <<endl;
1082 bool onInsertItem =
false;
1087 if (rowAt(e->pos().y())==-1) {
1088 newrow = rowAt(e->pos().y() - d->rowHeight);
1089 if (newrow==-1 &&
m_data->count()>0) {
1091 TQScrollView::contentsMouseReleaseEvent( e );
1093 TQScrollView::contentsMousePressEvent( e );
1097 kdDebug(44021) <<
"Clicked just on 'insert' row." << endl;
1102 newrow = rowAt(e->pos().y());
1106 if (rowAt(e->pos().y())==-1 || columnAt(e->pos().x())==-1) {
1108 TQScrollView::contentsMouseReleaseEvent( e );
1110 TQScrollView::contentsMousePressEvent( e );
1114 newrow = rowAt(e->pos().y());
1116 newcol = columnAt(e->pos().x());
1118 if(e->button() != TQt::NoButton) {
1126 if (!d->contextMenuEnabled ||
m_popupMenu->count()<1)
1129 if (pos==TQPoint(-1,-1)) {
1130 pos = viewport()->mapToGlobal( TQPoint( columnPos(m_curCol), rowPos(
m_curRow) + d->rowHeight ) );
1143void KexiTableView::contentsMouseMoveEvent( TQMouseEvent *e )
1146 const int col = columnAt(e->x());
1150 row = rowAt( e->y(),
true );
1156 if (d->appearance.rowMouseOverHighlightingEnabled) {
1157 if (row != d->highlightedRow) {
1158 const int oldRow = d->highlightedRow;
1159 d->highlightedRow = row;
1172 contentsToViewport(e->x(), e->y(), x, y);
1174 if(y > visibleHeight())
1176 d->needAutoScroll =
true;
1177 d->scrollTimer->start(70,
false);
1178 d->scrollDirection = ScrollDown;
1182 d->needAutoScroll =
true;
1183 d->scrollTimer->start(70,
false);
1184 d->scrollDirection = ScrollUp;
1186 else if(x > visibleWidth())
1188 d->needAutoScroll =
true;
1189 d->scrollTimer->start(70,
false);
1190 d->scrollDirection = ScrollRight;
1194 d->needAutoScroll =
true;
1195 d->scrollTimer->start(70,
false);
1196 d->scrollDirection = ScrollLeft;
1200 d->needAutoScroll =
false;
1201 d->scrollTimer->stop();
1202 contentsMousePressEvent(e);
1205 TQScrollView::contentsMouseMoveEvent(e);
1209void KexiTableView::contentsMouseReleaseEvent(TQMouseEvent *)
1211 if(d->needAutoScroll)
1213 d->scrollTimer->stop();
1218static bool overrideEditorShortcutNeeded(TQKeyEvent *e)
1221 return e->key() == TQt::Key_Delete && e->state()==TQt::ControlButton;
1226 const int k = e->key();
1229 if (!action->isEnabled())
1231 if (action->shortcut() == TDEShortcut( KKey(e) )) {
1233 if (overrideEditorShortcutNeeded(e)) {
1242 if (action_name==
"data_save_row")
1243 return (k == TQt::Key_Return || k == TQt::Key_Enter) && e->state()==TQt::ShiftButton;
1244 if (action_name==
"edit_delete_row")
1245 return k == TQt::Key_Delete && e->state()==TQt::ControlButton;
1246 if (action_name==
"edit_delete")
1247 return k == TQt::Key_Delete && e->state()==TQt::NoButton;
1248 if (action_name==
"edit_edititem")
1249 return k == TQt::Key_F2 && e->state()==TQt::NoButton;
1250 if (action_name==
"edit_insert_empty_row")
1251 return k == TQt::Key_Insert && e->state()==(TQt::ShiftButton | TQt::ControlButton);
1262 const int k = e->key();
1264 TQWidget *w = focusWidget();
1267 if (!w || w!=viewport() && w!=
this && (!m_editor || !
KexiUtils::hasParent(
dynamic_cast<TQObject*
>(m_editor), w))) {
1272 if (d->skipKeyPress) {
1273 d->skipKeyPress=
false;
1289 if (k == TQt::Key_Escape) {
1293 }
else if (k == TQt::Key_Return || k == TQt::Key_Enter) {
1306 kexidbg <<
"shortCutPressed!!!" <<endl;
1312 if(k == TQt::Key_Return || k == TQt::Key_Enter)
1318 int curCol = m_curCol;
1320 const bool nobtn = e->state()==TQt::NoButton;
1321 bool printable =
false;
1351 if (k == TQt::Key_Shift || k == TQt::Key_Alt || k == TQt::Key_Control || k == TQt::Key_Meta) {
1355 if (e->isAccepted())
1358 else if (k == TQt::Key_Backspace && nobtn) {
1362 else if (k == TQt::Key_Space) {
1371 else if (k == TQt::Key_Escape) {
1379 if (nobtn && (k==TQt::Key_Tab || k==TQt::Key_Right)) {
1382 if (acceptEditor()) {
1383 if (curCol == (
columns() - 1)) {
1393 else if ((e->state()==TQt::ShiftButton && k==TQt::Key_Tab)
1394 || (nobtn && k==TQt::Key_Backtab)
1395 || (e->state()==TQt::ShiftButton && k==TQt::Key_Backtab)
1396 || (nobtn && k==TQt::Key_Left)
1400 if (acceptEditor()) {
1411 else if (nobtn && k==d->contextMenuKey) {
1421 else if ( nobtn && (k==TQt::Key_Enter || k==TQt::Key_Return ||
shortCutPressed(e,
"edit_edititem")) ) {
1426 kexidbg <<
"KexiTableView::KeyPressEvent(): default" << endl;
1427 if (e->text().isEmpty() || !e->text().isEmpty() && !e->text()[0].isPrint() ) {
1428 kdDebug(44021) <<
"NOT PRINTABLE: 0x0" << TQString(
"%1").arg(k,0,16) <<endl;
1430 TQScrollView::keyPressEvent(e);
1438 if (printable && !ro) {
1440 if (tvcol->acceptsFirstChar(TQString(e->text())[0])) {
1441 kdDebug(44021) <<
"KexiTableView::KeyPressEvent(): ev pressed: acceptsFirstChar()==true" << endl;
1447 kdDebug(44021) <<
"KexiTableView::KeyPressEvent(): ev pressed: acceptsFirstChar()==false" << endl;
1461void KexiTableView::emitSelected()
1469 return visibleHeight() / d->rowHeight;
1488 if (!ignoreMissingEditor) {
1499 connect(
editor,TQ_SIGNAL(cancelRequested()),
this,TQ_SLOT(cancelEditor()));
1500 connect(
editor,TQ_SIGNAL(acceptRequested()),
this,TQ_SLOT(acceptEditor()));
1502 editor->resize(columnWidth(col)-1, rowHeight()-1);
1503 editor->installEventFilter(
this);
1507 d->editors.insert( tvcol,
editor );
1520 kexidbg<<
"KexiTableView::editorShowFocus() : IN" << endl;
1521 TQRect rect = cellGeometry(
m_curRow, m_curCol );
1539 kdDebug(44021) <<
"KexiTableView::createEditor('"<<addText<<
"',"<<removeOld<<
")"<<endl;
1541 kdDebug(44021) <<
"KexiTableView::createEditor(): DATA IS READ ONLY!"<<endl;
1546 kdDebug(44021) <<
"KexiTableView::createEditor(): COL IS READ ONLY!"<<endl;
1570 updateContents(columnPos(0), rowPos(row), viewport()->width(), d->rowHeight*2);
1573 ensureVisible(columnPos(m_curCol), rowPos(row+1)+d->rowHeight-1, columnWidth(m_curCol), d->rowHeight);
1580 m_editor = editorWidget;
1584 m_editor->
setValue(*bufferedValueAt(col, !removeOld), addText, removeOld);
1586 moveChild(editorWidget, columnPos(m_curCol), rowPos(
m_curRow));
1588 editorWidget->
resize(columnWidth(m_curCol)-1, rowHeight()-1);
1589 editorWidget->show();
1591 m_editor->setFocus();
1601void KexiTableView::focusInEvent(TQFocusEvent* e)
1612bool KexiTableView::focusNextPrevChild(
bool )
1620void KexiTableView::resizeEvent(TQResizeEvent *e)
1622 TQScrollView::resizeEvent(e);
1629 if ((contentsHeight() - e->size().height()) <= d->rowHeight) {
1651void KexiTableView::viewportResizeEvent( TQResizeEvent *e )
1653 TQScrollView::viewportResizeEvent( e );
1658void KexiTableView::showEvent(TQShowEvent *e)
1660 TQScrollView::showEvent(e);
1661 if (!d->maximizeColumnsWidthOnShow.isEmpty()) {
1663 d->maximizeColumnsWidthOnShow.clear();
1673 TQSize s(tableSize());
1676 resizeContents(s.width(),s.height());
1681 if (d->ensureCellVisibleOnShow!=TQPoint(-1,-1)) {
1682 ensureCellVisible( d->ensureCellVisibleOnShow.x(), d->ensureCellVisibleOnShow.y() );
1683 d->ensureCellVisibleOnShow = TQPoint(-1,-1);
1690void KexiTableView::contentsDragMoveEvent(TQDragMoveEvent *e)
1695 TQPoint p = e->pos();
1696 int row = rowAt(p.y());
1697 KexiTableItem *item = 0;
1699 if ((p.y() % d->rowHeight) > (d->rowHeight*2/3) ) {
1703 emit dragOverRow(item, row, e);
1704 if (e->isAccepted()) {
1723 e->acceptAction(
false);
1736void KexiTableView::contentsDropEvent(TQDropEvent *e)
1747 TQPoint p = e->pos();
1748 int row = rowAt(p.y());
1749 if ((p.y() % d->rowHeight) > (d->rowHeight*2/3) ) {
1752 KexiTableItem *item =
m_data->at(row);
1753 KexiTableItem *newItem = 0;
1754 emit droppedAtRow(item, row, e, newItem);
1756 const int realRow = (row==
m_curRow ? -1 : row);
1764void KexiTableView::viewportDragLeaveEvent( TQDragLeaveEvent *e )
1782 updateContents(cellGeometry(row, col));
1797 if (row < 0 || row >= (
rows() + 2 ))
1804 updateContents( TQRect( contentsX(), rowPos(row), clipper()->width(), rowHeight() ) );
1809 TQSize s(tableSize());
1810 int w = contentsWidth();
1811 viewport()->setUpdatesEnabled(
false);
1812 resizeContents( s.width(), s.height() );
1813 viewport()->setUpdatesEnabled(
true);
1814 if (contentsWidth() < w) {
1815 updateContents(contentsX(), 0, viewport()->width(), contentsHeight());
1820 updateContents(contentsX(), 0, viewport()->width(), contentsHeight());
1825 TQWidget *editorWidget =
dynamic_cast<TQWidget*
>(m_editor);
1828 editorWidget->resize(columnWidth(m_curCol)-1, rowHeight()-1);
1829 moveChild(editorWidget, columnPos(m_curCol), rowPos(
m_curRow));
1838void KexiTableView::slotSectionHandleDoubleClicked(
int section )
1845void KexiTableView::updateGeometries()
1847 TQSize ts = tableSize();
1853 m_verticalHeader->setGeometry(1, topMargin() + 1, leftMargin(), visibleHeight());
1856int KexiTableView::columnWidth(
int col)
const
1860 int vcID =
m_data->visibleColumnID( col );
1864int KexiTableView::rowHeight()
const
1866 return d->rowHeight;
1869int KexiTableView::columnPos(
int col)
const
1874 int c = TQMIN(col, (
int)
m_data->columnsCount()-1), vcID = 0;
1875 while (c>=0 && (vcID=
m_data->visibleColumnID( c ))==-1)
1884int KexiTableView::rowPos(
int row)
const
1886 return d->rowHeight*row;
1889int KexiTableView::columnAt(
int pos)
const
1896 return m_data->globalColumnID( r );
1903int KexiTableView::rowAt(
int pos,
bool ignoreEnd)
const
1910 if ((pos >= (
int)
m_data->count()) && !ignoreEnd)
1915TQRect KexiTableView::cellGeometry(
int row,
int col)
const
1917 return TQRect(columnPos(col), rowPos(row),
1918 columnWidth(col), rowHeight());
1921TQSize KexiTableView::tableSize()
const
1939 + (horizontalScrollBar()->isVisible() ? 0 : horizontalScrollBar()->sizeHint().height())
1940 + d->internal_bottomMargin
1970 d->ensureCellVisibleOnShow = TQPoint(row,col);
1975 TQRect r( columnPos(col==-1 ? m_curCol : col), rowPos(row) +(d->appearance.fullRowSelection?1:0),
1976 columnWidth(col==-1 ? m_curCol : col), rowHeight());
1988 r.setBottom(r.bottom()+
m_navPanel->height());
1991 TQPoint pcenter = r.center();
1992 ensureVisible(pcenter.x(), pcenter.y(), r.width()/2, r.height()/2);
1998void KexiTableView::updateAfterCancelRowEdit()
2000 KexiDataAwareObjectInterface::updateAfterCancelRowEdit();
2004void KexiTableView::updateAfterAcceptRowEdit()
2006 KexiDataAwareObjectInterface::updateAfterAcceptRowEdit();
2016 const TQVariant *visibleFieldValue = 0;
2018 visibleFieldValue =
m_data->rowEditBuffer()->
at(
2022 if (visibleFieldValue)
2024 cellValue = *visibleFieldValue;
2037 KexiDataAwareObjectInterface::removeEditor();
2038 viewport()->setFocus();
2047void KexiTableView::slotAutoScroll()
2049 kdDebug(44021) <<
"KexiTableView::slotAutoScroll()" <<endl;
2050 if (!d->needAutoScroll)
2053 switch(d->scrollDirection)
2072#ifndef KEXI_NO_PRINT
2074KexiTableView::print(KPrinter &)
2078 int leftMargin = printer.margins().width() + 2 + d->rowHeight;
2079 int topMargin = printer.margins().height() + 2;
2081 int bottomMargin = 0;
2082 kdDebug(44021) <<
"KexiTableView::print: bottom = " << bottomMargin << endl;
2084 TQPainter p(&printer);
2087 int width = leftMargin;
2088 for(
int col=0; col <
columns(); col++)
2090 p.fillRect(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, TQBrush(TQt::gray));
2091 p.drawRect(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight);
2092 p.drawText(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, TQt::AlignLeft | TQt::AlignVCenter,
2094 width = width + columnWidth(col);
2097 int yOffset = topMargin;
2102 if(!i->isInsertItem())
2103 { kdDebug(44021) <<
"KexiTableView::print: row = " << row <<
" y = " << yOffset << endl;
2104 int xOffset = leftMargin;
2105 for(
int col=0; col <
columns(); col++)
2107 kdDebug(44021) <<
"KexiTableView::print: col = " << col <<
" x = " << xOffset << endl;
2108 p.saveWorldMatrix();
2109 p.translate(xOffset, yOffset);
2110 paintCell(&p, i, col, TQRect(0, 0, columnWidth(col) + 1, d->rowHeight),
true);
2111 p.restoreWorldMatrix();
2113 xOffset = xOffset + columnWidth(col);
2118 yOffset = topMargin + row * d->rowHeight;
2123 p.drawLine(leftMargin, topMargin, leftMargin, yOffset);
2124 p.drawLine(leftMargin, topMargin, right - 1, topMargin);
2126 yOffset = topMargin;
2130 p.drawLine(leftMargin, topMargin, leftMargin, yOffset);
2131 p.drawLine(leftMargin, topMargin, right - 1, topMargin);
2157 for (
int i=0; i<cols; i++)
2164 if (-1==indexOfVisibleColumn)
2165 indexOfVisibleColumn = colNum;
2167 if (indexOfVisibleColumn < 0)
2170 TQPtrListIterator<KexiTableItem> it =
m_data->iterator();
2171 if (it.current() && it.current()->count()<=(uint)indexOfVisibleColumn)
2177 TQFontMetrics fm(fontMetrics());
2180 if (maxw == 0 &&
m_data->isEmpty())
2187 for (it =
m_data->iterator(); it.current(); ++it) {
2188 const int wfw = ed->
widthForValue( it.current()->at( indexOfVisibleColumn ), fm );
2189 maxw = TQMAX( maxw, wfw );
2194 if (maxw < KEXITV_MINIMUM_COLUMN_WIDTH )
2195 maxw = KEXITV_MINIMUM_COLUMN_WIDTH;
2196 kexidbg <<
"KexiTableView: setColumnWidth(colNum=" << colNum
2197 <<
", indexOfVisibleColumn=" << indexOfVisibleColumn <<
", width=" << maxw <<
" )" << endl;
2203 if (
columns()<=colNum || colNum < 0)
2213 d->maximizeColumnsWidthOnShow += columnList;
2219 TQValueList<int> cl, sortedList = columnList;
2220 qHeapSort(sortedList);
2223 TQValueList<int>::ConstIterator it, end( sortedList.constEnd() );
2224 for ( it = sortedList.constBegin(); it != end; ++it) {
2231 int sizeToAdd = (width() -
m_horizontalHeader->headerWidth()) / cl.count() - verticalHeader()->width();
2234 end = cl.constEnd();
2235 for ( it = cl.constBegin(); it != end; ++it) {
2255void KexiTableView::setEditableOnDoubleClick(
bool set)
2257 d->editOnDoubleClick = set;
2259bool KexiTableView::editableOnDoubleClick()
const
2261 return d->editOnDoubleClick;
2285 return d->horizontalHeaderVisible;
2291 d->horizontalHeaderVisible = set;
2307 d->pUpdateTimer->start(20,
true);
2311void KexiTableView::setHBarGeometry( TQScrollBar & hbar,
int x,
int y,
int w,
int h )
2314 kdDebug(44021)<<
"KexiTableView::setHBarGeometry"<<endl;
2315 if (d->appearance.navigatorEnabled) {
2319 hbar.setGeometry( x , y, w, h );
2328 a.navigatorEnabled = m_navPanelEnabled;
2335 int r = text.toInt(&ok);
2351void KexiTableView::moveToLastRecordRequested()
2354 selectRow(
rows()>0 ? (
rows()-1) : 0);
2357void KexiTableView::moveToPreviousRecordRequested()
2363void KexiTableView::moveToNextRecordRequested()
2369void KexiTableView::moveToFirstRecordRequested()
2379 TQVariant defaultValue;
2380 const bool defaultValueDisplayed
2381 = isDefaultValueDisplayed(
m_currentItem, m_curCol, &defaultValue);
2383 TQVariant visibleValue;
2386 defaultValueDisplayed ? defaultValue :
m_currentItem->at( m_curCol ),
2408bool KexiTableView::eventFilter( TQObject *o, TQEvent *e )
2413 if (e->type()==TQEvent::KeyPress) {
2414 if (e->spontaneous() ) {
2415 TQKeyEvent *ke =
static_cast<TQKeyEvent*
>(e);
2416 const int k = ke->key();
2417 int s = ke->state();
2425 else if (m_editor && (o==
dynamic_cast<TQObject*
>(m_editor) || o==m_editor->
widget())) {
2426 if ( (k==TQt::Key_Tab && (s==TQt::NoButton || s==TQt::ShiftButton))
2427 || (overrideEditorShortcutNeeded(ke))
2428 || (k==TQt::Key_Enter || k==TQt::Key_Return || k==TQt::Key_Up || k==TQt::Key_Down)
2435 if (ke->isAccepted())
2453 else if (o==horizontalScrollBar()) {
2454 if ((e->type()==TQEvent::Show && !horizontalScrollBar()->isVisible())
2455 || (e->type()==TQEvent::Hide && horizontalScrollBar()->isVisible())) {
2459 else if (e->type()==TQEvent::Leave) {
2460 if (o==viewport() && d->appearance.rowMouseOverHighlightingEnabled
2461 && d->appearance.persistentSelections)
2463 if (d->highlightedRow!=-1) {
2464 int oldRow = d->highlightedRow;
2465 d->highlightedRow = -1;
2467 const bool dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted
2468 = d->appearance.rowHighlightingEnabled && !d->appearance.persistentSelections;
2470 if (!dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted)
2477 d->recentCellWithToolTip = TQPoint(-1,-1);
2492 return TQScrollView::eventFilter(o,e);
2501void KexiTableView::setBottomMarginInternal(
int pixels)
2503 d->internal_bottomMargin = pixels;
2506void KexiTableView::paletteChange(
const TQPalette &oldPalette )
2508 Q_UNUSED(oldPalette);
2511 m_verticalHeader->setSelectionBackgroundColor( palette().active().highlight() );
2518 return d->appearance;
2541 if(!a.navigatorEnabled)
2547 d->highlightedRow = -1;
2558 return d->highlightedRow;
2565 row = TQMAX(0, row);
2568 const int previouslyHighlightedRow = d->highlightedRow;
2569 if (previouslyHighlightedRow == row) {
2570 if (previouslyHighlightedRow!=-1)
2574 d->highlightedRow = row;
2575 if (d->highlightedRow!=-1)
2578 if (previouslyHighlightedRow!=-1)
2581 if (
m_curRow>=0 && (previouslyHighlightedRow==-1 || previouslyHighlightedRow==
m_curRow)
2582 && d->highlightedRow!=
m_curRow && !d->appearance.persistentSelections)
2589KexiTableItem *KexiTableView::highlightedItem()
const
2591 return d->highlightedRow == -1 ? 0 :
m_data->at(d->highlightedRow);
2594void KexiTableView::slotSettingsChanged(
int category)
2596 if (category==TDEApplication::SETTINGS_SHORTCUTS) {
2597 d->contextMenuKey = TDEGlobalSettings::contextMenuKey();
2603 return rowAt( contentsY() );
2606#include "kexitableview.moc"
A base class for implementing cell editor factories.
static KexiTableEdit * createEditor(KexiTableViewColumn &column, TQWidget *parent=0)
static KexiCellEditorFactoryItem * item(uint type, const TQString &subType=TQString())
QuerySchema * query() const
TQString captionOrName() const
bool isAutoIncrement() const
TQString description() const
TQVariant defaultValue() const
int indexForVisibleLookupValue() const
const TQVariant * at(QueryColumnInfo &ci, bool useDefaultValueIfPossible=true) const
The KexiDataAwareObjectInterface is an interface for record-based data object.
virtual void reloadData()
KexiTableViewData * data() const
virtual bool isReadOnly() const
bool m_vScrollBarValueChanged_enabled
virtual void setCursorPosition(int row, int col=-1, bool forceSet=false)
void insertItem(KexiTableItem *newItem, int row=-1)
KexiTableItem * m_insertItem
item data for inserting
virtual bool isInsertingEnabled() const
bool m_rowEditing
when (current or new) row is edited - changed field values are temporary stored here
virtual bool handleKeyPress(TQKeyEvent *e, int &curRow, int &curCol, bool fullRowSelection, bool *moveToFirstField=0, bool *moveToLastField=0)
virtual void setSpreadSheetMode()
void startEditOrToggleValue()
virtual void boolToggled()
bool hasData() const
for sanity checks (return true if m_data is present; else: outputs warning)
virtual void clearVariables()
virtual int columns() const
bool m_contentsMousePressEvent_dblClick
KexiTableViewData * m_data
data structure displayed for this object
TDEPopupMenu * m_popupMenu
int m_curRow
cursor position
virtual bool columnEditable(int col)
KexiDataItemInterface * editor() const
virtual void focusOutEvent(TQFocusEvent *e)
Call this from the subclass. */.
KexiRecordNavigator * m_navPanel
main navigation widget
KexiTableViewHeader * m_horizontalHeader
bool m_verticalHeaderAlreadyAdded
virtual void initDataContents()
bool m_initDataContentsOnShow
KexiRecordMarker * m_verticalHeader
KexiTableItem * m_currentItem
current data item
bool m_owner
true if m_data member is owned by this object
bool m_updateEntireRowWhenMovingToOtherRow
int currentColumn() const
An interface for declaring widgets to be data-aware.
virtual bool cursorAtEnd()=0
virtual bool cursorAtStart()=0
virtual TQVariant value()=0
virtual void showFocus(const TQRect &r, bool readOnly)
void setValue(const TQVariant &value, const TQVariant &add=TQVariant(), bool removeOld=false, const TQVariant *visibleValue=0)
bool hasFocusableWidget() const
virtual void handleAction(const TQString &actionName)
virtual TQWidget * widget()=0
static void initDisplayForDefaultValue(DisplayParameters &par, TQWidget *widget)
Initializes display parameters for default value.
static void paintAutonumberSign(const DisplayParameters &par, TQPainter *painter, int x, int y, int width, int height, int align, bool overrideColor=false)
Paints autonumber sign using par parameters.
static void initDisplayForAutonumberSign(DisplayParameters &par, TQWidget *widget)
Initializes display parameters for autonumber sign.
Record marker, usually displayed at the left side of a table view or a continuous form.
KexiRecordNavigatorHandler interface handles requests generated by KexiRecordNavigator.
KexiRecordNavigator class provides a record navigator.
void showEditingIndicator(bool show)
void setHBarGeometry(TQScrollBar &hbar, int x, int y, int w, int h)
void setRecordHandler(KexiRecordNavigatorHandler *handler)
The KexiSharedActionClient is an interface using application-wide (shared) actions.
TQAsciiDict< TDEAction > m_sharedActions
Actions pluged for this widget using plugSharedAction(), available by name.
Abstract class for a cell editor. Handles cell painting and displaying the editor widget.
virtual bool handleKeyPress(TQKeyEvent *ke, bool editorActive)
virtual bool showToolTipIfNeeded(const TQVariant &value, const TQRect &rect, const TQFontMetrics &fm, bool focused)
bool usesSelectedTextColor() const
virtual void setupContents(TQPainter *p, bool focused, const TQVariant &val, TQString &txt, int &align, int &x, int &y_offset, int &w, int &h)
virtual void resize(int w, int h)
virtual void paintSelectionBackground(TQPainter *p, bool focused, const TQString &txt, int align, int x, int y_offset, int w, int h, const TQColor &fillColor, const TQFontMetrics &fm, bool readOnly, bool fullRowSelection)
virtual KexiDB::QueryColumnInfo * columnInfo() const
KexiDB::Field * displayedField() const
virtual void handleCopyAction(const TQVariant &value, const TQVariant &visibleValue)=0
int rightMargin(bool focused) const
virtual int widthForValue(TQVariant &val, const TQFontMetrics &fm)
virtual void paintFocusBorders(TQPainter *p, TQVariant &cal, int x, int y, int w, int h)
virtual bool handleDoubleClick()
KexiDB::Field * field() const
KexiDB::QueryColumnInfo * visibleLookupColumnInfo
KexiDB::QueryColumnInfo * columnInfo
void clearRowEditBuffer()
bool rowMouseOverHighlightingEnabled
bool rowHighlightingEnabled
KexiTableView class provides a widget for displaying data in a tabular view.
virtual void createEditor(int row, int col, const TQString &addText=TQString(), bool removeOld=false)
Creates editors and shows it, what usually means the beginning of a cell editing.
void setAppearance(const Appearance &a)
virtual int rowsPerPage() const
const Appearance & appearance() const
void showContextMenu(const TQPoint &pos=TQPoint(-1,-1))
KexiDB::Field * field(int colNum) const
virtual void copySelection()
Copy current selection to a clipboard (e.g. cell)
void setVerticalHeaderVisible(bool set)
Sets vertical header's visibility.
virtual void setLocalSortingOrder(int col, int order)
void triggerUpdate()
single shot after 1ms for contents updatinh
void setColumnWidth(int col, int width)
Sets width of column width to width.
bool getVisibleLookupValue(TQVariant &cellValue, KexiTableEdit *edit, KexiTableItem *item, KexiTableViewColumn *tvcol) const
void setHorizontalHeaderVisible(bool set)
Sets horizontal header's visibility.
void paintRow(KexiTableItem *item, TQPainter *pb, int r, int rowp, int cx, int cy, int colfirst, int collast, int maxwc)
void rowEditStarted(int row)
emmited when row editing is started (for updating or inserting)
int validRowNumber(const TQString &text)
internal, to determine valid row number when navigator text changed
virtual void slotRowRepaintRequested(KexiTableItem &item)
Handles KexiTableViewData::rowRepaintRequested() signal.
virtual void deleteAndStartEditCurrentCell()
virtual void ensureCellVisible(int row, int col)
void slotEditRequested()
receives a signal from cell editors
virtual void focusOutEvent(TQFocusEvent *e)
Call this from the subclass. */.
virtual bool acceptRowEdit()
bool shortCutPressed(TQKeyEvent *e, const TQCString &action_name)
virtual void updateRow(int row)
void adjustHorizontalHeaderSize()
bool verticalHeaderVisible() const
virtual void moveToRecordRequested(uint r)
for navigator
virtual void setSpreadSheetMode()
void paintCell(TQPainter *p, KexiTableItem *item, int col, int row, const TQRect &cr, bool print=false)
virtual void addHeaderColumn(const TQString &caption, const TQString &description, const TQIconSet &icon, int size)
virtual int currentLocalSortingOrder() const
virtual int currentLocalSortColumn() const
void setupNavigator()
Setups navigator widget.
virtual void cutSelection()
Cut current selection to a clipboard (e.g. cell)
virtual void startEditCurrentCell(const TQString &setText=TQString())
virtual void updateWidgetContentsSize()
void maximizeColumnsWidth(const TQValueList< int > &columnList)
virtual void removeEditor()
void setFont(const TQFont &f)
virtual void editorShowFocus(int row, int col)
virtual void initDataContents()
virtual void clearVariables()
virtual void paste()
Paste current clipboard contents (e.g. to a cell)
virtual KexiTableItem * insertEmptyRow(int row=-1)
virtual void updateAllVisibleRowsBelow(int row)
virtual int lastVisibleRow() const
virtual void keyPressEvent(TQKeyEvent *e)
void slotColumnWidthChanged(int col, int os, int ns)
updates display after many rows deletion
void adjustColumnWidthToContents(int colNum=-1)
virtual void updateCell(int row, int col)
void setColumnStretchEnabled(bool set, int colNum)
void updateFonts(bool repaint=false)
Internal: updated sched fonts for painting.
virtual bool cancelRowEdit()
virtual TQScrollBar * verticalScrollBar() const
void drawContents(TQPainter *p, int cx, int cy, int cw, int ch)
painting and layout
virtual void reloadData()
bool horizontalHeaderVisible() const
virtual void updateGUIAfterSorting()
void slotTopHeaderSizeChange(int section, int oldSize, int newSize)
internal, used when top header's size changed
int highlightedRow() const
virtual void updateCurrentCell()
void setHighlightedRow(int row)
virtual void deleteCurrentRow()
TQString columnCaption(int colNum) const
bool hasParent(TQObject *par, TQObject *o)
KEXIUTILS_EXPORT TQColor blendedColors(const TQColor &c1, const TQColor &c2, int factor1=1, int factor2=1)