Hello,

we updated to witty 3.2.1 and have several problems with our layouts,
mostly with wtableviews and treeviews.

I attached an small minimal example of an WTreeView and screenshots
from the running application with witty 3.2.0 and 3.2.1 can be found
here:

   http://ascholl.de/files/2012-04-05-witty-interest--Wt-3.2.0.png
   http://ascholl.de/files/2012-04-05-witty-interest--Wt-3.2.1.png

With 3.2.0 the items are shown, unter 3.2.1 the WTreeView-Header is
defect and there are no items visible in the tree (but they are in the
source).


Any idea how to solve that problem?


regards,
Albert Scholl
/*
 * Copyright (C) 2008 Emweb bvba, Heverlee, Belgium.
 *
 * See the LICENSE file for terms of use.
 */

#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WGroupBox>
#include <Wt/WPushButton>
#include <Wt/WStandardItem>
#include <Wt/WStandardItemModel>
#include <Wt/WText>
#include <Wt/WTreeView>
#include <Wt/WVBoxLayout>

#include <iostream>

using namespace Wt;


class HelloApplication : public WApplication
{
public:
   HelloApplication(const WEnvironment& env);

private:
   Wt::WTreeView* treeView;
};

HelloApplication::HelloApplication(const WEnvironment& env)
   : WApplication(env)
{
   styleSheet().addRule("html, body", "width: 100%; height: 100%; margin: 0");

   auto container = new WContainerWidget();
   root()->addWidget(container);
   container->resize(WLength(100, WLength::Percentage), WLength(100, 
WLength::Percentage));

   auto layout = new WVBoxLayout(container);
   layout->setContentsMargins(10, 10, 10, 10);

   layout->addWidget(new WText(WString("TOP"), container), 0);


   auto treeBox = new WGroupBox("My GroupBox", container);
   treeBox->resize(WLength::Auto, WLength(100, WLength::Percentage));
   layout->addWidget(treeBox, 1);
   //layout->setResizable(0);
   auto treeLayout = new WVBoxLayout(treeBox);
   treeLayout->setContentsMargins(0, 0, 0, 0);


   treeView = new WTreeView(treeBox);
   treeView->setColumnWidth(0, WLength(180));
   treeView->setColumnWidth(1, WLength(350));
   treeLayout->addWidget(treeView, 1);

   WStandardItemModel* treeModel = new WStandardItemModel(0, 2, treeView);
   treeModel->setHeaderData(0, WString("column 1"));
   treeModel->setHeaderData(1, WString("column 2"));

   for (int i = 0; i < 5; ++i) {
      auto *parentItem = new WStandardItem(WString("parent row"));
      for (int j = 0; j < 5; ++j) {
         std::vector<WStandardItem*> row;
         row.push_back(new WStandardItem(WString("child row - column 1")));
         row.push_back(new WStandardItem(WString("child row - column 2")));
         parentItem->appendRow(row);
      }
      treeModel->appendRow(parentItem);
   }

   treeView->setModel(treeModel);

   layout->addWidget(new WText(WString("BOTTOM"), container), 0);
}

WApplication *createApplication(const WEnvironment& env)
{
   return new HelloApplication(env);
}

int main(int argc, char **argv)
{
   for (int i = 0; i < argc; ++i) {
      if (std::string(argv[i]).find("--docroot") != std::string::npos) {
         return WRun(argc, argv, &createApplication);
      }
   }

   std::cerr << "--docroot not specified!" << std::endl;
   std::cerr << "eg: <app> --docroot ..\\etc\\resources --http-address 0.0.0.0 
--config ..\\etc\\wt_config.xml" << std::endl;

   return 1;
}

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to