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


C++ QTableView::setGridStyle方法代码示例

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


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

示例1: setModel

void ReceiveCoinsDialog::setModel(WalletModel *_model)
{
    this->model = _model;

    if(_model && _model->getOptionsModel())
    {
        _model->getRecentRequestsTableModel()->sort(RecentRequestsTableModel::Date, Qt::DescendingOrder);
        connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
        updateDisplayUnit();

        QTableView* tableView = ui->recentRequestsView;

        tableView->verticalHeader()->hide();
        tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        tableView->setModel(_model->getRecentRequestsTableModel());
//        tableView->setAlternatingRowColors(true);
        tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
        tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
        tableView->setColumnWidth(RecentRequestsTableModel::Date, DATE_COLUMN_WIDTH);
        tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);
        tableView->setColumnWidth(RecentRequestsTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);

        tableView->setGridStyle(Qt::NoPen);

        QHeaderView * verticalHeader = tableView->verticalHeader();
        verticalHeader->setDefaultSectionSize(57);

        tableView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);

        connect(tableView->selectionModel(),
            SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
            SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
        // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
        columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
    }
开发者ID:unitusdev,项目名称:unitus,代码行数:35,代码来源:receivecoinsdialog.cpp

示例2: QWidget


//.........这里部分代码省略.........
    ongletsNiveau2->addTab(pageCreationprojet, "Projet");
    ongletsNiveau2->addTab(pageTacheUnitaire, "Tâche unitaire");
    ongletsNiveau2->addTab(pageTacheComposite, "Tâche composite");
    layoutPageSaisiePrincipal->addWidget(gBProjetTV);
    layoutPageSaisiePrincipal->addWidget(supportOngletsCreation);

    //page Affichage/////////////////////////////////////////////////////////////////////////////////////////////////////

    layoutPageAffichagePrincipal = new QVBoxLayout;

    //En tete (gestion semaine suivante/precedente
    layoutHautAgenda = new QHBoxLayout;
    dateReferenceAgenda = new QDate(QDate::currentDate());
    jourActuel = new QPushButton(constructionMessageSemaineAgenda(dateReferenceAgenda));
    jourActuel->setEnabled(false);
    bSemainePrecedente = new QPushButton("Semaine precedent");
    bSemaineSuivante = new QPushButton("Semaine suivant");

    layoutHautAgenda->addWidget(bSemainePrecedente);
    layoutHautAgenda->addWidget(jourActuel);
    layoutHautAgenda->addWidget(bSemaineSuivante);

    QStandardItemModel *modelAgenda = new QStandardItemModel(60, 7);
    QTableView *vueAgenda = new QTableView;
    vueAgenda->setEditTriggers(QAbstractItemView::NoEditTriggers);
    vueAgenda->setModel(modelAgenda);
    vueAgenda->setFixedWidth(1157);
    vueAgenda->setFixedHeight(625);
    vueAgenda->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
    vueAgenda->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
    vueAgenda->setSelectionMode(QAbstractItemView::SingleSelection);

    //===========
    vueAgenda->setGridStyle(Qt::DashDotLine);

    miseAJourTableau(*modelAgenda); //, *vueAgenda);

    itemCol0 = new QStandardItem(chaineJoursHeader(1, dateReferenceAgenda->addDays(1-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month()));
    itemCol1 = new QStandardItem(chaineJoursHeader(2, dateReferenceAgenda->addDays(2-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month()));
    itemCol2 = new QStandardItem(chaineJoursHeader(3, dateReferenceAgenda->addDays(3-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month()));
    itemCol3 = new QStandardItem(chaineJoursHeader(4, dateReferenceAgenda->addDays(4-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month()));
    itemCol4 = new QStandardItem(chaineJoursHeader(5, dateReferenceAgenda->addDays(5-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month()));
    itemCol5 = new QStandardItem(chaineJoursHeader(6, dateReferenceAgenda->addDays(6-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month()));
    itemCol6 = new QStandardItem(chaineJoursHeader(7, dateReferenceAgenda->addDays(7-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month()));

    modelAgenda->setHorizontalHeaderItem(0, itemCol0);
    modelAgenda->setHorizontalHeaderItem(1, itemCol1);
    modelAgenda->setHorizontalHeaderItem(2, itemCol2);
    modelAgenda->setHorizontalHeaderItem(3, itemCol3);
    modelAgenda->setHorizontalHeaderItem(4, itemCol4);
    modelAgenda->setHorizontalHeaderItem(5, itemCol5);
    modelAgenda->setHorizontalHeaderItem(6, itemCol6);

    QStringList headerVTableau;
    for(unsigned int i=7; i<22; i++)
    {
        headerVTableau << QString::number(i)+"h00";
        for(unsigned int j=1; j<4; j++)
        {
            headerVTableau << "";
            //headerVTableau << QString::number(j*15);
        }
    }
    modelAgenda->setVerticalHeaderLabels(headerVTableau);
    miseEnFormeLigneColonnes(vueAgenda);
开发者ID:TerisseNicolas,项目名称:LO21-Calendar,代码行数:66,代码来源:fenetregraphique.cpp


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