* ./hurricane/src/viewer:
- Bug: In NetlistWidget/NetlistModel, suppress the "forceRowHeight()" method which was terribly slowing down the table display. Instead uses the "setDefaultSectionSize()" of the vertical header to setup the row height (much more compact display). - Bug: In NetlistModel, strangely, although we have a "data()" and a "headerData()" method, the "data()" is also called for the headers potentially erasing any previous setting done with "headerData()". This was occuring for the fonts settings. Don't known if it is a bug or a feature of Qt... - Thoses changes has to be ported to the others widgets some times...
This commit is contained in:
parent
b50b492b69
commit
d55da89955
|
@ -74,11 +74,11 @@ namespace Hurricane {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QFont Graphics::getFixedFont ( int weight, bool italic, bool underline )
|
const QFont Graphics::getFixedFont ( int weight, bool italic, bool underline, int scale )
|
||||||
{
|
{
|
||||||
const QFont defaultFont = QApplication::font ();
|
const QFont defaultFont = QApplication::font ();
|
||||||
|
|
||||||
QFont fixedFont ( "Bitstream Vera Sans Mono", defaultFont.pointSize() );
|
QFont fixedFont ( "Bitstream Vera Sans Mono", defaultFont.pointSize()+scale );
|
||||||
fixedFont.setWeight ( weight );
|
fixedFont.setWeight ( weight );
|
||||||
fixedFont.setItalic ( italic );
|
fixedFont.setItalic ( italic );
|
||||||
fixedFont.setUnderline ( underline );
|
fixedFont.setUnderline ( underline );
|
||||||
|
|
|
@ -63,10 +63,12 @@ namespace Hurricane {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( role == Qt::FontRole ) {
|
if ( role == Qt::FontRole ) {
|
||||||
|
if ( index.row() == 0 ) return QVariant();
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case 0: return nameFont;
|
case 0: return nameFont;
|
||||||
default: return valueFont;
|
default: return valueFont;
|
||||||
}
|
}
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !index.isValid() ) return QVariant ();
|
if ( !index.isValid() ) return QVariant ();
|
||||||
|
@ -83,10 +85,14 @@ namespace Hurricane {
|
||||||
, Qt::Orientation orientation
|
, Qt::Orientation orientation
|
||||||
, int role ) const
|
, int role ) const
|
||||||
{
|
{
|
||||||
if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) )
|
if ( orientation == Qt::Vertical ) return QVariant();
|
||||||
return QVariant();
|
|
||||||
|
|
||||||
if ( !_netlist ) {
|
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +2 );
|
||||||
|
|
||||||
|
if ( role == Qt::FontRole ) return headerFont;
|
||||||
|
if ( role != Qt::DisplayRole ) return QVariant();
|
||||||
|
|
||||||
|
if ( not _netlist ) {
|
||||||
if ( section == 0 ) return QVariant("Net");
|
if ( section == 0 ) return QVariant("Net");
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,12 +72,11 @@ namespace Hurricane {
|
||||||
_sortModel->setDynamicSortFilter ( true );
|
_sortModel->setDynamicSortFilter ( true );
|
||||||
_sortModel->setFilterKeyColumn ( 0 );
|
_sortModel->setFilterKeyColumn ( 0 );
|
||||||
|
|
||||||
_view->setShowGrid(false);
|
_view->setShowGrid ( false );
|
||||||
_view->setAlternatingRowColors(true);
|
_view->setAlternatingRowColors ( true );
|
||||||
_view->setSelectionBehavior(QAbstractItemView::SelectRows);
|
_view->setSelectionBehavior ( QAbstractItemView::SelectRows );
|
||||||
_view->setSortingEnabled(true);
|
_view->setSortingEnabled ( true );
|
||||||
_view->setModel ( _sortModel );
|
_view->setModel ( _sortModel );
|
||||||
_view->horizontalHeader()->setStretchLastSection ( true );
|
|
||||||
|
|
||||||
QHeaderView* horizontalHeader = _view->horizontalHeader ();
|
QHeaderView* horizontalHeader = _view->horizontalHeader ();
|
||||||
horizontalHeader->setStretchLastSection ( true );
|
horizontalHeader->setStretchLastSection ( true );
|
||||||
|
@ -85,6 +84,16 @@ namespace Hurricane {
|
||||||
|
|
||||||
QHeaderView* verticalHeader = _view->verticalHeader ();
|
QHeaderView* verticalHeader = _view->verticalHeader ();
|
||||||
verticalHeader->setVisible ( false );
|
verticalHeader->setVisible ( false );
|
||||||
|
verticalHeader->setDefaultSectionSize ( _rowHeight );
|
||||||
|
|
||||||
|
// verticalHeader->setStyleSheet( "QHeaderView::section {"
|
||||||
|
// "padding-bottom: 0px;"
|
||||||
|
// "padding-top: 0px;"
|
||||||
|
// "padding-left: 0px;"
|
||||||
|
// "padding-right: 1px;"
|
||||||
|
// "margin: 0px;"
|
||||||
|
// "}"
|
||||||
|
// );
|
||||||
|
|
||||||
_filterPatternLineEdit = new QLineEdit(this);
|
_filterPatternLineEdit = new QLineEdit(this);
|
||||||
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this);
|
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this);
|
||||||
|
@ -106,20 +115,12 @@ namespace Hurricane {
|
||||||
, this , SLOT (textFilterChanged()) );
|
, this , SLOT (textFilterChanged()) );
|
||||||
connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&))
|
connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&))
|
||||||
, this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) );
|
, this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) );
|
||||||
connect ( _baseModel, SIGNAL(layoutChanged()), this, SLOT(forceRowHeight()) );
|
|
||||||
connect ( fitAction , SIGNAL(triggered ()), this, SLOT(fitToNet ()) );
|
connect ( fitAction , SIGNAL(triggered ()), this, SLOT(fitToNet ()) );
|
||||||
|
|
||||||
resize(300, 300);
|
resize(300, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NetlistWidget::forceRowHeight ()
|
|
||||||
{
|
|
||||||
for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- )
|
|
||||||
_view->setRowHeight ( rows, _rowHeight );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void NetlistWidget::goTo ( int delta )
|
void NetlistWidget::goTo ( int delta )
|
||||||
{
|
{
|
||||||
if ( delta == 0 ) return;
|
if ( delta == 0 ) return;
|
||||||
|
@ -187,7 +188,6 @@ namespace Hurricane {
|
||||||
void NetlistWidget::textFilterChanged ()
|
void NetlistWidget::textFilterChanged ()
|
||||||
{
|
{
|
||||||
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
|
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
|
||||||
forceRowHeight ();
|
|
||||||
//updateSelecteds ();
|
//updateSelecteds ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace Hurricane {
|
||||||
// Accessors.
|
// Accessors.
|
||||||
static Graphics* getGraphics ();
|
static Graphics* getGraphics ();
|
||||||
static bool isEnabled ();
|
static bool isEnabled ();
|
||||||
static const QFont getFixedFont ( int weight=QFont::Normal, bool italic=false, bool underline=false );
|
static const QFont getFixedFont ( int weight=QFont::Normal, bool italic=false, bool underline=false, int scale=0 );
|
||||||
static const QFont getNormalFont ( bool bold=false, bool italic=false, bool underline=false );
|
static const QFont getNormalFont ( bool bold=false, bool italic=false, bool underline=false );
|
||||||
static const Name& getGroup ( const Name& key );
|
static const Name& getGroup ( const Name& key );
|
||||||
static QColor getColor ( const Name& key, int darkening=100 );
|
static QColor getColor ( const Name& key, int darkening=100 );
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
|
#include <QItemDelegate>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
#include "hurricane/Commons.h"
|
#include "hurricane/Commons.h"
|
||||||
|
@ -151,8 +152,6 @@ namespace Hurricane {
|
||||||
void netSelected ( const Net* );
|
void netSelected ( const Net* );
|
||||||
void netUnselected ( const Net* );
|
void netUnselected ( const Net* );
|
||||||
void netFitted ( const Net* );
|
void netFitted ( const Net* );
|
||||||
public slots:
|
|
||||||
void forceRowHeight ();
|
|
||||||
private slots:
|
private slots:
|
||||||
void textFilterChanged ();
|
void textFilterChanged ();
|
||||||
void updateSelecteds ( const QItemSelection& , const QItemSelection& );
|
void updateSelecteds ( const QItemSelection& , const QItemSelection& );
|
||||||
|
@ -198,8 +197,6 @@ namespace Hurricane {
|
||||||
setWindowTitle ( tr(windowTitle.c_str()) );
|
setWindowTitle ( tr(windowTitle.c_str()) );
|
||||||
|
|
||||||
int rows = _sortModel->rowCount ();
|
int rows = _sortModel->rowCount ();
|
||||||
for ( rows-- ; rows >= 0 ; rows-- )
|
|
||||||
_view->setRowHeight ( rows, _rowHeight );
|
|
||||||
_view->selectRow ( 0 );
|
_view->selectRow ( 0 );
|
||||||
_view->resizeColumnToContents ( 0 );
|
_view->resizeColumnToContents ( 0 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue