Solve the overlap in Layers&Go extensions entries.
* Bug: In Hurricane::PaletteWidget, flush the normal widgets before reading the position of the Extension entry (from GridBuffer).
This commit is contained in:
parent
d9e124797b
commit
23d6ae55fd
|
@ -62,12 +62,10 @@ namespace Hurricane {
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Class : "CellObserver".
|
// Class : "CellObserver".
|
||||||
|
|
||||||
// void CellObserver::notify ( unsigned int flags )
|
|
||||||
void CellViewer::notify ( CellViewer* viewer, unsigned int flags )
|
void CellViewer::notify ( CellViewer* viewer, unsigned int flags )
|
||||||
{
|
{
|
||||||
cdebug.log(111) << "CellViewer::notify() " << viewer << endl;
|
cdebug.log(19) << "CellViewer::notify() " << viewer << endl;
|
||||||
|
|
||||||
//CellViewer* viewer = getOwner();
|
|
||||||
switch ( flags & (Cell::Flags::CellAboutToChange
|
switch ( flags & (Cell::Flags::CellAboutToChange
|
||||||
|Cell::Flags::CellChanged
|
|Cell::Flags::CellChanged
|
||||||
|Cell::Flags::CellDestroyed) ) {
|
|Cell::Flags::CellDestroyed) ) {
|
||||||
|
|
|
@ -605,7 +605,7 @@ namespace Hurricane {
|
||||||
|
|
||||||
Graphics::getGraphics()->addObserver( &_observer );
|
Graphics::getGraphics()->addObserver( &_observer );
|
||||||
|
|
||||||
resize( Graphics::toHighDpi(600), Graphics::toHighDpi(500) );
|
resize( Graphics::toHighDpi(620), Graphics::toHighDpi(500) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -661,11 +661,9 @@ namespace Hurricane {
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Class : "ControllerWidget::GraphicsObserver".
|
// Class : "ControllerWidget::GraphicsObserver".
|
||||||
|
|
||||||
//void ControllerWidget::GraphicsObserver::notify ( unsigned int flags )
|
|
||||||
void ControllerWidget::notify ( ControllerWidget* controller, unsigned int flags )
|
void ControllerWidget::notify ( ControllerWidget* controller, unsigned int flags )
|
||||||
{
|
{
|
||||||
cdebug.log(111) << "ControllerWidget::notify()" << endl;
|
cdebug.log(19) << "ControllerWidget::notify()" << endl;
|
||||||
//ControllerWidget* controller = getOwner();
|
|
||||||
if (flags & Graphics::ChangedDisplayStyles) {
|
if (flags & Graphics::ChangedDisplayStyles) {
|
||||||
controller->graphicsUpdated();
|
controller->graphicsUpdated();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
PaletteExtensionGoItem* item = new PaletteExtensionGoItem ( name );
|
PaletteExtensionGoItem* item = new PaletteExtensionGoItem ( name );
|
||||||
item->_postCreate ();
|
item->_postCreate ();
|
||||||
|
|
||||||
|
cdebug.log(19) << "PaletteExtensionGoItem::create() - " << name << endl;
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +68,12 @@ namespace Hurricane {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PaletteExtensionGoItem::~PaletteExtensionGoItem ()
|
||||||
|
{
|
||||||
|
cdebug.log(19) << "PaletteExtensionGoItem::~PaletteExtensionGoItem() - " << _name << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Name& PaletteExtensionGoItem::getName () const
|
const Name& PaletteExtensionGoItem::getName () const
|
||||||
{
|
{
|
||||||
return _name;
|
return _name;
|
||||||
|
|
|
@ -43,15 +43,16 @@ namespace {
|
||||||
|
|
||||||
class GridBuffer {
|
class GridBuffer {
|
||||||
public:
|
public:
|
||||||
GridBuffer ( QGridLayout*, size_t rowMax, size_t startRow=0, size_t startColumn=0 );
|
GridBuffer ( QGridLayout*, size_t rowMax, size_t startRow=0, size_t startColumn=0 );
|
||||||
inline int getRow () const;
|
~GridBuffer ();
|
||||||
inline int getColumn () const;
|
inline int getRow () const;
|
||||||
inline int getCurrentRow () const;
|
inline int getColumn () const;
|
||||||
void addSection ( QWidget*, Qt::Alignment align=0 );
|
inline int getCurrentRow () const;
|
||||||
void addWidget ( QWidget*, Qt::Alignment align=0 );
|
void addSection ( QWidget*, Qt::Alignment align=0 );
|
||||||
void newColumn ();
|
void addWidget ( QWidget*, Qt::Alignment align=0 );
|
||||||
void flushWidgets ();
|
void newColumn ();
|
||||||
inline bool columnOverload () const;
|
void flushWidgets ();
|
||||||
|
inline bool columnOverload () const;
|
||||||
protected:
|
protected:
|
||||||
QGridLayout* _grid;
|
QGridLayout* _grid;
|
||||||
size_t _rowMax;
|
size_t _rowMax;
|
||||||
|
@ -66,37 +67,54 @@ namespace {
|
||||||
, size_t maxRow
|
, size_t maxRow
|
||||||
, size_t startRow
|
, size_t startRow
|
||||||
, size_t startColumn )
|
, size_t startColumn )
|
||||||
: _grid (grid)
|
: _grid (grid)
|
||||||
, _rowMax (maxRow)
|
, _rowMax (maxRow)
|
||||||
, _row (startRow)
|
, _row (startRow)
|
||||||
, _column (startColumn)
|
, _column (startColumn)
|
||||||
, _widgets ()
|
, _widgets()
|
||||||
, _aligns ()
|
, _aligns ()
|
||||||
{ }
|
{
|
||||||
|
cdebug.log(19) << "GridBuffer::GridBuffer() column:" << _column << " row:" << _row << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GridBuffer::~GridBuffer ()
|
||||||
|
{
|
||||||
|
cdebug.log(19) << "GridBuffer::~GridBuffer() column:" << _column << " row:" << _row << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline int GridBuffer::getRow () const { return _row; }
|
inline int GridBuffer::getRow () const { return _row; }
|
||||||
inline int GridBuffer::getColumn () const { return _column; }
|
inline int GridBuffer::getColumn () const { return _column; }
|
||||||
inline int GridBuffer::getCurrentRow () const { return _widgets.size() + _row; }
|
inline int GridBuffer::getCurrentRow () const { return _widgets.size() + _row; }
|
||||||
inline bool GridBuffer::columnOverload () const { return getCurrentRow() > (int)_rowMax; }
|
inline bool GridBuffer::columnOverload () const { return getCurrentRow() >= (int)_rowMax; }
|
||||||
|
|
||||||
|
|
||||||
void GridBuffer::flushWidgets ()
|
void GridBuffer::flushWidgets ()
|
||||||
{
|
{
|
||||||
|
cdebug.log(19,1) << "GridBuffer::flushWidgets()" << endl;
|
||||||
|
|
||||||
if ( columnOverload() ) {
|
if ( columnOverload() ) {
|
||||||
_column++;
|
_column++;
|
||||||
_row = 0;
|
_row = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( size_t i=0 ; i < _widgets.size() ; ++i )
|
for ( size_t i=0 ; i < _widgets.size() ; ++i ) {
|
||||||
|
cdebug.log(19) << "add Widget to grid @(" << _column << "," << _row << ")" << endl;
|
||||||
|
|
||||||
_grid->addWidget ( _widgets[i], _row++, _column, _aligns[i] );
|
_grid->addWidget ( _widgets[i], _row++, _column, _aligns[i] );
|
||||||
|
}
|
||||||
_widgets.clear ();
|
_widgets.clear ();
|
||||||
_aligns.clear ();
|
_aligns.clear ();
|
||||||
|
|
||||||
|
cdebug.tabw(19,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GridBuffer::newColumn ()
|
void GridBuffer::newColumn ()
|
||||||
{
|
{
|
||||||
|
cdebug.log(19) << "GridBuffer::newColumn()" << endl;
|
||||||
|
|
||||||
if ( columnOverload() ) return;
|
if ( columnOverload() ) return;
|
||||||
|
|
||||||
flushWidgets ();
|
flushWidgets ();
|
||||||
|
@ -292,21 +310,22 @@ namespace Hurricane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _columnHeight < numeric_limits<size_t>::max() )
|
gridBuffer.flushWidgets ();
|
||||||
gridBuffer.newColumn ();
|
|
||||||
else
|
|
||||||
gridBuffer.flushWidgets ();
|
|
||||||
|
|
||||||
_extensionRow = gridBuffer.getRow();
|
_extensionRow = gridBuffer.getRow();
|
||||||
_extensionColumn = gridBuffer.getColumn();
|
_extensionColumn = gridBuffer.getColumn();
|
||||||
_extensionGroup = _createGroupItem ( "Extensions" );
|
_extensionGroup = _createGroupItem ( "Extensions" );
|
||||||
gridBuffer.addSection ( _extensionGroup, Qt::AlignHCenter );
|
gridBuffer.addSection ( _extensionGroup, Qt::AlignHCenter );
|
||||||
gridBuffer.flushWidgets ();
|
gridBuffer.flushWidgets ();
|
||||||
|
|
||||||
|
cdebug.log(19) << " column:" << _extensionColumn << " row:" << _extensionRow << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PaletteWidget::updateExtensions ( Cell* cell )
|
void PaletteWidget::updateExtensions ( Cell* cell )
|
||||||
{
|
{
|
||||||
|
cdebug.log(19,1) << "PaletteWidget::updateExtensions()" << endl;
|
||||||
|
|
||||||
if (_extensionGroup) {
|
if (_extensionGroup) {
|
||||||
_grid->removeWidget ( _extensionGroup );
|
_grid->removeWidget ( _extensionGroup );
|
||||||
//_extensionGroup->deleteLater ();
|
//_extensionGroup->deleteLater ();
|
||||||
|
@ -322,6 +341,8 @@ namespace Hurricane {
|
||||||
_extensionGoItems.clear ();
|
_extensionGoItems.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cdebug.log(19) << " column:" << _extensionColumn << " row:" << _extensionRow << endl;
|
||||||
|
|
||||||
GridBuffer gridBuffer ( _grid, _columnHeight, _extensionRow, _extensionColumn );
|
GridBuffer gridBuffer ( _grid, _columnHeight, _extensionRow, _extensionColumn );
|
||||||
_extensionGroup = _createGroupItem ( "Extensions" );
|
_extensionGroup = _createGroupItem ( "Extensions" );
|
||||||
gridBuffer.addSection ( _extensionGroup, Qt::AlignHCenter );
|
gridBuffer.addSection ( _extensionGroup, Qt::AlignHCenter );
|
||||||
|
@ -334,6 +355,8 @@ namespace Hurricane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gridBuffer.flushWidgets ();
|
gridBuffer.flushWidgets ();
|
||||||
|
|
||||||
|
cdebug.tabw(19,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace Hurricane {
|
||||||
protected:
|
protected:
|
||||||
PaletteExtensionGoItem ( const Name& );
|
PaletteExtensionGoItem ( const Name& );
|
||||||
PaletteExtensionGoItem ( const PaletteExtensionGoItem& );
|
PaletteExtensionGoItem ( const PaletteExtensionGoItem& );
|
||||||
|
virtual ~PaletteExtensionGoItem ();
|
||||||
PaletteExtensionGoItem& operator= ( const PaletteExtensionGoItem& );
|
PaletteExtensionGoItem& operator= ( const PaletteExtensionGoItem& );
|
||||||
virtual void _postCreate ();
|
virtual void _postCreate ();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue