本文整理汇总了C++中Q3HBoxLayout::setMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3HBoxLayout::setMargin方法的具体用法?C++ Q3HBoxLayout::setMargin怎么用?C++ Q3HBoxLayout::setMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3HBoxLayout
的用法示例。
在下文中一共展示了Q3HBoxLayout::setMargin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bp
AboutDialog::AboutDialog() : QDialog(0, "About DoUML", TRUE)
{
setCaption(TR("About DoUML"));
//move(p);
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
Q3HBoxLayout * hbox;
vbox->setMargin(5);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPixmap bp((const char **) bp_xpm);
// QLabel * lbp = new QLabel(this);
// lbp->setPixmap(bp);
// hbox->addWidget(lbp);
hbox->addWidget(new QLabel(" ", this));
// Replacing about to bouml-ng
const char htmltext[] = "<p>DoUML</p>\n"
"<p>This project is a fork of\n"
"Bruno Pages's work, BoUML:\n"
"<i>http://sourceforge.net/projects/douml/</i></p>\n"
"<p>DoUML focus is to port BoUML to Qt4\n"
"and to maintain it as a community</p>\n"
"<p>Join us at:<br>\n"
"https://github.com/leonardo2d/douml/<br>\n"
"#[email protected]</p>\n\n\n";
Q3TextView * tx =
new Q3TextView(htmltext, QString(), this);
QFont fnt = tx->font();
fnt.setItalic(TRUE);
QFontMetrics fm(fnt);
tx->setVScrollBarMode(Q3ScrollView::AlwaysOff);
tx->setHScrollBarMode(Q3ScrollView::AlwaysOff);
tx->setMinimumSize(fm.size(0, htmltext));
hbox->addWidget(tx);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * ok = new QPushButton(TR("&OK"), this);
ok->setDefault(TRUE);
hbox->addWidget(new QLabel(this));
hbox->addWidget(ok);
hbox->addWidget(new QLabel(this));
if (UmlDesktop::fixed())
UmlDesktop::tocenter(this);
connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
}
示例2: bp
AboutDialog::AboutDialog() : QDialog(0, "About " PROJECT_NAME, TRUE) {
setCaption(TR("About " PROJECT_NAME));
//move(p);
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
Q3HBoxLayout * hbox;
vbox->setMargin(5);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPixmap bp((const char **) bp_xpm);
QLabel * lbp = new QLabel(this);
// lbp->setPixmap(bp);
// hbox->addWidget(lbp);
hbox->addWidget(new QLabel(" ", this));
QString htmltext;
htmltext.sprintf("%s <b>%d.%d-%d</b> release <b>%s</b><br>\n"
"<br>\n"
"<i>%s</i><br>\n"
"<br>\n"
"%s (<i>%s</i>)",
PROJECT_NAME, PROJECT_MAJOR, PROJECT_MINOR, PROJECT_REVISION, PROJECT_RELEASE,
PROJECT_HOME, PROJECT_ADMIN, PROJECT_CONTACT);
Q3TextView * tx =
new Q3TextView(htmltext, QString::null, this);
QFont fnt = tx->font();
fnt.setItalic(TRUE);
QFontMetrics fm(fnt);
tx->setVScrollBarMode(Q3ScrollView::AlwaysOff);
tx->setHScrollBarMode(Q3ScrollView::AlwaysOff);
tx->setMinimumSize(fm.size(0, htmltext));
hbox->addWidget(tx);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * ok = new QPushButton(TR("&OK"), this);
ok->setDefault( TRUE );
hbox->addWidget(new QLabel(this));
hbox->addWidget(ok);
hbox->addWidget(new QLabel(this));
if (UmlDesktop::fixed())
UmlDesktop::tocenter(this);
connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
}
示例3: QDialog
ConstraintDialog::ConstraintDialog(ConstraintCanvas * c)
: QDialog(0, "ConstraintVisibilityDialog", TRUE, 0), constraint(c)
{
setCaption(TR("Constraints visibility dialog"));
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
vbox->setMargin(5);
table = new ConstraintTable(this, constraint);
vbox->addWidget(table);
vbox->addWidget(new QLabel(this));
Q3HBoxLayout * hbox;
hbox = new Q3HBoxLayout(vbox);
cb_visible = new QCheckBox(TR("Specify visible elements rather than hidden ones"), this);
cb_visible->setChecked(constraint->indicate_visible);
hbox->addWidget(cb_visible);
QPushButton * showall = new QPushButton(TR("Show all"), this);
QPushButton * hideall = new QPushButton(TR("Hide all"), this);
QPushButton * hideinherited = new QPushButton(TR("Hide inherited"), this);
QSize bs = hideinherited->sizeHint();
showall->setFixedSize(bs);
hideall->setFixedSize(bs);
hideinherited->setFixedSize(bs);
hbox->addWidget(new QLabel(this));
hbox->addWidget(showall);
hbox->addWidget(new QLabel(this));
hbox->addWidget(hideall);
hbox->addWidget(new QLabel(this));
hbox->addWidget(hideinherited);
hbox->addWidget(new QLabel(this));
connect(showall, SIGNAL(clicked()), this, SLOT(show_all()));
connect(hideall, SIGNAL(clicked()), this, SLOT(hide_all()));
connect(hideinherited, SIGNAL(clicked()), this, SLOT(hide_inherited()));
vbox->addWidget(new QLabel(this));
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * ok = new QPushButton(TR("&OK"), this);
QPushButton * cancel = new QPushButton(TR("&Cancel"), this);
ok->setDefault(TRUE);
bs = cancel->sizeHint();
ok->setFixedSize(bs);
cancel->setFixedSize(bs);
hbox->addWidget(ok);
hbox->addWidget(cancel);
connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
示例4: bs
ClassSettingsDialog::ClassSettingsDialog(ClassSettings * se, bool nodefault)
: QDialog(0, "Class Settings dialog", TRUE), settings(se) {
setCaption(TR("Class Settings dialog"));
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
Q3HBoxLayout * hbox;
QString s;
vbox->setMargin(5);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
hbox->addWidget(new QLabel(TR("default attributes visibility : "), this), 1000);
cbattribute = new ComboVisibility(this, settings->attribute_visibility, nodefault);
hbox->addWidget(cbattribute);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
hbox->addWidget(new QLabel(TR("default relations visibility : "), this), 1000);
cbrelation = new ComboVisibility(this, settings->relation_visibility, nodefault);
hbox->addWidget(cbrelation);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
hbox->addWidget(new QLabel(TR("default operations visibility : "), this), 1000);
cboperation = new ComboVisibility(this, settings->operation_visibility, nodefault);
hbox->addWidget(cboperation);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * accept = new QPushButton(TR("&OK"), this);
QPushButton * cancel = new QPushButton(TR("&Cancel"), this);
QSize bs(cancel->sizeHint());
accept->setDefault(TRUE);
accept->setFixedSize(bs);
cancel->setFixedSize(bs);
hbox->addWidget(accept);
hbox->addWidget(cancel);
connect(accept, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
示例5: QDialog
ReferenceDialog::ReferenceDialog(BrowserNode * bn)
: QDialog(0, "Referenced By dialog", FALSE, Qt::WDestructiveClose)
{
the = this;
target = bn;
setCaption(TR("Referenced By dialog"));
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
vbox->setMargin(5);
QString s = target->get_name();
s += TR(" is referenced by :");
vbox->addWidget(new QLabel(s, this));
results = new Q3ComboBox(FALSE, this);
vbox->addWidget(results);
Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox);
QPushButton * search_b = new QPushButton(TR("Recompute"), this);
QPushButton * close_b = new QPushButton(TR("Close"), this);
hbox->setMargin(5);
hbox->addWidget(search_b);
hbox->addWidget(select_b = new QPushButton(TR("Select"), this));
hbox->addWidget(mark_unmark_b = new QPushButton(TR("Unmark"), this));
hbox->addWidget(mark_them_b = new QPushButton(TR("Mark them"), this));
hbox->addWidget(unmark_all_b = new QPushButton(TR("Unmark all"), this));
hbox->addWidget(close_b);
search_b->setDefault(TRUE);
connect(search_b, SIGNAL(clicked()), this, SLOT(compute()));
connect(select_b, SIGNAL(clicked()), this, SLOT(select()));
connect(close_b, SIGNAL(clicked()), this, SLOT(reject()));
connect(mark_unmark_b, SIGNAL(clicked()), this, SLOT(mark_unmark()));
connect(mark_them_b, SIGNAL(clicked()), this, SLOT(mark_them()));
connect(unmark_all_b, SIGNAL(clicked()), this, SLOT(unmark_all()));
connect(results, SIGNAL(activated(int)), this, SLOT(selected(int)));
compute();
open_dialog(this);
}
示例6: QDialog
BrowserSearchDialog::BrowserSearchDialog(const QPoint & p)
: QDialog(0, "Browser search", TRUE) {
setCaption("Browser search");
move(p);
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
vbox->setMargin(5);
Q3GridLayout * gl = new Q3GridLayout(vbox, 4, 2, 5/*space*/);
ed = new QLineEdit(this);
ed->setText(saved_ed);
gl->addWidget(new QLabel("Containing", this), 1, 0, Qt::AlignLeft);
gl->addWidget(ed, 1, 1);
Q3GroupBox * gb = new Q3GroupBox(2, Qt::Horizontal, this);
case_sensitive = new QCheckBox("case sensitive", gb);
case_sensitive->setChecked(saved_case_sensitive);
gl->addWidget(gb, 2, 1);
gl->addWidget(new QLabel("Result", this), 3, 0, Qt::AlignLeft);
results = new Q3ComboBox(FALSE, this);
gl->addWidget(results, 3, 1);
Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * search_b = new QPushButton("Search", this);
QPushButton * select_b = new QPushButton("Select", this);
QPushButton * close_b = new QPushButton("Close", this);
search_b->setDefault(TRUE);
hbox->addWidget(search_b);
hbox->addWidget(select_b);
hbox->addWidget(close_b);
connect(search_b, SIGNAL(clicked()), this, SLOT(search()));
connect(select_b, SIGNAL(clicked()), this, SLOT(select()));
connect(close_b, SIGNAL(clicked()), this, SLOT(reject()));
setMaximumHeight(sizeHint().height());
}
示例7: bs
OperationListDialog::OperationListDialog(const char * m,
Q3PtrList<BrowserOperation> & l)
: QDialog(0, m, TRUE) {
setCaption(m);
move(QCursor::pos());
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
Q3HBoxLayout * hbox;
vbox->setMargin(5);
cb = new Q3ComboBox(FALSE, this);
vbox->addWidget(cb);
for (BrowserOperation * oper = l.first(); oper; oper = l.next()) {
QString s = ((BrowserNode *) oper->parent())->get_name() +
QString("::") + oper->get_data()->definition(TRUE, FALSE);
if (((OperationData *) oper->get_data())->get_is_abstract())
cb->insertItem("[a] " + s);
else
cb->insertItem(s);
}
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * ok = new QPushButton(TR("&OK"), this);
QPushButton * cancel = new QPushButton(TR("&Cancel"), this);
QSize bs(cancel->sizeHint());
ok->setDefault(TRUE);
ok->setFixedSize(bs);
cancel->setFixedSize(bs);
hbox->addWidget(ok);
hbox->addWidget(cancel);
UmlDesktop::limitsize_center(this, previous_size, 0.8, 0.8);
connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
示例8: bs
ClassListDialog::ClassListDialog(const char * m,
const Q3ValueList<BrowserClass *> & l)
: QDialog(0, m, TRUE) {
setCaption(m);
move(QCursor::pos());
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
Q3HBoxLayout * hbox;
vbox->setMargin(5);
cb = new Q3ComboBox(FALSE, this);
vbox->addWidget(cb);
Q3ValueList<BrowserClass *>::ConstIterator end = l.end();
Q3ValueList<BrowserClass *>::ConstIterator it;
for (it = l.begin(); it != end; ++it)
if (!(*it)->deletedp())
cb->insertItem((*it)->full_name(TRUE));
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * ok = new QPushButton(TR("&OK"), this);
QPushButton * cancel = new QPushButton(TR("&Cancel"), this);
QSize bs(cancel->sizeHint());
ok->setDefault(TRUE);
ok->setFixedSize(bs);
cancel->setFixedSize(bs);
hbox->addWidget(ok);
hbox->addWidget(cancel);
connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
UmlDesktop::limitsize_center(this, previous_size, 0.8, 0.8);
}
示例9: QLabel
CodAddMsgDialog::CodAddMsgDialog(CodObjCanvas * from, CodObjCanvas * to,
CodMsgSupport * i, ColDiagramView * v,
bool fo)
: QDialog(0, "add msg dialog", TRUE), in(i), view(v), forward(fo)
{
setCaption(TR("Add message dialog"));
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
Q3HBoxLayout * hbox;
vbox->setMargin(5);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(10);
QLabel * label1 = new QLabel(TR("Add message to %1", to->get_full_name()), this);
label1->setAlignment(Qt::AlignCenter);
hbox->addWidget(label1);
Q3Grid * grid = new Q3Grid(2, this);
vbox->addWidget(grid);
new QLabel(TR("rank : "), grid);
cbrank = new Q3ComboBox(FALSE, grid);
ColMsgList all_in;
ColMsgList all_out;
from->get_all_in_all_out(all_in, all_out);
QStringList new_ones;
foreach (ColMsg *m, all_out) {
QString s = m->next_hierarchical_rank();
if ((s.find('.') != - 1) && (ColMsg::find(s, all_out) == 0)) {
cbrank->insertItem(QString::number(m->get_rank() + 1) + " : " + s);
new_ones.append(s);
}
}
示例10: QDialog
BrowserSearchDialog::BrowserSearchDialog()
: QDialog(0, "Browser search", FALSE, Qt::WDestructiveClose)
{
the = this;
setCaption(TR("Browser search"));
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
vbox->setMargin(5);
Q3GridLayout * gl = new Q3GridLayout(vbox, 4, 2, 5/*space*/);
gl->addWidget(new QLabel(TR("Kind"), this), 0, 0, Qt::AlignLeft);
kind = new Q3ComboBox(FALSE, this);
for (int index = 0; index != sizeof(Kinds) / sizeof(*Kinds); index += 1)
kind->insertItem(TR(Kinds[index].lbl));
kind->setCurrentItem(saved_kind);
gl->addWidget(kind, 0, 1);
ed = new LineEdit(this);
ed->setText(saved_ed);
gl->addWidget(new QLabel(TR("Containing"), this), 1, 0, Qt::AlignLeft);
gl->addWidget(ed, 1, 1);
ed->setFocus();
Q3HBox * hb = new Q3HBox(this);
gl->addWidget(hb, 2, 1);
Q3GroupBox * gb = new Q3GroupBox(2, Qt::Horizontal, hb);
case_sensitive = new QCheckBox(TR("case sensitive"), gb);
case_sensitive->setChecked(saved_case_sensitive);
even_deleted = new QCheckBox(TR("even deleted"), gb);
even_deleted->setChecked(saved_even_deleted);
Q3ButtonGroup * bg = new Q3ButtonGroup(4, Qt::Horizontal, hb);
bg->setExclusive(TRUE);
for_name = new QRadioButton(TR("name"), bg);
for_name->setChecked(saved_name);
for_stereotype = new QRadioButton(TR("stereotype"), bg);
for_stereotype->setChecked(saved_stereotype);
for_comment = new QRadioButton(TR("description"), bg);
for_comment->setChecked(saved_comment);
for_decldefbody = new QRadioButton(TR("declaration/definition/body"), bg);
for_decldefbody->setChecked(saved_decldefbody);
gl->addWidget(new QLabel(TR("Result"), this), 3, 0, Qt::AlignLeft);
results = new Q3ComboBox(FALSE, this);
gl->addWidget(results, 3, 1);
Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox);
QPushButton * search_b = new QPushButton(TR("Search"), this);
QPushButton * close_b = new QPushButton(TR("Close"), this);
hbox->setMargin(5);
hbox->addWidget(search_b);
hbox->addWidget(select_b = new QPushButton(TR("Select"), this));
hbox->addWidget(mark_unmark_b = new QPushButton(TR("Unmark"), this));
hbox->addWidget(mark_them_b = new QPushButton(TR("Mark them"), this));
hbox->addWidget(unmark_all_b = new QPushButton(TR("Unmark all"), this));
hbox->addWidget(close_b);
search_b->setDefault(TRUE);
connect(search_b, SIGNAL(clicked()), this, SLOT(search()));
connect(select_b, SIGNAL(clicked()), this, SLOT(select()));
connect(close_b, SIGNAL(clicked()), this, SLOT(reject()));
connect(mark_unmark_b, SIGNAL(clicked()), this, SLOT(mark_unmark()));
connect(mark_them_b, SIGNAL(clicked()), this, SLOT(mark_them()));
connect(unmark_all_b, SIGNAL(clicked()), this, SLOT(unmark_all()));
connect(results, SIGNAL(activated(int)), this, SLOT(selected(int)));
if ((saved_kind != 0) || !saved_ed.isEmpty())
search();
else
selected(-1);
open_dialog(this);
}
示例11: bs
FragmentDialog::FragmentDialog(const QStringList & defaults, QString & s,
QString & fo, BrowserNode *& d)
: QDialog(0, "Fragment dialog", TRUE), name(s), form(fo), refer(d)
{
setCaption(TR("Fragment dialog"));
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
Q3HBoxLayout * hbox;
QLabel * lbl1;
QLabel * lbl2;
SmallPushButton * refer_bt;
BrowserNode * bn;
vbox->setMargin(5);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
hbox->addWidget(lbl1 = new QLabel(TR("name : "), this));
name_cb = new Q3ComboBox(TRUE, this);
name_cb->insertItem(name);
name_cb->setCurrentItem(0);
name_cb->insertStringList(defaults);
name_cb->setAutoCompletion(completion());
hbox->addWidget(name_cb);
QSizePolicy sp = name_cb->sizePolicy();
sp.setHorData(QSizePolicy::Expanding);
name_cb->setSizePolicy(sp);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
hbox->addWidget(refer_bt = new SmallPushButton(TR("refer to : "), this));
connect(refer_bt, SIGNAL(clicked()), this, SLOT(menu_refer()));
diag_cb = new Q3ComboBox(FALSE, this);
BrowserDiagram::instances(nodes, TRUE);
diag_cb->insertItem("");
for (bn = nodes.first(); bn != 0; bn = nodes.next())
diag_cb->insertItem(*(bn->pixmap(0)), bn->full_name(TRUE));
diag_cb->setCurrentItem((refer == 0)
? 0
: nodes.findRef(refer) + 1);
diag_cb->setSizePolicy(sp);
hbox->addWidget(diag_cb);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
hbox->addWidget(lbl2 = new QLabel(TR("arguments \n/ value : "), this));
hbox->addWidget(ed_form = new LineEdit(this));
ed_form->setText(form);
same_width(lbl1, lbl2, refer_bt);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * accept = new QPushButton(TR("&OK"), this);
QPushButton * cancel = new QPushButton(TR("&Cancel"), this);
QSize bs(cancel->sizeHint());
accept->setDefault(TRUE);
accept->setFixedSize(bs);
cancel->setFixedSize(bs);
hbox->addWidget(accept);
hbox->addWidget(cancel);
connect(accept, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
示例12: bd
TesterTestPage::TesterTestPage (QWidget *p) : QWidget (p)
{
fieldList.append(tr("Open"));
fieldList.append(tr("Close"));
fieldList.append(tr("Mid Point"));
Q3HBoxLayout *hbox = new Q3HBoxLayout(this);
hbox->setMargin(5);
hbox->setSpacing(10);
// left side grid
Q3GridLayout *grid = new Q3GridLayout(hbox);
grid->setColStretch(1, 1);
grid->setSpacing(5);
// trades area
tradeLong = new QCheckBox(tr("Long"), this);
grid->addWidget(tradeLong, 0, 0);
tradeShort = new QCheckBox(tr("Short"), this);
grid->addWidget(tradeShort, 1, 0);
QLabel *label = new QLabel(tr("Trade Delay"), this);
grid->addWidget(label, 2, 0);
tradeDelay = new QSpinBox(1, 999999, 1, this);
tradeDelay->setValue(1);
grid->addWidget(tradeDelay, 2, 1);
grid->setRowSpacing(grid->numRows(), 25);
// account area
label = new QLabel(tr("Account Balance"), this);
grid->addWidget(label, 4, 0);
account = new QSpinBox(0, 999999, 1, this);
account->setValue(10000);
grid->addWidget(account, 4, 1);
label = new QLabel(tr("Futures Margin"), this);
grid->addWidget(label, 5, 0);
margin = new QSpinBox(0, 999999, 1, this);
grid->addWidget(margin, 5, 1);
label = new QLabel(tr("Volume %"), this);
grid->addWidget(label, 6, 0);
volumePercent = new QSpinBox(0, 100, 1, this);
grid->addWidget(volumePercent, 6, 1);
grid->setRowSpacing(grid->numRows(), 25);
// commission area
commissionType = new QCheckBox(tr("Use Commission %"), this);
grid->addWidget(commissionType, 8, 0);
label = new QLabel(tr("Entry"), this);
grid->addWidget(label, 9, 0);
QDoubleValidator *dv = new QDoubleValidator(0, 99999999.0, 4, this, 0);
entryCom = new QLineEdit(QString::number(10), this);
entryCom->setValidator(dv);
grid->addWidget(entryCom, 9, 1);
label = new QLabel(tr("Exit"), this);
grid->addWidget(label, 10, 0);
QDoubleValidator *dv2 = new QDoubleValidator(0, 99999999.0, 4, this, 0);
exitCom = new QLineEdit(QString::number(10), this);
exitCom->setValidator(dv2);
grid->addWidget(exitCom, 10, 1);
grid->setRowStretch(grid->numRows() + 1, 1);
// vline sperarator
Q3Frame *line = new Q3Frame(this);
line->setFrameStyle(Q3Frame::VLine | Q3Frame::Plain);
hbox->addWidget(line);
// right side grid
grid = new Q3GridLayout(hbox);
grid->setColStretch(1, 1);
grid->setSpacing(5);
// test area
label = new QLabel(tr("Symbol"), this);
grid->addWidget(label, 0, 0);
Config config;
QString s, s2;
config.getData(Config::DataPath, s);
symbolButton = new SymbolButton(this, s, s2);
//.........这里部分代码省略.........
示例13: QLabel
SynchroDialog::SynchroDialog(Q3PtrList<BrowserView> & b)
: QDialog(0, "Synchronize", TRUE), browsers(b) {
setCaption("Synchronize");
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
Q3HBoxLayout * hbox;
vbox->setMargin(5);
bool has_ro = FALSE;
bool has_ro_need_update = FALSE;
bool has_need_update = FALSE;
Q3PtrListIterator<BrowserView> it(browsers);
for (; it.current(); ++it) {
if (it.current()->is_need_update()) {
if (it.current()->is_cant_update()) {
has_ro = TRUE;
has_ro_need_update = TRUE;
}
else
has_need_update = TRUE;
}
}
QLabel * lbl;
if (has_need_update) {
lbl =
new QLabel("\nChoose the projects to synchronize with the others\n",
this);
lbl->setAlignment(::Qt::AlignCenter);
vbox->addWidget(lbl);
if (has_ro_need_update) {
lbl =
new QLabel("\nWarning : some projects can't be synchronized because of read-only files\n",
this);
lbl->setAlignment(::Qt::AlignCenter);
vbox->addWidget(lbl);
}
}
else if (has_ro_need_update) {
lbl =
new QLabel("\nSynchronisation not possible because of read-only files\n",
this);
lbl->setAlignment(::Qt::AlignCenter);
vbox->addWidget(lbl);
}
else {
lbl =
new QLabel("\nAll the projects are synchronized\n",
this);
lbl->setAlignment(::Qt::AlignCenter);
vbox->addWidget(lbl);
}
//
for (it.toFirst() ; it.current(); ++it) {
if (it.current()->is_need_update()) {
QCheckBox * cb = new QCheckBox(it.current()->get_dir().path(), this);
vbox->addWidget(cb);
if (it.current()->is_cant_update())
cb->setEnabled(FALSE);
else
checks.append(cb);
}
}
//
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
if (has_need_update) {
QPushButton * ok = new QPushButton("Synchronize", this);
hbox->addWidget(new QLabel(this));
hbox->addWidget(ok);
connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
}
QPushButton * cancel = new QPushButton("Cancel", this);
hbox->addWidget(new QLabel(this));
hbox->addWidget(cancel);
hbox->addWidget(new QLabel(this));
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
示例14: QLabel
AnnotationDialog::AnnotationDialog(QWidget * parent, QString & s, bool visit)
: QDialog(parent, "annotation editor", TRUE), value(s)
{
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
vbox->setMargin(5);
// multiline edit
e = new MultiLineEdit(this);
e->setText(s);
vbox->addWidget(e);
if (! visit) {
e->setFocus();
// to choose and add an annotation
QLabel * label =
new QLabel(TR("\nTo add an annotation at the cursor position\n"
"you may select it in the list and press 'add'\n"),
this);
label->setAlignment(Qt::AlignCenter);
vbox->addWidget(label);
Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox);
QPushButton * add_button;
hbox->setMargin(5);
add_button = new QPushButton(TR("Add "), this);
hbox->addWidget(add_button);
connect(add_button, SIGNAL(clicked()), this, SLOT(add_annotation()));
cb = new Q3ComboBox(FALSE, this);
QSizePolicy sp = cb->sizePolicy();
sp.setHorData(QSizePolicy::Expanding);
cb->setSizePolicy(sp);
cb->setAutoCompletion(completion());
for (int i = 0;
i != sizeof(DefaultAnnotations) / sizeof(*DefaultAnnotations);
i += 1)
cb->insertItem(DefaultAnnotations[i]);
QStringList list;
BrowserClass::instances(annotations, "@interface");
if (! annotations.isEmpty()) {
annotations.full_names(list);
cb->insertStringList(list);
}
hbox->addWidget(cb);
// buttons ok, cancel
vbox->addWidget(new QLabel("", this));
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * accept = new QPushButton(TR("&OK"), this);
QPushButton * cancel = new QPushButton(TR("&Cancel"), this);
QSize bs(cancel->sizeHint());
accept->setDefault(TRUE);
accept->setFixedSize(bs);
cancel->setFixedSize(bs);
hbox->addWidget(accept);
hbox->addWidget(cancel);
connect(accept, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
else {
e->setReadOnly(TRUE);
// buttons cancel
vbox->addWidget(new QLabel("", this));
Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * close = new QPushButton(TR("&Close"), this);
hbox->addWidget(close);
connect(close, SIGNAL(clicked()), this, SLOT(reject()));
}
// not done in polish else the initial size is too small
UmlDesktop::setsize_center(this, previous_size, 0.3, 0.3);
}
示例15: QLabel
UserDialog::UserDialog(const QPoint & p)
: QDialog(0, "Browser search", TRUE) {
setCaption("Choose user");
move(p);
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
Q3HBoxLayout * hbox;
QLabel * lbl1;
QLabel * lbl2;
vbox->setMargin(5);
QLabel * lbl =
new QLabel("\nSelect a user to get its identity,\nyou may change or set his name\n",
this);
lbl->setAlignment(::Qt::AlignCenter);
vbox->addWidget(lbl);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
lbl1 = new QLabel("User : ", this);
hbox->addWidget(lbl1);
ids = new Q3ComboBox(FALSE, this);
for (int index = 2; index != 128; index += 1) {
QString s = user_name(index);
ids->insertItem((s.isEmpty())
? QString::number(index)
: QString::number(index) + " (" + s + ")");
}
ids->setCurrentItem(user_id() - 2);
QSizePolicy sp = ids->sizePolicy();
sp.setHorData(QSizePolicy::Expanding);
ids->setSizePolicy(sp);
hbox->addWidget(ids);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
lbl2 = new QLabel("New name : ", this);
lbl1->setFixedWidth(lbl2->sizeHint().width());
hbox->addWidget(lbl2);
edname = new QLineEdit(this);
hbox->addWidget(edname);
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * ok = new QPushButton("Ok", this);
QPushButton * cancel = new QPushButton("Cancel", this);
hbox->addWidget(new QLabel(this));
hbox->addWidget(ok);
hbox->addWidget(new QLabel(this));
hbox->addWidget(cancel);
hbox->addWidget(new QLabel(this));
connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}