int QHeaderView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractItemView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 21)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 21;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isSortIndicatorShown(); break;
        case 1: *reinterpret_cast< bool*>(_v) = highlightSections(); break;
        case 2: *reinterpret_cast< bool*>(_v) = stretchLastSection(); break;
        case 3: *reinterpret_cast< bool*>(_v) = cascadingSectionResizes(); break;
        case 4: *reinterpret_cast< int*>(_v) = defaultSectionSize(); break;
        case 5: *reinterpret_cast< int*>(_v) = minimumSectionSize(); break;
        case 6: *reinterpret_cast< Qt::Alignment*>(_v) = defaultAlignment(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setSortIndicatorShown(*reinterpret_cast< bool*>(_v)); break;
        case 1: setHighlightSections(*reinterpret_cast< bool*>(_v)); break;
        case 2: setStretchLastSection(*reinterpret_cast< bool*>(_v)); break;
        case 3: setCascadingSectionResizes(*reinterpret_cast< bool*>(_v)); break;
        case 4: setDefaultSectionSize(*reinterpret_cast< int*>(_v)); break;
        case 5: setMinimumSectionSize(*reinterpret_cast< int*>(_v)); break;
        case 6: setDefaultAlignment(*reinterpret_cast< Qt::Alignment*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
QxtScheduleHeaderWidget::QxtScheduleHeaderWidget(Qt::Orientation orientation , QxtScheduleView *parent) : QHeaderView(orientation, parent)
{
    QxtScheduleViewHeaderModel *model = new QxtScheduleViewHeaderModel(this);
    setModel(model);
    if (parent)
    {
        model->setDataSource(parent);
    }
    if (Qt::Vertical == orientation)
    {
        setDefaultSectionSize(40);
        setResizeMode(QHeaderView::Fixed);
        qDebug() << "default section size " << defaultSectionSize();
    }
}
Beispiel #3
0
EvalWidget::EvalWidget(QWidget *parent)
	: QWidget(parent),
	  m_player(nullptr),
	  m_statsTable(new QTableWidget(1, 5, this)),
	  m_pvTable(new QTableWidget(0, 5, this)),
	  m_depth(-1)
{
	m_statsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
	auto hHeader = m_statsTable->horizontalHeader();
	auto vHeader = m_statsTable->verticalHeader();
	vHeader->hide();
	int maxHeight = hHeader->sizeHint().height() + vHeader->defaultSectionSize();
	m_statsTable->setMaximumHeight(maxHeight);

	QStringList statsHeaders;
	statsHeaders << tr("NPS") << tr("Hash")
		     << tr("Pondermove") << tr("Ponderhit") << tr("TB");
	m_statsTable->setHorizontalHeaderLabels(statsHeaders);
	hHeader->setSectionResizeMode(QHeaderView::Stretch);
	auto protoItem = new QTableWidgetItem;
	protoItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignRight);
	m_statsTable->setItemPrototype(protoItem);

	m_pvTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
	m_pvTable->verticalHeader()->hide();

	QStringList pvHeaders;
	pvHeaders << tr("Depth") << tr("Time") << tr("Nodes")
		  << tr("Score") << tr("PV");
	m_pvTable->setHorizontalHeaderLabels(pvHeaders);
	m_pvTable->setColumnWidth(0, 60);
	m_pvTable->setColumnWidth(1, 60);
	m_pvTable->setColumnWidth(2, 100);
	m_pvTable->setColumnWidth(3, 60);
	m_pvTable->horizontalHeader()->setStretchLastSection(true);

	QVBoxLayout* layout = new QVBoxLayout();
	layout->addWidget(m_statsTable);
	layout->addWidget(m_pvTable);
	layout->setContentsMargins(0, 0, 0, 0);
	setLayout(layout);
}