Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Wt Wt::WTable

 

Wt::WTable is a Wt class for a table.

 

 

 

 

 

WTable example

 

 

 

 

 

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: CppWTable.pro

 

#-------------------------------------------------
#
# 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.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml