Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
Wt::WTable is a Wt class
for a table.
Technical facts
Application type(s)
Operating system(s) or programming environment(s)
IDE(s):
Project type:
C++ standard:
Compiler(s):
Libraries used:
Boost: version 1.42
STL: GNU ISO C++ Library, version 4.6.1
Wt: version 3.1.10
#-------------------------------------------------
#
# Project created by QtCreator 2012-02-14T17:32:30
#
#-------------------------------------------------
QT += core
QT -= gui
LIBS += -lwt -lwthttp -lboost_signals
TARGET = CppWTable
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
|
main.cpp
#include <boost/signals2.hpp>
#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WBrush>
#include <Wt/WContainerWidget>
#include <Wt/WEnvironment>
#include <Wt/WEvent>
#include <Wt/WPaintDevice>
#include <Wt/WPaintedWidget>
#include <Wt/WPainter>
#include <Wt/WPen>
#include <Wt/WPushButton>
#include <Wt/WTable>
#include <Wt/WLabel>
#include <Wt/WTextArea>
//---------------------------------------------------------------------------
struct WtDialog : public Wt::WContainerWidget
{
WtDialog()
: m_table(new Wt::WTable)
{
this->addWidget(m_table);
m_table->elementAt(0,1)->addWidget(new Wt::WLabel("X=1"));
m_table->elementAt(0,2)->addWidget(new Wt::WLabel("X=2"));
for (int i=0; i!=100; ++i)
{
}
m_table->elementAt(1,0)->addWidget(new Wt::WLabel("A"));
m_table->elementAt(2,0)->addWidget(new Wt::WLabel("B"));
m_table->elementAt(3,0)->addWidget(new Wt::WLabel("C"));
m_table->setHeaderCount(1,Wt::Horizontal);
m_table->setHeaderCount(1,Wt::Vertical);
Wt::WCssDecorationStyle s;
s.setBorder(Wt::WBorder(Wt::WBorder::Solid));
m_table->setDecorationStyle(s);
}
private:
Wt::WTable * const m_table;
};
//---------------------------------------------------------------------------
struct WtApplication : public Wt::WApplication
{
WtApplication(const Wt::WEnvironment& env)
: Wt::WApplication(env)
{
this->setTitle("CppWTable");
WtDialog * const d = new WtDialog;
root()->addWidget(d);
}
};
//---------------------------------------------------------------------------
Wt::WApplication *createApplication(
const Wt::WEnvironment& env)
{
return new WtApplication(env);
}
//---------------------------------------------------------------------------
int main(int argc, char **argv)
{
return WRun(argc, argv, &createApplication);
}
//---------------------------------------------------------------------------
|
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.

This page has been created by the tool CodeToHtml