#!/usr/local/bin/ruby

require "qt2"
include Qt2
 QApplication::setColorSpec( QApplication::CustomColor )
  a = QApplication.new( [$0]+ARGV )
   listview = QListView.new
#set color
  mypalette = listview.palette.copy
  cgrp = mypalette.normal
  foregroundColor = QColor("black")
  backgroundColor = QColor("light grey")
  ncgrp = QColorGroup.new(foregroundColor, cgrp.background, cgrp.light, cgrp.dark ,cgrp.mid, foregroundColor, backgroundColor)
   mypalette.setNormal( ncgrp )
   mypalette.setDisabled(ncgrp)
   mypalette.setActive(ncgrp)
   listview.setPalette(mypalette)
   listview.setBackgroundColor(backgroundColor)


  listview.addColumn( "Country" )
  listview.addColumn( "Capital" )
  listview.addColumn( "Population in mio." )
  listview.setRootIsDecorated( true )

  europe = QListViewItem.new( listview, "Europa" )
  america = QListViewItem.new( listview, "Americas" )
  africa = QListViewItem.new( listview, "Africa" )
  asia = QListViewItem.new( listview, "Asia" )

  item = QListViewItem.new( america, "Brazil", "Brasilia", "161.8" )
  item = QListViewItem.new( europe, "Scotland", "Edinburgh", "057.6" )
  item = QListViewItem.new( africa, "Morocco", "Rabat", "030.4" )
  item = QListViewItem.new( europe, "Norway", "Oslo", "004.4" )
  item = QListViewItem.new( europe, "Italy", "Rome", "052.2" )
  item = QListViewItem.new( america, "Chile", "Santiago", "014.2" )
  item = QListViewItem.new( africa, "Cameroon", "Yaounde", "013.2" )
  item = QListViewItem.new( europe, "Austria", "Vienna", "008.1" )
  item = QListViewItem.new( asia, "Saudi-Arabia", "Rihad", "020.0" )
  item = QListViewItem.new( europe, "Denmark", "Copenhagen", "005.2" )
  item = QListViewItem.new( europe, "France", "Paris", "058.0" )
  item = QListViewItem.new( africa, "South Africa", "Pretoria", "042.3" )
  item = QListViewItem.new( america, "Paraguay", "Asuncion", "005.6" )
  item = QListViewItem.new( europe, "Bulgaria", "Sofia", "008.8" )
  item = QListViewItem.new( europe, "Spain", "Madrid", "039.1" )
  item = QListViewItem.new( africa, "Nigeria", "Abuja", "107.1" )
  item = QListViewItem.new( asia, "South Korea", "Seoul", "045.9" )
  item = QListViewItem.new( america, "Mexico", "Mexico-City", "097.6" )
  item = QListViewItem.new( europe, "Netherlands", "Amsterdam", "015.6" )
  item = QListViewItem.new( europe, "Belgium", "Brussels", "010.1" )
  item = QListViewItem.new( europe, "Yugoslavia", "Belgrad", "010.8" )
  item = QListViewItem.new( asia, "Iran", "Teheran", "067.3" )
  item = QListViewItem.new( europe, "Germany", "Berlin", "081.2" )
  item = QListViewItem.new( america, "USA", "Washington", "268.0" )
  item = QListViewItem.new( europe, "England", "London", "048.5" )
  item = QListViewItem.new( africa, "Tunisia", "Tunis", "009.2" )
  item = QListViewItem.new( europe, "Romania", "Bucaresti", "022.5" )
  item = QListViewItem.new( america, "Colombia", "Bogota", "035.1" )
  item = QListViewItem.new( america, "Argentina", "Buenos Aires", "034.6" )
  jitem = QListViewItem.new( asia, "Japan", "Tokyo", "125.1" )
   jcitem = QCheckListItem.new(listview,"Japan Check",QCheckListItem::CheckBox)
   jccitem = QCheckListItem.new(jitem,"Jp check",QPixmap.new("flag_ja.xpm"))
   item = QCheckListItem.new(jccitem,"Jp 1",QCheckListItem::CheckBox)
  item = QListViewItem.new( america, "Jamaica", "Kingston", "002.4" )
  item = QListViewItem.new( europe, "Croatia", "Zagreb", "004.5" )

  listview.resize( 400, 300 )
  listview.show

  a.setMainWidget( listview )

  a.exec

