1 /***************************************************************************
2 * Copyright (C) 2005 by David Cuadrado *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "framestable.h"
24 #include <QPaintEvent>
25 #include <QItemSelectionModel>
26 #include <QPainterPath>
28 #include <QHeaderView>
30 #include <QInputDialog>
31 #include <QApplication>
34 #include <dcore/debug.h>
35 #include <dcore/algorithm.h>
42 ////////// FramesTableItemDelegate ///////////
44 class FramesTableItemDelegate
: public QAbstractItemDelegate
47 FramesTableItemDelegate(QObject
* parent
= 0 );
48 ~FramesTableItemDelegate();
49 virtual void paint ( QPainter
* painter
, const QStyleOptionViewItem
& option
, const QModelIndex
& index
) const;
50 virtual QSize
sizeHint ( const QStyleOptionViewItem
& option
, const QModelIndex
& index
) const;
56 FramesTableItemDelegate::FramesTableItemDelegate(QObject
* parent
) : QAbstractItemDelegate(parent
)
60 FramesTableItemDelegate::~FramesTableItemDelegate()
66 void FramesTableItemDelegate::paint ( QPainter
* painter
, const QStyleOptionViewItem
& option
, const QModelIndex
& index
) const
68 Q_ASSERT(index
.isValid());
70 FramesTable
*table
= qobject_cast
<FramesTable
*>(index
.model()->parent());
71 FramesTableItem
*item
= dynamic_cast<FramesTableItem
*>(table
->itemFromIndex(index
));
74 QStyleOptionViewItem opt
= option
;
76 // draw the background color
77 value
= index
.data( Qt::BackgroundColorRole
);
83 bool sound
= table
->isSoundLayer(index
.row());
87 painter
->fillRect(option
.rect
, value
.value
<QColor
>() );
95 bool sound
= table
->isSoundLayer(index
.row());
96 painter
->setPen(QPen(Qt::lightGray
, 1));
99 if ( index
.column() % 5 == 0 )
101 painter
->setBrush(Qt::lightGray
);
102 painter
->drawRect(option
.rect
); //FIXME: user paleta de colores
106 painter
->setBrush(Qt::white
);
107 painter
->drawRect(option
.rect
);//FIXME: user paleta de color
112 painter
->fillRect(option
.rect
, Qt::white
);
120 int offset
= option
.rect
.width() - 4;
122 if ( item
&& index
.isValid() )
127 painter
->setBrush(Qt::black
);
129 if( !item
->isSound() )
131 QColor color
= Qt::white
; //FIXME: user paleta de color
132 if ( item
->inGroupPosition() == FramesTableItem::Begin
)
134 painter
->fillRect(option
.rect
, color
);
135 painter
->drawLine(option
.rect
.topLeft(), option
.rect
.bottomLeft());
136 painter
->drawEllipse(option
.rect
.left()+2, option
.rect
.bottom() - (offset
+2), offset
, offset
);
138 else if ( item
->inGroupPosition() == FramesTableItem::End
)
140 painter
->fillRect(option
.rect
, color
);
141 painter
->drawLine(option
.rect
.topRight(), option
.rect
.bottomRight());
143 else if( item
->inGroupPosition() == FramesTableItem::Intermediate
)
145 painter
->fillRect(option
.rect
, color
);
149 painter
->drawEllipse(option
.rect
.left()+2, option
.rect
.bottom() - (offset
+2), offset
, offset
);
154 painter
->setPen(QPen(Qt::blue
, 1));
156 int y
= option
.rect
.center().y();
157 int xi
= option
.rect
.x();
158 int xf
= option
.rect
.width();
160 painter
->drawLine(QPoint(xi
, y
) , QPoint(xf
, y
));
166 if ( item
->isLocked() )
169 painter
->setBrush(Qt::red
);
171 painter
->drawEllipse(option
.rect
.left()+2, option
.rect
.bottom() - (offset
+2), offset
, offset
);
178 if (option
.showDecorationSelected
&& (option
.state
& QStyle::State_Selected
))
180 QPalette::ColorGroup cg
= option
.state
& QStyle::State_Enabled
? QPalette::Normal
: QPalette::Disabled
;
183 painter
->setPen(QPen(option
.palette
.brush(cg
, QPalette::Highlight
), 2));
185 QRectF rectSelection
= option
.rect
.adjusted(1,1,-1,-1);
186 painter
->drawRect(rectSelection
);
191 QPalette::ColorGroup cg
= option
.state
& QStyle::State_Enabled
? QPalette::Normal
: QPalette::Disabled
;
192 painter
->setPen(QPen(option
.palette
.brush(cg
, QPalette::Foreground
), 1)),
194 painter
->drawLine(option
.rect
.bottomLeft(), option
.rect
.bottomRight());
195 painter
->drawLine(option
.rect
.topLeft(), option
.rect
.topRight());
199 QSize
FramesTableItemDelegate::sizeHint ( const QStyleOptionViewItem
& option
, const QModelIndex
& index
) const
201 Q_ASSERT(index
.isValid());
202 const QAbstractItemModel
*model
= index
.model();
205 QVariant value
= model
->data(index
, Qt::FontRole
);
206 QFont fnt
= value
.isValid() ? qvariant_cast
<QFont
>(value
) : option
.font
;
207 QString text
= model
->data(index
, Qt::DisplayRole
).toString();
209 if (model
->data(index
, Qt::DecorationRole
).isValid())
210 pixmapRect
= QRect(0, 0, option
.decorationSize
.width(),
211 option
.decorationSize
.height());
213 QFontMetrics
fontMetrics(fnt
);
215 return (pixmapRect
).size();
219 ////////// FramesTableItem ////////
221 FramesTableItem::FramesTableItem()
225 FramesTableItem::~FramesTableItem()
230 bool FramesTableItem::isUsed()
232 return data(IsUsed
).toBool();
235 bool FramesTableItem::isLocked()
237 return data(IsLocked
).toBool();
240 bool FramesTableItem::isVisible()
242 return data(IsVisible
).toBool();
245 bool FramesTableItem::isSound()
247 QVariant data
= this->data(IsSound
);
249 if( data
.canConvert
<bool>() )
251 return data
.toBool();
256 bool FramesTableItem::isClone()
258 QVariant data
= this->data(IsClone
);
260 if( data
.canConvert
<bool>() )
262 return data
.toBool();
267 FramesTableItem::InGroupPositionType
FramesTableItem::inGroupPosition()
269 QVariant data
= this->data(InGroupPosition
);
271 if( data
.canConvert
<int>() )
273 return InGroupPositionType(data
.toInt());
281 struct FramesTable::Private
285 LayerItem() : lastItem(-1), sound(false) {};
291 void swapItem( QTableWidgetItem
*it
, QTableWidgetItem
*nextIt
)
293 QVariant data
= it
->data(FramesTableItem::IsUsed
);
295 it
->setData(FramesTableItem::IsUsed
, nextIt
->data(FramesTableItem::IsUsed
).toBool() );
296 nextIt
->setData(FramesTableItem::IsUsed
, data
);
298 data
= it
->data(FramesTableItem::IsLocked
);
299 it
->setData(FramesTableItem::IsLocked
, nextIt
->data(FramesTableItem::IsLocked
).toBool());
300 nextIt
->setData(FramesTableItem::IsLocked
, data
);
303 data
= it
->data(FramesTableItem::IsVisible
);
304 it
->setData(FramesTableItem::IsVisible
, nextIt
->data(FramesTableItem::IsVisible
).toBool());
305 nextIt
->setData(FramesTableItem::IsVisible
, data
);
307 data
= it
->data(FramesTableItem::IsSound
);
308 it
->setData(FramesTableItem::IsSound
, nextIt
->data(FramesTableItem::IsSound
).toBool());
309 nextIt
->setData(FramesTableItem::IsSound
, data
);
311 data
= it
->data(FramesTableItem::InGroupPosition
);
312 it
->setData(FramesTableItem::InGroupPosition
, nextIt
->data(FramesTableItem::InGroupPosition
));
313 nextIt
->setData(FramesTableItem::InGroupPosition
, data
);
317 int groupSize(FramesTable
*table
, int layer
, int beginFrame
)
319 QTableWidgetItem
*item
= table
->item(layer
, beginFrame
);
328 dfDebug
<< "begin Frame " << beginFrame
<< " type " << item
->data(FramesTableItem::InGroupPosition
).toInt();
330 if(item
->data(FramesTableItem::InGroupPosition
).toInt() == FramesTableItem::Begin
)
332 while(item
&& item
->data(FramesTableItem::InGroupPosition
).toInt() != FramesTableItem::End
)
335 item
= table
->item(layer
, beginFrame
+count
);
342 int rectWidth
, rectHeight
;
343 QList
<LayerItem
> layers
;
350 ToggleFrameVisibility
,
363 FramesTable::FramesTable(QWidget
*parent
) : QTableWidget(0, 100, parent
), d(new Private
)
365 d
->ruler
= new TLRuler
;
373 FramesTable::~FramesTable()
381 void FramesTable::setup()
383 setItemDelegate( new FramesTableItemDelegate(this) );
385 setSelectionBehavior(QAbstractItemView::SelectItems
);
386 setSelectionMode (QAbstractItemView::SingleSelection
);
388 setHorizontalHeader(d
->ruler
);
390 connect(d
->ruler
, SIGNAL(logicalSectionSelected( int )), this, SLOT(emitFrameSelected( int )));
391 // connect(this, SIGNAL(currentItemChanged( QTableWidgetItem *, QTableWidgetItem *)), this, SLOT(emitFrameSelected(QTableWidgetItem *, QTableWidgetItem *)));
392 verticalHeader()->hide();
395 connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(onItemSelectionChanged()));
397 connect( this, SIGNAL(cellDoubleClicked ( int , int )), this, SLOT(onCellDoubleClicked(int, int)));
399 setItemSize( 10, 25 );
401 horizontalHeader()->setResizeMode(QHeaderView::Custom
);
402 verticalHeader()->setResizeMode(QHeaderView::Custom
);
405 setSelectionMode(QAbstractItemView::ContiguousSelection
);
412 void FramesTable::emitFrameSelected(int col
)
416 FramesTableItem
*item
= dynamic_cast<FramesTableItem
*>(this->item(currentRow(), col
));
422 emit
frameSelected(visualRow(this->row(item
)), visualColumn(this->column(item
)));
430 void FramesTable::onItemSelectionChanged()
432 FramesTableItem
*item
= dynamic_cast<FramesTableItem
*>(currentItem());
437 emit
frameSelected(visualRow(this->row(item
)), visualColumn(this->column(item
)));
442 emit
layerSelected(visualRow(currentRow()));
448 * Función sobrecargada para la implementación del menú contextual.
450 void FramesTable::mousePressEvent ( QMouseEvent
* event
)
453 QTableWidget::mousePressEvent(event
);
454 if(event
->buttons() == Qt::RightButton
)
456 QMenu
*menu
= new QMenu(tr("Frames"), this);
458 FramesTableItem
*item
= dynamic_cast<FramesTableItem
*>(currentItem());
460 menu
->addAction( tr("Insert frame"))->setData(Private::InsertFrame
);
466 menu
->addAction( tr("Remove frame"))->setData(Private::RemoveFrame
);
467 menu
->addAction( tr("Expand this frame"))->setData(Private::ExpandFrame
);
468 menu
->addSeparator();
469 menu
->addAction(tr("Copy frame"))->setData(Private::CopyFrame
);
471 menu
->addAction(tr("Cut frame"))->setData(Private::CutFrame
);
475 menu
->addSeparator();
479 if(const QMimeData
*mimeData
= QApplication::clipboard()->mimeData())
481 if(mimeData
->hasFormat("yamf-frame"))
483 menu
->addAction( tr("Paste frame"))->setData(Private::PasteFrame
);
484 menu
->addSeparator();
490 if( item
->isLocked())
492 menu
->addAction( tr("Unlock this frame"))->setData(Private::ToggleLockFrame
);
496 menu
->addAction( tr("Lock this frame"))->setData(Private::ToggleLockFrame
);
499 if(item
->isVisible())
501 menu
->addAction( tr("Hide this frame"))->setData(Private::ToggleFrameVisibility
);
505 menu
->addAction( tr("Show this frame"))->setData(Private::ToggleFrameVisibility
);
509 connect(menu
, SIGNAL(triggered(QAction
*)), this, SLOT(onMenuActionTriggered(QAction
* )));
511 menu
->exec( event
->globalPos() );
518 void FramesTable::onCellDoubleClicked(int row
, int column
)
520 row
= visualRow(row
);
521 if( lastFrameByLayer(row
)+1 == column
)
523 emit
requestInsertFrame(row
, column
);
530 void FramesTable::onMenuActionTriggered(QAction
* action
)
532 int layerPos
= visualRow(currentRow());
533 int framePos
= visualColumn(currentColumn());
535 switch(action
->data().toInt())
537 case Private::InsertFrame
:
539 FramesTableItem
*item
= dynamic_cast<FramesTableItem
*>(currentItem());
544 emit
requestInsertFrame(layerPos
, framePos
+1);
549 emit
requestInsertFrame(layerPos
, framePos
);
554 case Private::RemoveFrame
:
556 emit
requestRemoveFrame(layerPos
, framePos
);
559 case Private::CopyFrame
:
561 emit
requestCopyFrame(layerPos
, framePos
);
564 case Private::PasteFrame
:
566 emit
requestPasteFrame(layerPos
, framePos
);
569 case Private::CutFrame
:
571 emit
requestCutFrame(layerPos
, framePos
);
574 case Private::ToggleLockFrame
:
576 FramesTableItem
*item
= dynamic_cast<FramesTableItem
*>(currentItem());
579 emit
requestLockFrame(layerPos
, framePos
, !item
->isLocked());
583 case Private::ToggleFrameVisibility
:
585 FramesTableItem
*item
= dynamic_cast<FramesTableItem
*>(currentItem());
588 emit
requestChangeFrameVisibility(layerPos
, framePos
, !item
->isVisible());
592 case Private::ExpandFrame
:
594 FramesTableItem
*item
= dynamic_cast<FramesTableItem
*>(currentItem());
598 int size
= QInputDialog::getInteger ( 0, tr("Expand frame"), tr("number of frames to enlarge this frame?"), 1, 1, 2000, 1, &ok
);
601 emit
requestExpandFrame(layerPos
, framePos
, size
);
611 * Cambia el tamaño de los frames.
613 void FramesTable::setItemSize(int w
, int h
)
623 * Extiende el largo de un frame, para permitir la realimentación gráfica de la expansión del tiempo de un frame.
625 void FramesTable::expandFrame( int layerPosition
, int position
, int size
)
627 groupFrames( layerPosition
, position
, position
+size
);
629 for(int i
= position
; i
< position
+size
; i
++)
631 QTableWidgetItem
*item
= this->item(layerPosition
, i
);
632 item
->setData(FramesTableItem::IsClone
, true);
639 * Agrupa los frames de la posición @p from a la @p to del layer, para permitir la realimentación gráfica de la agrupación de un conjunto de frames.
641 void FramesTable::groupFrames( int layerPosition
, int from
, int to
)
643 for(int i
= from
+1; i
<= to
; i
++)
645 QTableWidgetItem
*item
= this->item(layerPosition
, i
);
649 item
->setData(FramesTableItem::InGroupPosition
, QVariant( FramesTableItem::Intermediate
));
653 QTableWidgetItem
*begin
= this->item(layerPosition
, from
);
657 begin
->setData(FramesTableItem::InGroupPosition
,QVariant(FramesTableItem::Begin
));
660 QTableWidgetItem
*end
= this->item(layerPosition
, to
);
664 QTableWidgetItem
*nextEnd
= this->item(layerPosition
, to
+1);
668 if(nextEnd
->data(FramesTableItem::InGroupPosition
).toInt() != FramesTableItem::None
|| nextEnd
->data(FramesTableItem::InGroupPosition
).toInt() != FramesTableItem::Begin
)
670 end
->setData(FramesTableItem::InGroupPosition
, QVariant(FramesTableItem::Intermediate
));
671 viewport()->update();
675 end
->setData(FramesTableItem::InGroupPosition
, QVariant(FramesTableItem::End
));
678 viewport()->update();
683 * Destruye el grupo de frames que esta en la posición @p position del layer @p layerPosition, para permitir la realimentación gráfica de la destrucción de un conjunto de frames.
685 void FramesTable::destroyGroupFrames(int layerPosition
, int position
, int size
)
687 for(int i
= position
; i
<= position
+size
; i
++)
689 QTableWidgetItem
*item
= this->item(layerPosition
, i
);
693 item
->setData(FramesTableItem::InGroupPosition
, QVariant( FramesTableItem::None
));
694 item
->setData(FramesTableItem::IsClone
, false);
701 * Retorna verdadero si el layer en la posición @p row es de sonido, falso de lo contrario.
703 bool FramesTable::isSoundLayer(int row
)
705 if( row
< 0 && row
>= d
->layers
.count() )
708 return d
->layers
[row
].sound
;
713 * Inserta un layer en la posición @p pos con el nombre @p name, permitiendo la realimentación gráfica de la inserción de un layer.
715 void FramesTable::insertLayer(int pos
, const QString
&name
)
720 Private::LayerItem layer
;
722 d
->layers
.insert(pos
, layer
);
729 * Inserta un layer de sonido en la posicion @p pos con el nombre @p name. permitiendo la realimentación gráfica de la inserción de un layer de sonido.
731 void FramesTable::insertSoundLayer(int layerPos
, const QString
&name
)
736 Private::LayerItem layer
;
738 d
->layers
.insert(layerPos
, layer
);
745 * Elimina el layer seleccionado actualmente, permitiendo la realimentación gráfica de la eliminación del layer actual.
747 void FramesTable::removeCurrentLayer()
749 int pos
= verticalHeader()->logicalIndex(currentRow());
755 * Elimina el layer de la posición @p pos, permitiendo la realimentación gráfica de la eliminación de un layer.
757 void FramesTable::removeLayer(int pos
)
759 pos
= verticalHeader()->logicalIndex(pos
);
761 d
->layers
.removeAt(pos
);
766 * Mueve el layer de la posición @p position a la posición @p newPosition.
768 void FramesTable::moveLayer(int position
, int newPosition
)
770 if ( position
< 0 || position
>= rowCount() || newPosition
< 0 || newPosition
>= rowCount() ) return;
774 verticalHeader()->moveSection(position
, newPosition
);
781 * Obtiene la posición del ultimo frame del layer que esta en la posición @p layerPos.
783 int FramesTable::lastFrameByLayer(int layerPos
)
785 int pos
= verticalHeader()->logicalIndex(layerPos
);
786 if ( pos
< 0 || pos
> d
->layers
.count() )
790 return d
->layers
[pos
].lastItem
;
797 * Añade un frame al layer de la posicion @p layerPos, con el nombre @p name.
799 void FramesTable::addFrame(int layerPos
, const QString
&name
)
802 if ( layerPos
< 0 || layerPos
>= d
->layers
.count() ) return;
804 insertFrame(layerPos
, lastFrameByLayer(verticalHeader()->logicalIndex(layerPos
))+1, name
) ;
809 * Inserta un frame en la posición @p framePos del layer @p layerPos, con el nombre @p name.
811 void FramesTable::insertFrame(int layerPos
, int framePos
, const QString
&name
)
815 if ( layerPos
< 0 || layerPos
>= d
->layers
.count() ) return;
817 layerPos
= verticalHeader()->logicalIndex(layerPos
);
819 d
->layers
[layerPos
].lastItem
++;
821 int position
= framePos
;
823 if(!d
->layers
[layerPos
].sound
)
825 position
= d
->layers
[layerPos
].lastItem
;
828 setAttribute( layerPos
, position
, FramesTableItem::IsUsed
, true);
829 setAttribute( layerPos
, position
, FramesTableItem::IsVisible
, true);
830 setAttribute( layerPos
, position
, FramesTableItem::IsSound
, d
->layers
[layerPos
].sound
);
831 item( layerPos
, position
)->setData(FramesTableItem::InGroupPosition
, FramesTableItem::None
);
833 if(!d
->layers
[layerPos
].sound
)
835 moveFrame(layerPos
, position
, framePos
);
837 if ( d
->layers
[layerPos
].lastItem
>= columnCount()-1 )
839 setColumnCount( d
->layers
[layerPos
].lastItem
+50 );
843 viewport()->update();
848 * Selecciona el frame, representado por el ítem @p item.
850 void FramesTable::setCurrentFrame(FramesTableItem
*item
)
852 setCurrentItem(item
);
857 * Selecciona el layer de la posición @p layerPos.
859 void FramesTable::setCurrentLayer(int layerPos
)
861 setCurrentItem(item(verticalHeader()->logicalIndex(layerPos
), 0));
866 * Selecciona el frame la posición @p index del layer actual.
868 void FramesTable::selectFrame(int index
)
870 setCurrentItem( item( currentRow(), index
) );
875 * Remueve el frame que esta en la posición @p position del layer @p layerPos.
877 void FramesTable::removeFrame(int layerPos
, int position
)
879 if ( layerPos
< 0 || layerPos
>= d
->layers
.count() )
884 QTableWidgetItem
*it
= this->item(layerPos
, position
);
886 moveFrame(layerPos
, position
, d
->layers
[layerPos
].lastItem
);
888 QTableWidgetItem
*toRemove
= takeItem(layerPos
, d
->layers
[layerPos
].lastItem
);
890 int type
= toRemove
->data(FramesTableItem::InGroupPosition
).toInt();
892 if(type
== FramesTableItem::Begin
)
894 it
= item(layerPos
, position
);
898 if(it
->data(FramesTableItem::InGroupPosition
).toInt() == FramesTableItem::Intermediate
)
900 it
->setData(FramesTableItem::InGroupPosition
, toRemove
->data(FramesTableItem::InGroupPosition
));
902 else if(it
->data(FramesTableItem::InGroupPosition
).toInt() == FramesTableItem::End
)
904 it
->setData(FramesTableItem::InGroupPosition
, FramesTableItem::None
);
905 it
->setData(FramesTableItem::IsClone
, false);
909 else if(toRemove
->data(FramesTableItem::InGroupPosition
).toInt() == FramesTableItem::End
)
911 it
= item(layerPos
, position
);
914 if(it
->data(FramesTableItem::InGroupPosition
).toInt() == FramesTableItem::Begin
)
916 it
->setData(FramesTableItem::InGroupPosition
, FramesTableItem::None
);
925 d
->layers
[layerPos
].lastItem
--;
927 viewport()->update( visualRect(indexFromItem(item(layerPos
, position
) )) );
928 viewport()->update();
933 * Mueve el frame de la posición @p from a la posición @p to dentro del layer @p layerPos.
935 void FramesTable::moveFrame(int layerPos
, int from
, int to
)
942 layerPos
= verticalHeader()->logicalIndex(layerPos
);
946 int fromSize
= d
->groupSize(this, layerPos
, from
);
947 int toSize
= d
->groupSize(this, layerPos
, to
);
949 for(int i
= 0; i
< fromSize
; i
++)
951 for(int index
= from
; index
< to
+toSize
-1; index
++ )
953 QTableWidgetItem
*it
= item(layerPos
, index
);
954 QTableWidgetItem
*nextIt
= item(layerPos
, index
+1);
957 d
->swapItem(it
, nextIt
);
964 int fromSize
= d
->groupSize(this, layerPos
, from
);
965 int toSize
= d
->groupSize(this, layerPos
, to
);
968 for(int i
= 0; i
< fromSize
; i
++)
970 for(int index
= from
+i
; index
> to
+i
; index
-- )
972 QTableWidgetItem
*it
= item(layerPos
, index
);
973 QTableWidgetItem
*nextIt
= item(layerPos
, index
-1);
976 d
->swapItem(it
, nextIt
);
982 viewport()->update();
987 * Actualiza el estado de bloqueo del frame que esta en la posición @p postín del layer @p layerPos al valor de @p locked.
989 void FramesTable::lockFrame(int layerPos
, int position
, bool locked
)
991 if ( layerPos
< 0 || layerPos
>= d
->layers
.count() )
996 layerPos
= verticalHeader()->logicalIndex(layerPos
);
998 setAttribute( layerPos
, position
, FramesTableItem::IsLocked
, locked
);
1000 viewport()->update();
1005 * Actualiza el estado de visibilidad del frame que esta en la posición @p position del layer @p layerPosition a el valor de @p isVisible.
1007 void FramesTable::setFrameVisibility(int layerPosition
, int position
, bool isVisible
)
1009 if ( layerPosition
< 0 || layerPosition
>= d
->layers
.count() )
1014 layerPosition
= verticalHeader()->logicalIndex(layerPosition
);
1016 setAttribute( layerPosition
, position
, FramesTableItem::IsVisible
, isVisible
);
1018 viewport()->update();
1023 * Modifica el estado de un frame.
1025 void FramesTable::setAttribute(int row
, int col
, FramesTableItem::Attributes att
, bool value
)
1027 QTableWidgetItem
*item
= this->item(row
, col
);
1031 item
= new FramesTableItem
;
1032 setItem(row
, col
, item
);
1035 item
->setData(att
, value
);
1040 * Arregla los tamaños de los frames mostrados en la tabla.
1042 void FramesTable::fixSize()
1044 for(int column
= 0; column
< columnCount(); column
++)
1046 horizontalHeader()->resizeSection(column
, d
->rectWidth
);
1048 for( int row
= 0; row
< rowCount(); row
++)
1050 verticalHeader()->resizeSection(row
, d
->rectHeight
);