Fix bug & compatibility issues with Qt 5.
* Bug: In Hurricane, in NetlistWidget CTOR, the horizontal header was set up assuing that there was (at least) three sections (column) in the model, which was wrong. Now it is done in the setCell() method which know the exact number of sections. It was a bug in both Qt 4 & 5, but was showing only under Qt 5.
This commit is contained in:
parent
675e20867b
commit
f7e981a840
|
@ -55,8 +55,13 @@ namespace CRL {
|
|||
//_view->resizeColumnToContents ( 1 );
|
||||
|
||||
QHeaderView* horizontalHeader = _view->horizontalHeader();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
horizontalHeader->setSectionResizeMode ( 0, QHeaderView::Stretch );
|
||||
horizontalHeader->setSectionResizeMode ( 1, QHeaderView::ResizeToContents );
|
||||
#else
|
||||
horizontalHeader->setResizeMode ( 0, QHeaderView::Stretch );
|
||||
horizontalHeader->setResizeMode ( 1, QHeaderView::ResizeToContents );
|
||||
#endif
|
||||
//horizontalHeader->setStretchLastSection( false );
|
||||
|
||||
QHeaderView* verticalHeader = _view->verticalHeader();
|
||||
|
|
|
@ -65,8 +65,13 @@ namespace Hurricane {
|
|||
QHeaderView* horizontalHeader = _view->header();
|
||||
horizontalHeader->setDefaultAlignment ( Qt::AlignHCenter );
|
||||
horizontalHeader->setMinimumSectionSize( (Graphics::isHighDpi()) ? 600 : 300 );
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
horizontalHeader->setResizeMode ( 0, QHeaderView::Interactive );
|
||||
horizontalHeader->setResizeMode ( 1, QHeaderView::Interactive );
|
||||
// #else
|
||||
// horizontalHeader->setSectionResizeMode ( 0, QHeaderView::Interactive );
|
||||
// horizontalHeader->setSectionResizeMode ( 1, QHeaderView::Interactive );
|
||||
#endif
|
||||
horizontalHeader->setStretchLastSection( true );
|
||||
|
||||
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this);
|
||||
|
@ -219,7 +224,8 @@ namespace Hurricane {
|
|||
{
|
||||
if (delta == 0) return;
|
||||
|
||||
QModelIndex newIndex = _baseModel->index( _view->currentIndex().row()+delta, 0, QModelIndex() );
|
||||
//QModelIndex newIndex =
|
||||
_baseModel->index( _view->currentIndex().row()+delta, 0, QModelIndex() );
|
||||
|
||||
//if (newIndex.isValid())
|
||||
// _view->selectRow( newIndex.row() );
|
||||
|
|
|
@ -71,9 +71,6 @@ namespace Hurricane {
|
|||
QHeaderView* horizontalHeader = _view->horizontalHeader();
|
||||
horizontalHeader->setDefaultAlignment ( Qt::AlignHCenter );
|
||||
horizontalHeader->setMinimumSectionSize( (Graphics::isHighDpi()) ? 300 : 150 );
|
||||
horizontalHeader->setResizeMode ( 0, QHeaderView::Interactive );
|
||||
horizontalHeader->setResizeMode ( 1, QHeaderView::Interactive );
|
||||
horizontalHeader->setResizeMode ( 2, QHeaderView::Interactive );
|
||||
horizontalHeader->setStretchLastSection( true );
|
||||
|
||||
QHeaderView* verticalHeader = _view->verticalHeader();
|
||||
|
|
|
@ -66,8 +66,9 @@ namespace Hurricane {
|
|||
|
||||
inline void HierarchyModel::setCell ( Cell* cell )
|
||||
{
|
||||
beginResetModel();
|
||||
_root.setCell( cell );
|
||||
reset();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -66,17 +66,14 @@ namespace Hurricane {
|
|||
template<typename InformationType>
|
||||
void NetlistModel::setCell ( Cell* cell )
|
||||
{
|
||||
if ( _cell != cell ) {
|
||||
if ( _cell )
|
||||
delete _netlist;
|
||||
if (_cell != cell) {
|
||||
if (_cell) delete _netlist;
|
||||
|
||||
_cell = cell;
|
||||
_netlist = new NetInformationsVector<InformationType>();
|
||||
|
||||
if ( _cell ) {
|
||||
forEach ( Net*, net, _cell->getNets() ) {
|
||||
_netlist->addNet ( *net );
|
||||
}
|
||||
if (_cell) {
|
||||
for ( Net* net : _cell->getNets() ) _netlist->addNet( net );
|
||||
}
|
||||
|
||||
emit layoutChanged ();
|
||||
|
@ -84,7 +81,6 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __NETLIST_MODEL_H__
|
||||
#endif // HURRICANE_NETLIST_MODEL_H
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
#ifndef HURRICANE_NETLIST_WIDGET_H
|
||||
#define HURRICANE_NETLIST_WIDGET_H
|
||||
|
||||
|
||||
#include <set>
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include <QHeaderView>
|
||||
#include <QItemDelegate>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "hurricane/Commons.h"
|
||||
|
@ -187,9 +187,17 @@ namespace Hurricane {
|
|||
string windowTitle = "Netlist" + getString(cell);
|
||||
setWindowTitle( tr(windowTitle.c_str()) );
|
||||
|
||||
QHeaderView* header = _view->horizontalHeader();
|
||||
|
||||
_view->selectRow( 0 );
|
||||
for ( int i=0 ; i<_baseModel->columnCount() ; ++i )
|
||||
for ( int i=0 ; i<_baseModel->columnCount() ; ++i ) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
header->setSectionResizeMode( i, QHeaderView::Interactive );
|
||||
#else
|
||||
header->setResizeMode( i, QHeaderView::Interactive );
|
||||
#endif
|
||||
_view->resizeColumnToContents( i );
|
||||
}
|
||||
_view->setVisible( true );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue