ListElements/ModelViewList/mainwindow.cpp
changeset 46 702dd26c0f4d
parent 45 b23ec2b62c45
child 47 c6e75ec74fc8
equal deleted inserted replaced
45:b23ec2b62c45 46:702dd26c0f4d
    19     listView = new QListView;
    19     listView = new QListView;
    20     listView->setFrameStyle(QFrame::Panel | QFrame::Raised);
    20     listView->setFrameStyle(QFrame::Panel | QFrame::Raised);
    21     listView->setLineWidth(4);
    21     listView->setLineWidth(4);
    22     exitButton = new QPushButton(this);
    22     exitButton = new QPushButton(this);
    23     exitButton->setText("Exit");
    23     exitButton->setText("Exit");
       
    24     connect(exitButton, SIGNAL(clicked()), this,SLOT(close()));
    24 
    25 
    25     // define the model
    26     // define the model
    26     ZodiacModel *zModel = new ZodiacModel(this);
    27     ZodiacModel *zModel = new ZodiacModel(this);
    27     listView->setModel(zModel);
    28     listView->setModel(zModel);
       
    29 #ifdef USE_DELEGATE
    28     ZodiacDelegate *delegate = new ZodiacDelegate(this);
    30     ZodiacDelegate *delegate = new ZodiacDelegate(this);
    29     listView->setItemDelegate(delegate);
    31     listView->setItemDelegate(delegate);
       
    32 #endif
    30 
    33 
    31     // create landscape layout
    34     // create landscape layout
    32     layoutLandscape = new QHBoxLayout(this);
    35     layoutLandscape = new QHBoxLayout;
    33     layoutLandscape->addWidget(listView);
    36     layoutLandscape->addWidget(listView);
    34     layoutLandscape->addWidget(exitButton);
    37     layoutLandscape->addWidget(exitButton);
    35 
    38 
    36     //create portrait layout
    39     //create portrait layout
    37     layoutPortrait = new QVBoxLayout(this);
    40     layoutPortrait = new QVBoxLayout;
    38     layoutPortrait->addWidget(listView);
    41     layoutPortrait->addWidget(listView);
    39     layoutPortrait->addWidget(exitButton);
    42     layoutPortrait->addWidget(exitButton);
    40 
    43 
    41     portLandLayout = new PLLayout();
    44     portLandLayout = new PLLayout();
    42     portLandLayout->setPLayout(layoutPortrait);
    45     portLandLayout->setPLayout(layoutPortrait);