annotate multichoicedialog.cpp @ 68:b918e57c7bea

* Flesh out multi-choice dialog a big
author Chris Cannam
date Wed, 17 Nov 2010 22:13:34 +0000
parents be627aeceaed
children 6d5a5571caec
rev   line source
Chris@67 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@67 2
Chris@67 3 /*
Chris@67 4 EasyMercurial
Chris@67 5
Chris@67 6 Based on HgExplorer by Jari Korhonen
Chris@67 7 Copyright (c) 2010 Jari Korhonen
Chris@67 8 Copyright (c) 2010 Chris Cannam
Chris@67 9 Copyright (c) 2010 Queen Mary, University of London
Chris@67 10
Chris@67 11 This program is free software; you can redistribute it and/or
Chris@67 12 modify it under the terms of the GNU General Public License as
Chris@67 13 published by the Free Software Foundation; either version 2 of the
Chris@67 14 License, or (at your option) any later version. See the file
Chris@67 15 COPYING included with this distribution for more information.
Chris@67 16 */
Chris@67 17
Chris@67 18 #include "multichoicedialog.h"
Chris@67 19
Chris@68 20 #include <QDialogButtonBox>
Chris@68 21
Chris@68 22 MultiChoiceDialog::MultiChoiceDialog(QString title, QString heading, QWidget *parent) :
Chris@67 23 QDialog(parent)
Chris@67 24 {
Chris@68 25 setModal(true);
Chris@68 26 setWindowTitle(title);
Chris@68 27
Chris@68 28 QGridLayout *outer = new QGridLayout;
Chris@68 29 setLayout(outer);
Chris@68 30
Chris@68 31 outer->addWidget(new QLabel(heading), 0, 0, 1, 3);
Chris@68 32
Chris@68 33 QWidget *innerWidget = new QWidget;
Chris@68 34 outer->addWidget(innerWidget, 1, 0, 1, 2);
Chris@68 35 m_choiceLayout = new QGridLayout;
Chris@68 36 innerWidget->setLayout(m_choiceLayout);
Chris@68 37
Chris@68 38 m_descriptionLabel = new QLabel;
Chris@68 39 outer->addWidget(m_descriptionLabel, 2, 0, 1, 3);
Chris@68 40
Chris@68 41 m_argLabel = new QLabel();
Chris@68 42 outer->addWidget(m_argLabel, 3, 0);
Chris@68 43
Chris@68 44 m_argEdit = new QLineEdit();
Chris@68 45 outer->addWidget(m_argEdit, 3, 1);
Chris@68 46
Chris@68 47 m_browseButton = new QPushButton(tr("Browse..."));
Chris@68 48 outer->addWidget(m_browseButton, 3, 2);
Chris@68 49
Chris@68 50 QDialogButtonBox *bbox = new QDialogButtonBox(QDialogButtonBox::Ok |
Chris@68 51 QDialogButtonBox::Cancel);
Chris@68 52 connect(bbox, SIGNAL(accepted()), this, SLOT(accept()));
Chris@68 53 connect(bbox, SIGNAL(rejected()), this, SLOT(reject()));
Chris@68 54 outer->addWidget(bbox, 4, 0, 1, 3);
Chris@67 55 }
Chris@68 56