comparison moreinformationdialog.cpp @ 291:2e34e7ee7baf more_information_dialog

Make several operations use the new more-information dialog
author Chris Cannam
date Mon, 21 Feb 2011 15:55:39 +0000
parents c0c254f67346
children fd9dc5a457d8
comparison
equal deleted inserted replaced
290:c0c254f67346 291:2e34e7ee7baf
38 QGridLayout *layout = new QGridLayout; 38 QGridLayout *layout = new QGridLayout;
39 layout->setSpacing(10); 39 layout->setSpacing(10);
40 setLayout(layout); 40 setLayout(layout);
41 41
42 m_iconLabel = new QLabel; 42 m_iconLabel = new QLabel;
43 layout->addWidget(m_iconLabel, 0, 0); 43 layout->addWidget(m_iconLabel, 0, 0, 2, 1, Qt::AlignTop);
44 44
45 QLabel *headLabel = new QLabel(QString("<qt><h3>%1</h3></qt>").arg(head)); 45 QLabel *headLabel = new QLabel(QString("<qt><h3>%1</h3></qt>").arg(head));
46 layout->addWidget(headLabel, 0, 1); 46 layout->addWidget(headLabel, 0, 1);
47 47
48 QLabel *textLabel = new QLabel(text); 48 QLabel *textLabel = new QLabel(text);
49 textLabel->setTextFormat(Qt::RichText); 49 textLabel->setTextFormat(Qt::RichText);
50 layout->addWidget(textLabel, 1, 1); 50 textLabel->setWordWrap(true);
51 layout->addWidget(textLabel, 1, 1, Qt::AlignTop);
51 52
52 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok); 53 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok);
53 connect(bb, SIGNAL(accepted()), this, SLOT(accept())); 54 connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
54 layout->addWidget(bb, 2, 0, 1, 2); 55 layout->addWidget(bb, 2, 0, 1, 2);
55 56
56 m_moreButton = bb->addButton(tr("More Details..."), 57 m_moreButton = bb->addButton(tr("More Details..."),
57 QDialogButtonBox::ActionRole); 58 QDialogButtonBox::ActionRole);
59 m_moreButton->setDefault(false);
58 60
59 connect(m_moreButton, SIGNAL(clicked()), this, SLOT(moreClicked())); 61 connect(m_moreButton, SIGNAL(clicked()), this, SLOT(moreClicked()));
62
63 bb->button(QDialogButtonBox::Ok)->setDefault(true);
60 64
61 m_moreText = new QTextEdit(); 65 m_moreText = new QTextEdit();
62 m_moreText->setAcceptRichText(false); 66 m_moreText->setAcceptRichText(false);
63 m_moreText->document()->setPlainText(more); 67 m_moreText->document()->setPlainText(more);
64 m_moreText->setMinimumWidth(360); 68 m_moreText->setMinimumWidth(360);
70 m_moreText->setFont(font); 74 m_moreText->setFont(font);
71 75
72 layout->addWidget(m_moreText, 3, 0, 1, 2); 76 layout->addWidget(m_moreText, 3, 0, 1, 2);
73 77
74 m_moreText->hide(); 78 m_moreText->hide();
79 if (more == "") m_moreButton->hide();
75 80
81 layout->setRowStretch(1, 20);
76 layout->setColumnStretch(1, 20); 82 layout->setColumnStretch(1, 20);
77 setMinimumWidth(400); 83 setMinimumWidth(400);
78 } 84 }
79 85
80 MoreInformationDialog::~MoreInformationDialog() 86 MoreInformationDialog::~MoreInformationDialog()