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


C++ QTableWidget::width方法代码示例

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


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

示例1: mouseDoubleClickEvent

void MainWindow::mouseDoubleClickEvent(QMouseEvent *event) {
  if (Q_UNLIKELY(over->containsDrawing("blank_table"))) {
    QTableWidget *w = static_cast<QTableWidget *>(
        ui->listTabs->currentWidget()->layout()->itemAt(0)->widget());
    QPoint location = w->mapTo(this, QPoint(0, 0));
    QRect r(location.x() + 1, location.y() + 24, w->width() - 2,
            w->height() - 25);

    if (r.contains(event->x(), event->y())) {
      SearchPanel *sp = new SearchPanel(this);
      sp->show();
    }
  }
}
开发者ID:KasaiDot,项目名称:Shinjiru,代码行数:14,代码来源:mainwindow.cpp

示例2: printLegend

void PrintingController::printLegend(bool newPageForSection)
{
    if (fwbdebug) qDebug("******** Legend");

    if (newPageForSection)
    {
        pr->flushPage();
        pr->beginPage();   // resets yPos
    } else
        pr->printText("\n");

    pr->printText(QObject::tr("Legend"));
    pr->printText(" ");

    QTableWidget *legendTbl = new QTableWidget(1,2);
    configureQTableForPrint(legendTbl);

    string icon_path="/FWBuilderResources/Type/";
    int row = 0;
    int col = 0;

    QPixmap pm;

    QPixmap bfr(32,32);
    QPainter bfrp(&bfr);

    for (int i=0; !legendList[i].isEmpty(); ++i,++i)
    {
        if (row >= legendTbl->rowCount()) legendTbl->insertRow(row);

        QString type_name = legendList[i];
        QString objName = legendList[i+1];

        if (type_name==CustomService::TYPENAME)
        {
            col++;
            row=0;
        }

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
        if (fwbdebug)
            qDebug("Legend table: row=%d col=%d %s %s",
                   row, col, type_name.toAscii().constData(),
                   objName.toAscii().constData());
#else
        if (fwbdebug)
            qDebug("Legend table: row=%d col=%d %s %s",
                   row, col, type_name.toLatin1().constData(),
                   objName.toLatin1().constData());
#endif

        QString icn = ":/Icons/"+type_name+"/icon";
        QPixmap pm;
        if ( ! QPixmapCache::find( icn, pm) )
        {
            pm.load( icn );
            QPixmapCache::insert( icn, pm);
        }

        bfrp.fillRect(0,0,32,32,QColor(Qt::white));
        bfrp.drawPixmap(4,4,pm);

        QTableWidgetItem *itm = new QTableWidgetItem;
        itm->setIcon(QIcon(bfr));
        itm->setText(objName);
        legendTbl->setItem(row, col, itm);

        row++;
    }

    legendTbl->resizeColumnToContents(0);
    legendTbl->resizeColumnToContents(1);

    for (int i=0; i<legendTbl->rowCount(); ++i)
        legendTbl->resizeRowToContents(i);

    QSize sh = legendTbl->sizeHint();
    legendTbl->resize(sh.width(),sh.height());
    if (fwbdebug) qDebug("legendTbl size: %dx%d",
                         legendTbl->width(),legendTbl->height());

    pr->printQTable(legendTbl, false, false);
}
开发者ID:UNINETT,项目名称:fwbuilder,代码行数:83,代码来源:PrintingController.cpp


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