当前位置: 首页>>代码示例>>C++>>正文


C++ QTableWidgetItem::foreground方法代码示例

本文整理汇总了C++中QTableWidgetItem::foreground方法的典型用法代码示例。如果您正苦于以下问题:C++ QTableWidgetItem::foreground方法的具体用法?C++ QTableWidgetItem::foreground怎么用?C++ QTableWidgetItem::foreground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTableWidgetItem的用法示例。


在下文中一共展示了QTableWidgetItem::foreground方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: foreground

 int TableWidgetItem::foreground ( lua_State * L ) // const QBrush 
 {
 	QTableWidgetItem* lhs = ValueInstaller2<QTableWidgetItem>::check( L, 1 );
	QBrush* res = ValueInstaller2<QBrush>::create( L );
	*res = lhs->foreground();
	return 1;
 }
开发者ID:Wushaowei001,项目名称:NAF,代码行数:7,代码来源:QtlTableWidgetItem.cpp

示例2: addNewGraphToUI

void GraphPlotDialog::addNewGraphToUI(unsigned graphId)
{
    QTableWidgetItem* graphItem = new QTableWidgetItem(QString::fromStdString(mData[graphId].name));
    graphItem->setData(Qt::UserRole, QVariant(graphId));
    setItemColor(graphItem);
    int rowCount = mUi.visibleGraph->rowCount();
    mUi.visibleGraph->setRowCount(rowCount + 1);
    mUi.visibleGraph->setItem(rowCount, 0, graphItem);

    QTableWidgetItem* valueItem = new QTableWidgetItem();
    valueItem->setForeground(graphItem->foreground());
    valueItem->setData(Qt::UserRole, QVariant(graphId));
    mUi.visibleGraph->setItem(rowCount, 1, valueItem);

}
开发者ID:excllent123,项目名称:corecvs,代码行数:15,代码来源:graphPlotDialog.cpp

示例3: childRepaint

void GraphPlotDialog::childRepaint(QPaintEvent * /*event*/, QWidget *who)
{
    if (!who)
        return;

    QPainter painter(who);
    unsigned h = who->height();
    unsigned w = who->width();

    painter.setPen(Qt::gray);
    painter.setBrush(Qt::darkGray);
    painter.drawRect(0, 0, w - 1, h - 1);

    int zero = h / 2;

    /* Draw oscilloscope
     *
     */
    double offset = mGraphPlotParameters->centerAt();
    double gainY = mGraphPlotParameters->yScale();
    double gainX = mGraphPlotParameters->xScale();

#if 0

    double oscContrast = ui.oscContrastSpinBox->value();
    deque<vector<double> >::iterator it;

    unsigned i = 0;

    for (it = intensity.begin(); it != intensity.end() && i < w; ++it, i++)
    {
        vector<int> line(h);

        const vector<double> &slice = *it;
        for (unsigned j = 0; j < slice.size(); j++)
        {
            double value = slice[j];
            double toShow = (value - offset) * gainY;
            unsigned bin = fround(zero - toShow);
            if (bin >= h)
                continue;
            line[bin]++;
        }

        for (unsigned j = 0; j < h; j++)
        {
            int val = line[j];
            val *= oscContrast;
            if (val > 255)
                val = 255;
            QPen pen;
            pen.setColor(QColor(0, val, val));
            painter.setPen(pen);
            painter.drawPoint(i, j);
        }
    }
#endif
    drawGrid(painter);
    drawGridFixLine(painter);

    QPen axisPen(Qt::DashLine);
    axisPen.setColor(Qt::blue);
    painter.setPen(axisPen);
    painter.drawLine(0, zero, w - 1, zero);

    int style = mGraphPlotParameters->graphStyle();


    for (int visId = 0; visId < mUi.visibleGraph->rowCount(); visId++) {
        QTableWidgetItem * item = mUi.visibleGraph->item(visId, 0);
        unsigned graphId = item->data(Qt::UserRole).toUInt();
        GraphHistory &graph = mData[graphId];
        QPen pen;
        pen.setColor(item->foreground().color());
        if (mData[graphId].isSelected && mGraphPlotParameters->selectGraph()) {
            pen.setWidth(mGraphPlotParameters->width() + 2);
        }
        else {
            pen.setWidth(mGraphPlotParameters->width());
        }
        painter.setPen(pen);

        unsigned i = 0;
        double x = 0;

        switch (style)
        {
        case 0:
            for (; i < graph.size() - 1 && x < w - 1; i++, x += gainX) {
                if (!graph[i].isValid || !graph[i + 1].isValid)
                    continue;

                double value1 = graph[i].value;
                double value2 = graph[i + 1].value;
                double toShow1 = (value1 - offset) * gainY;
                double toShow2 = (value2 - offset) * gainY;
                painter.drawLine(fround(x), zero - toShow1, fround(x + gainX), zero - toShow2);
            }
            break;
        case 1:
//.........这里部分代码省略.........
开发者ID:excllent123,项目名称:corecvs,代码行数:101,代码来源:graphPlotDialog.cpp


注:本文中的QTableWidgetItem::foreground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。