资源简介

QT TableWidget 分页效果 源代码 需要就拿走……

资源截图

代码片段和文件信息

#include “tablewidget.h“
#include 
TableWidget::TableWidget(QWidget *parent) :
    QWidget(parent)
{
    gridLayout = new QGridLayout(this);
    gridLayout->setobjectName(QString::fromUtf8(“gridLayout“));
    first_page = new QToolButton(this);
    first_page->setobjectName(QString::fromUtf8(“first_page“));

    gridLayout->addWidget(first_page 0 0 1 1);

    up_page = new QToolButton(this);
    up_page->setobjectName(QString::fromUtf8(“up_page“));

    gridLayout->addWidget(up_page 0 1 1 1);

    label = new QLabel(this);
    label->setobjectName(QString::fromUtf8(“label“));

    gridLayout->addWidget(label 0 2 1 1);

    combox = new QComboBox(this);
    combox->setobjectName(QString::fromUtf8(“combox“));

    gridLayout->addWidget(combox 0 3 1 1);

    all_page = new QLabel(this);
    all_page->setobjectName(QString::fromUtf8(“all_page“));

    gridLayout->addWidget(all_page 0 4 1 1);

    next_page = new QToolButton(this);
    next_page->setobjectName(QString::fromUtf8(“next_page“));

    gridLayout->addWidget(next_page 0 5 1 1);

    last_page = new QToolButton(this);
    last_page->setobjectName(QString::fromUtf8(“last_page“));

    gridLayout->addWidget(last_page 0 6 1 1);

    tableWidget = new QTableWidget(this);
    tableWidget->setobjectName(QString::fromUtf8(“tableWidget“));
    tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);

    gridLayout->addWidget(tableWidget 1 0 1 7);

    first_page->setText(QApplication::translate(“Form2“ “|<“ 0 QApplication::UnicodeUTF8));
    up_page->setText(QApplication::translate(“Form2“ “<“ 0 QApplication::UnicodeUTF8));
    label->setText(QApplication::translate(“Form2“ “\345\275\223\345\211\215\351\241\265\357\274\232“ 0 QApplication::UnicodeUTF8));

    next_page->setText(QApplication::translate(“Form2“ “>“ 0 QApplication::UnicodeUTF8));
    last_page->setText(QApplication::translate(“Form2“ “>|“ 0 QApplication::UnicodeUTF8));

    gridLayout->setColumnStretch(0 1);
    gridLayout->setColumnStretch(1 1);
    gridLayout->setColumnStretch(3 1);
    gridLayout->setColumnStretch(5 1);
    gridLayout->setColumnStretch(6 1);
    record_page = 20;
    total_page = 0;
    curr_page = 0;

    first_page->setEnabled(false);
    up_page->setEnabled(false);
    next_page->setEnabled(false);
    last_page->setEnabled(false);
    connect(first_pageSIGNAL(clicked())thisSLOT(firstpage()));
    connect(up_pageSIGNAL(clicked())thisSLOT(uppage()));
    connect(next_pageSIGNAL(clicked())thisSLOT(nextpage()));
    connect(last_pageSIGNAL(clicked())thisSLOT(lastpage()));
    connect(comboxSIGNAL(activated(int))thisSLOT(jump_page(int)));
}
void TableWidget::set_title(QStringList hor_name)
{
    tableWidget->setColumn

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5391  2011-12-26 22:11  pagination\tablewidget.cpp

     文件       1242  2011-12-26 16:36  pagination\tablewidget.h

     目录          0  2011-12-30 14:22  pagination

----------- ---------  ---------- -----  ----

                 6633                    3


评论

共有 条评论