本文整理汇总了C++中WTable::setHeaderCount方法的典型用法代码示例。如果您正苦于以下问题:C++ WTable::setHeaderCount方法的具体用法?C++ WTable::setHeaderCount怎么用?C++ WTable::setHeaderCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WTable
的用法示例。
在下文中一共展示了WTable::setHeaderCount方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printSeries
void BasePage::printSeries(const Dbo::collection<Dbo::ptr<Seria> >& listseries){
WTable *seriaTable = new WTable();
seriaTable->setHeaderCount(1);
seriaTable->setStyleClass("tablestyle");
seriaTable->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>"));
seriaTable->elementAt(0, 1)->addWidget(new WText("<p align='left'> Name of seria </p>"));
seriaTable->elementAt(0, 2)->addWidget(new WText("<p align='left'> Number of books </p>"));
_pagecontent->addWidget(seriaTable);
int row=1;
for (Dbo::collection<Dbo::ptr<Seria> >::const_iterator i = listseries.begin(); i != listseries.end(); ++i){
Dbo::ptr<Seria> Seria = *i;
seriaTable->setStyleClass("tablestyle th,td,tr");
//headers
seriaTable->elementAt(row, 0)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg(row)));
//genre
seriaTable->elementAt(row, 1)
->addWidget(new WText(WString::fromUTF8(Seria.get()->seria)));
//num of books in seria
seriaTable->elementAt(row, 2)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg((Seria.get()->numOfBooks))));
_pagecontent->addWidget(seriaTable);
row++;
}
}
示例2: printAuthors
void BasePage::printAuthors(const Dbo::collection<Dbo::ptr<Author> >& listauthors){
WTable *authTable = new WTable();
authTable->setHeaderCount(1);
authTable->setStyleClass("tablestyle");
authTable->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>"));
authTable->elementAt(0, 1)->addWidget(new WText("<p align='left'> Full name or pseudo </p>"));
authTable->elementAt(0, 2)->addWidget(new WText("<p align='left'> Years of life </p>"));
_pagecontent->addWidget(authTable);
int row=1;
for (Dbo::collection<Dbo::ptr<Author> >::const_iterator i = listauthors.begin(); i != listauthors.end(); ++i){
Dbo::ptr<Author> Author = *i;
authTable->setStyleClass("tablestyle th,td,tr");
//headers
authTable->elementAt(row, 0)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg(row)));
//name
authTable->elementAt(row, 1)
->addWidget(new WText(WString::fromUTF8(Author.get()->name)));
//authors
authTable->elementAt(row, 2)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg((Author.get()->years))));
_pagecontent->addWidget(authTable);
row++;
}
}
示例3: addMark
/*void BasePage::addAuthor(){
WContainerWidget *container1 = new WContainerWidget();
Wt::WTemplate *r = new Wt::WTemplate(Wt::WString::tr("addAuthorForm"));
WLineEdit *editName = new WLineEdit(container1);
editName->setPlaceholderText("name");
r->bindWidget("name", editName);
WLineEdit *editYears = new WLineEdit(container1);
editYears->setPlaceholderText("years");
r->bindWidget("years", editYears);
WPushButton *button = new WPushButton("Add author", container1);
button->setMargin(10, Top | Bottom);
button->clicked().connect(std::bind([=] () {BookManager am; am.addAuthor("123","2016"); }));
r->bindWidget("button", button);
_pagecontent->addWidget(r);
}*/
void BasePage::addMark(const Dbo::collection<Dbo::ptr<Book> >& listaddmark){
WTable *table = new WTable();
table->setHeaderCount(1);
table->setStyleClass("tablestyle");
table->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>"));
table->elementAt(0, 1)->addWidget(new WText("<p align='left'> Title of book </p>"));
table->elementAt(0, 2)->addWidget(new WText("<p align='left'> Author </p>"));
table->elementAt(0, 3)->addWidget(new WText("<p align='left'> Genre </p>"));
table->elementAt(0, 4)->addWidget(new WText("<p align='left'> Add your mark </p>"));
_pagecontent->addWidget(table);
int row=1;
for (Dbo::collection<Dbo::ptr<Book> >::const_iterator i = listaddmark.begin(); i != listaddmark.end(); ++i){
Dbo::ptr<Book> book = *i;
table->setStyleClass("tablestyle th,td,tr");
//headers
table->elementAt(row, 0)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg(row)));
//titles
table->elementAt(row, 1)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg(book.get()->title)));
//authors
table->elementAt(row, 2)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg((book.get()->author.get()->name))));
//genres
table->elementAt(row, 3)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg((book.get()->genre.get()->genre))));
//add mark
WLineEdit *editAddMark = new WLineEdit(table->elementAt(row,4));
editAddMark->setPlaceholderText("Add mark");
table->elementAt(row, 4)
->addWidget(editAddMark);
table->elementAt(row, 4)
->addWidget(new WText("<br></br>"));
WPushButton *button = new WPushButton("Add mark", table->elementAt(row,4));
button->setMargin(10, Top | Bottom);
table->elementAt(row, 4)
->addWidget(button);
/*button->clicked().connect(std::bind([] ( Dbo::ptr<Book> book) {
BookManager bm;
std::cout<<book.get()->title;
int curMark=book.get()->mark;
int curNumMarks=book.get()->numMarks;
bm.refreshRate(book.get()->id, curMark+5, curNumMarks+1, session);
},*i ));*/
row++;
_pagecontent->addWidget(table);
}
}
示例4: WTable
void BasePage::printTop10( const Dbo::collection<Dbo::ptr<Book> >& top10){
//setContentText("top10");
// # creating table
WTable *table = new WTable();
table->setHeaderCount(1);
table->setStyleClass("tablestyle");
table->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>"));
table->elementAt(0, 1)->addWidget(new WText("<p align='left'> Title of book </p>"));
table->elementAt(0, 2)->addWidget(new WText("<p align='left'> Author </p>"));
table->elementAt(0, 3)->addWidget(new WText("<p align='left'> Genre </p>"));
table->elementAt(0, 4)->addWidget(new WText("<p align='left'> Mark </p>"));
_pagecontent->addWidget(table);
int row=1;
for (Dbo::collection<Dbo::ptr<Book> >::const_iterator i = top10.begin(); i != top10.end(); ++i){
Dbo::ptr<Book> Book = *i;
table->setStyleClass("tablestyle th,td,tr");
//headers
table->elementAt(row, 0)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg(row)));
//titles
table->elementAt(row, 1)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg(Book.get()->title)));
//authors
table->elementAt(row, 2)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg((Book.get()->author.get()->name))));
//genres
table->elementAt(row, 3)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg((Book.get()->genre.get()->genre))));
//marks
table->elementAt(row, 4)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg((Book.get()->mark))));
_pagecontent->addWidget(table);
row++;
}
}
示例5: printGenres
void BasePage::printGenres(const Dbo::collection<Dbo::ptr<Genre> >& listgenres){
WTable *genreTable = new WTable();
genreTable->setHeaderCount(1);
genreTable->setStyleClass("tablestyle");
genreTable->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>"));
genreTable->elementAt(0, 1)->addWidget(new WText("<p align='left'> Types og genres </p>"));
_pagecontent->addWidget(genreTable);
int row=1;
for (Dbo::collection<Dbo::ptr<Genre> >::const_iterator i = listgenres.begin(); i != listgenres.end(); ++i){
Dbo::ptr<Genre> Genre = *i;
genreTable->setStyleClass("tablestyle th,td,tr");
//headers
genreTable->elementAt(row, 0)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg(row)));
//genre
genreTable->elementAt(row, 1)
->addWidget(new WText(WString::fromUTF8(Genre.get()->genre)));
_pagecontent->addWidget(genreTable);
row++;
}
}
示例6: WBreak
void SysMon::Impl::RefreshResourceUsage()
{
sg_cpu_percents *cpuPercents;
sg_mem_stats *memStats;
sg_swap_stats *swapStats;
sg_host_info *hostInfo;
sg_disk_io_stats *diskIoStats;
sg_network_io_stats *networkIoStats;
std::size_t cpuPercentsEntries = 0;
std::size_t memStatsEntries = 0;
std::size_t swapStatsEntries = 0;
std::size_t hostInfoEntries = 0;
std::size_t diskIoStatsEntries = 0;
std::size_t networkIoStatsEntries = 0;
/// Get the host info
if ((hostInfo = sg_get_host_info(&hostInfoEntries)) != NULL) {
HostInfoDiv->clear();
WTable *hostTable = new WTable(HostInfoDiv);
hostTable->setStyleClass("table table-hover");
hostTable->setHeaderCount(1, Orientation::Horizontal);
hostTable->elementAt(0, 0)->addWidget(new WText(tr("system-monitor-host-info-os-name")));
hostTable->elementAt(0, 1)->addWidget(new WText(tr("system-monitor-host-info-os-release")));
hostTable->elementAt(0, 2)->addWidget(new WText(tr("system-monitor-host-info-os-version")));
hostTable->elementAt(0, 3)->addWidget(new WText(tr("system-monitor-host-info-platform")));
hostTable->elementAt(0, 4)->addWidget(new WText(tr("system-monitor-host-info-hostname")));
hostTable->elementAt(0, 5)->addWidget(new WText(tr("system-monitor-host-info-bitwidth")));
hostTable->elementAt(0, 6)->addWidget(new WText(tr("system-monitor-host-info-host-state")));
hostTable->elementAt(0, 7)->addWidget(new WText(tr("system-monitor-host-info-ncpus")));
hostTable->elementAt(0, 8)->addWidget(new WText(tr("system-monitor-host-info-maxcpus")));
hostTable->elementAt(0, 9)->addWidget(new WText(tr("system-monitor-host-info-uptime")));
hostTable->elementAt(0, 10)->addWidget(new WText(tr("system-monitor-host-info-systime")));
hostTable->elementAt(1, 0)->addWidget(new WText(WString(hostInfo->os_name)));
hostTable->elementAt(1, 1)->addWidget(new WText(WString(hostInfo->os_release)));
hostTable->elementAt(1, 2)->addWidget(new WText(WString(hostInfo->os_version)));
hostTable->elementAt(1, 3)->addWidget(new WText(WString(hostInfo->platform)));
hostTable->elementAt(1, 4)->addWidget(new WText(WString(hostInfo->hostname)));
hostTable->elementAt(1, 5)->addWidget(new WText(lexical_cast<string>(hostInfo->bitwidth)));
hostTable->elementAt(1, 6)->addWidget(new WText(lexical_cast<string>(HostState[hostInfo->host_state])));
hostTable->elementAt(1, 7)->addWidget(new WText(lexical_cast<string>(hostInfo->ncpus)));
hostTable->elementAt(1, 8)->addWidget(new WText(lexical_cast<string>(hostInfo->maxcpus)));
hostTable->elementAt(1, 9)->addWidget(new WText(lexical_cast<string>(hostInfo->uptime)));
hostTable->elementAt(1, 10)->addWidget(new WText(lexical_cast<string>(hostInfo->systime)));
}
/// Shift and fill the CPU usage cache and model
if ((cpuPercents = sg_get_cpu_percents(&cpuPercentsEntries)) != NULL) {
CpuInstant cpuInstant;
cpuInstant[Cpu::User] = cpuPercents->user;
cpuInstant[Cpu::Kernel] = cpuPercents->kernel;
cpuInstant[Cpu::Idle] = cpuPercents->idle;
cpuInstant[Cpu::IoWait] = cpuPercents->iowait;
cpuInstant[Cpu::Swap] = cpuPercents->swap;
cpuInstant[Cpu::Nice] = cpuPercents->nice;
CpuUsageCache.push_back(cpuInstant);
CpuUsageCache.pop_front();
int i = 0;
for (std::list<CpuInstant>::const_iterator it =
CpuUsageCache.begin(); it != CpuUsageCache.end(); ++it) {
cpuInstant = *it;
CpuUsageModel->setData(i, 0, cpuInstant[Cpu::User]);
CpuUsageModel->setData(i, 1, cpuInstant[Cpu::Kernel]);
CpuUsageModel->setData(i, 2, cpuInstant[Cpu::Idle]);
CpuUsageModel->setData(i, 3, cpuInstant[Cpu::IoWait]);
CpuUsageModel->setData(i, 4, cpuInstant[Cpu::Swap]);
CpuUsageModel->setData(i, 5, cpuInstant[Cpu::Nice]);
CpuUsageModel->setData(i, 6, i);
++i;
}
}
/// Shift and fill the memory usage cache and model
if(((memStats = sg_get_mem_stats(&memStatsEntries)) != NULL)) {
MemoryInstant memoryInstant;
memoryInstant[Memory::Total] = 100.0;
memoryInstant[Memory::Free] = 100.0 * memStats->free / memStats->total;
memoryInstant[Memory::Used] = 100.0 * memStats->used / memStats->total;
memoryInstant[Memory::Cache] = 100.0 * memStats->cache / memStats->total;
MemoryUsageCache.push_back(memoryInstant);
MemoryUsageCache.pop_front();
MemoryUsageModel->setHeaderData(
0, WString::fromUTF8("{1} {2}")
.arg(Utility::CalculateSize(memStats->total))
.arg(tr("system-monitor-memory-stats-total")));
MemoryUsageModel->setHeaderData(
1, WString::fromUTF8("{1} ({2}%) {3}")
.arg(Utility::CalculateSize(memStats->free))
.arg((wformat(L"%.1f") % memoryInstant[Memory::Free]).str())
.arg(tr("system-monitor-memory-stats-free"))
);
//.........这里部分代码省略.........
示例7: update
void HighScoresWidget::update()
{
clear();
new WText("<h2>Hall of fame</h2>", this);
int ranking = session_->findRanking();
std::string yourScore;
if (ranking == 1)
yourScore = "Congratulations! You are currently leading the pack.";
else {
yourScore = "You are currently ranked number "
+ boost::lexical_cast<std::string>(ranking)
+ ". Almost there !";
}
WText *score = new WText("<p>" + yourScore + "</p>", this);
score->addStyleClass("score");
std::vector<User> top = session_->topUsers(20);
WTable *table = new WTable(this);
new WText("Rank", table->elementAt(0, 0));
new WText("User", table->elementAt(0, 1));
new WText("Games", table->elementAt(0, 2));
new WText("Score", table->elementAt(0, 3));
new WText("Last game", table->elementAt(0, 4));
table->setHeaderCount(1);
int formerScore = -1;
int rank = 0;
for (unsigned i = 0; i < top.size(); i++) {
User u = top[i];
if (u.score != formerScore) {
formerScore = u.score;
++rank;
}
int row = table->rowCount();
new WText(boost::lexical_cast<std::string>(rank),
table->elementAt(row, 0));
new WText(u.name, table->elementAt(row, 1));
new WText(boost::lexical_cast<std::string>(u.gamesPlayed),
table->elementAt(row, 2));
new WText(boost::lexical_cast<std::string>(u.score),
table->elementAt(row, 3));
if (!u.lastGame.isNull())
new WText(u.lastGame.timeTo(WDateTime::currentDateTime())
+ " ago", table->elementAt(row, 4));
else
new WText("---", table->elementAt(row, 4));
if (session_->login().loggedIn() && session_->userName() == u.name)
table->rowAt(row)->setId("self");
}
WText *fineprint = new WText(tr("highscore.info"), this);
fineprint->addStyleClass("fineprint");
}
示例8: WTable
void CmsSubscribers::Impl::FillDataTable(const CmsSubscribers::Impl::Table &tableType)
{
try {
SubscribersTableContainer->clear();
WTable *table = new WTable(SubscribersTableContainer);
table->setStyleClass("table table-striped table-hover");
table->setHeaderCount(1, Orientation::Horizontal);
table->elementAt(0, 0)->addWidget(new WText(tr("cms-subscribers-no")));
table->elementAt(0, 1)->addWidget(new WText(tr("cms-subscribers-inbox")));
table->elementAt(0, 2)->addWidget(new WText(tr("cms-subscribers-subscription")));
table->elementAt(0, 3)->addWidget(new WText(tr("cms-subscribers-pending-confirm")));
table->elementAt(0, 4)->addWidget(new WText(tr("cms-subscribers-pending-cancel")));
table->elementAt(0, 5)->addWidget(new WText(tr("cms-subscribers-join-date")));
table->elementAt(0, 6)->addWidget(new WText(tr("cms-subscribers-update-date")));
table->elementAt(0, 7)->addWidget(new WText(tr("cms-subscribers-uuid")));
result r;
switch (tableType) {
case Table::All:
r = Pool::Database()->Sql()
<< (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date"
" FROM \"%1%\" ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;")
% Pool::Database()->GetTableName("SUBSCRIBERS")).str();
break;
case Table::EnFa:
r = Pool::Database()->Sql()
<< (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date"
" FROM \"%1%\" WHERE subscription = 'en_fa' ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;")
% Pool::Database()->GetTableName("SUBSCRIBERS")).str();
break;
case Table::En:
r = Pool::Database()->Sql()
<< (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date"
" FROM \"%1%\" WHERE subscription = 'en' ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;")
% Pool::Database()->GetTableName("SUBSCRIBERS")).str();
break;
case Table::Fa:
r = Pool::Database()->Sql()
<< (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date"
" FROM \"%1%\" WHERE subscription = 'fa' ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;")
% Pool::Database()->GetTableName("SUBSCRIBERS")).str();
break;
case Table::Inactive:
r = Pool::Database()->Sql()
<< (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date"
" FROM \"%1%\" WHERE subscription = 'none' ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;")
% Pool::Database()->GetTableName("SUBSCRIBERS")).str();
break;
}
int i = 0;
while(r.next()) {
++i;
string inbox;
string uuid;
string subscription;
string pending_confirm;
string pending_cancel;
string join_date;
string update_date;
r >> inbox >> uuid >> subscription >> pending_confirm >> pending_cancel >> join_date >> update_date;
WString subscriptionTypeName;
WString pendingConfirmTypeName;
WString pendingCancelTypeName;
this->GetSubscriptionTypeName(subscription, subscriptionTypeName);
this->GetSubscriptionTypeName(pending_confirm, pendingConfirmTypeName);
this->GetSubscriptionTypeName(pending_cancel, pendingCancelTypeName);
WString joinDate;
WString updateDate;
this->GetDate(join_date, joinDate);
this->GetDate(join_date, updateDate);
table->elementAt(i, 0)->addWidget(new WText(WString::fromUTF8(lexical_cast<string>(i))));
table->elementAt(i, 1)->addWidget(new WText(WString::fromUTF8(inbox)));
table->elementAt(i, 2)->addWidget(new WText(subscriptionTypeName));
table->elementAt(i, 3)->addWidget(new WText(pendingConfirmTypeName));
table->elementAt(i, 4)->addWidget(new WText(pendingCancelTypeName));
table->elementAt(i, 5)->addWidget(new WText(joinDate));
table->elementAt(i, 6)->addWidget(new WText(updateDate));
table->elementAt(i, 7)->addWidget(new WText(WString::fromUTF8(uuid)));
}
}
catch (boost::exception &ex) {
LOG_ERROR(boost::diagnostic_information(ex));
}
catch (std::exception &ex) {
LOG_ERROR(ex.what());
}
catch (...) {
LOG_ERROR(UNKNOWN_ERROR);
//.........这里部分代码省略.........