本文整理汇总了C++中QLabel::hide方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::hide方法的具体用法?C++ QLabel::hide怎么用?C++ QLabel::hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::hide方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GcWindow
CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent, bool rangemode) :
GcWindow(parent), _dateRange("{00000000-0000-0000-0000-000000000001}"), home(home), mainWindow(parent), currentRide(NULL), rangemode(rangemode), stale(true), useCustom(false)
{
setInstanceName("Critical Power Window");
// main plot area
QVBoxLayout *vlayout = new QVBoxLayout;
cpintPlot = new CpintPlot(mainWindow, home.path(), mainWindow->zones());
vlayout->addWidget(cpintPlot);
setLayout(vlayout);
// controls
QWidget *c = new QWidget;
QFormLayout *cl = new QFormLayout(c);
setControls(c);
#ifdef GC_HAVE_LUCENE
// searchbox
searchBox = new SearchFilterBox(this, parent);
connect(searchBox, SIGNAL(searchClear()), cpintPlot, SLOT(clearFilter()));
connect(searchBox, SIGNAL(searchResults(QStringList)), cpintPlot, SLOT(setFilter(QStringList)));
connect(searchBox, SIGNAL(searchClear()), this, SLOT(filterChanged()));
connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(filterChanged()));
cl->addRow(new QLabel(tr("Filter")), searchBox);
cl->addWidget(new QLabel("")); //spacing
#endif
// picker details
QLabel *cpintTimeLabel = new QLabel(tr("Duration:"), this);
cpintTimeValue = new QLineEdit("0 s");
QLabel *cpintTodayLabel = new QLabel(tr("Today:"), this);
cpintTodayValue = new QLabel(tr("no data"));
QLabel *cpintAllLabel = new QLabel(tr("Best:"), this);
cpintAllValue = new QLabel(tr("no data"));
QLabel *cpintCPLabel = new QLabel(tr("CP Curve:"), this);
cpintCPValue = new QLabel(tr("no data"));
//QFontMetrics metrics(QApplication::font());
//int width = metrics.width("8888 watts (88/88/8888)") + 10;
//cpintAllValue->setFixedWidth(width);
//cpintCPValue->setFixedWidth(width); // so lines up nicely
cpintTimeValue->setReadOnly(false);
//cpintTodayValue->setReadOnly(true);
//cpintAllValue->setReadOnly(true);
//cpintCPValue->setReadOnly(true);
QFont font = cpintTimeValue->font();
font.setPointSize(font.pointSize());
cpintTodayValue->setFont(font);
cpintAllValue->setFont(font);
cpintCPValue->setFont(font);
cl->addRow(cpintTimeLabel, cpintTimeValue);
cl->addRow(cpintTodayLabel, cpintTodayValue);
cl->addRow(cpintAllLabel, cpintAllValue);
cl->addRow(cpintCPLabel, cpintCPValue);
cl->addWidget(new QLabel("")); //spacing
// tools /properties
seriesCombo = new QComboBox(this);
addSeries();
cComboSeason = new QComboBox(this);
seasons = parent->seasons;
resetSeasons();
QLabel *label = new QLabel(tr("Date range"));
QLabel *label2 = new QLabel(tr("Date range"));
if (rangemode) {
cComboSeason->hide();
label2->hide();
}
cpintSetCPButton = new QPushButton(tr("&Save CP value"), this);
cpintSetCPButton->setEnabled(false);
cl->addRow(label2, cComboSeason);
dateSetting = new DateSettingsEdit(this);
cl->addRow(label, dateSetting);
if (rangemode == false) {
dateSetting->hide();
label->hide();
}
cl->addWidget(new QLabel("")); //spacing
cl->addRow(new QLabel(tr("Data series")), seriesCombo);
cl->addRow(new QLabel(""), cpintSetCPButton);
picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
QwtPicker::VLineRubberBand,
QwtPicker::AlwaysOff, cpintPlot->canvas());
picker->setStateMachine(new QwtPickerDragPointMachine);
picker->setRubberBandPen(GColor(CPLOTTRACKER));
connect(picker, SIGNAL(moved(const QPoint &)), SLOT(pickerMoved(const QPoint &)));
connect(cpintTimeValue, SIGNAL(editingFinished()), this, SLOT(cpintTimeValueEntered()));
connect(cpintSetCPButton, SIGNAL(clicked()), this, SLOT(cpintSetCPButtonClicked()));
if (rangemode) {
connect(this, SIGNAL(dateRangeChanged(DateRange)), SLOT(dateRangeChanged(DateRange)));
} else {
//.........这里部分代码省略.........
示例2: QWidget
//.........这里部分代码省略.........
loadTitleButton->setFocusPolicy(Qt::NoFocus);
QMenu *selectIconMenu = new QMenu();
selectIconMenu->addAction(tr("Load Favicon"));
selectIconMenu->addSeparator();
selectIconMenu->addAction(tr("Select Icon..."));
selectIconButton_ = new QToolButton(this);
selectIconButton_->setIconSize(QSize(16, 16));
selectIconButton_->setToolTip(tr("Select Icon"));
selectIconButton_->setFocusPolicy(Qt::NoFocus);
selectIconButton_->setPopupMode(QToolButton::MenuButtonPopup);
selectIconButton_->setMenu(selectIconMenu);
layoutGeneralTitle->addWidget(editTitle, 1);
layoutGeneralTitle->addWidget(loadTitleButton);
layoutGeneralTitle->addWidget(selectIconButton_);
editURL = new LineEdit();
disableUpdate_ = new QCheckBox(tr("Disable update"));
disableUpdate_->setChecked(false);
updateEnable_ = new QCheckBox(tr("Automatically update every"));
updateInterval_ = new QSpinBox();
updateInterval_->setEnabled(false);
updateInterval_->setRange(1, 9999);
connect(updateEnable_, SIGNAL(toggled(bool)),
updateInterval_, SLOT(setEnabled(bool)));
updateIntervalType_ = new QComboBox(this);
updateIntervalType_->setEnabled(false);
QStringList intervalTypeList;
intervalTypeList << tr("seconds") << tr("minutes") << tr("hours");
updateIntervalType_->addItems(intervalTypeList);
connect(updateEnable_, SIGNAL(toggled(bool)),
updateIntervalType_, SLOT(setEnabled(bool)));
QHBoxLayout *updateFeedsLayout = new QHBoxLayout();
updateFeedsLayout->setMargin(0);
updateFeedsLayout->addWidget(updateEnable_);
updateFeedsLayout->addWidget(updateInterval_);
updateFeedsLayout->addWidget(updateIntervalType_);
updateFeedsLayout->addStretch();
connect(disableUpdate_, SIGNAL(toggled(bool)),
updateEnable_, SLOT(setDisabled(bool)));
connect(disableUpdate_, SIGNAL(toggled(bool)),
updateInterval_, SLOT(setDisabled(bool)));
connect(disableUpdate_, SIGNAL(toggled(bool)),
updateIntervalType_, SLOT(setDisabled(bool)));
starredOn_ = new QCheckBox(tr("Starred"));
displayOnStartup = new QCheckBox(tr("Display in new tab on startup"));
duplicateNewsMode_ = new QCheckBox(tr("Automatically delete duplicate news"));
QHBoxLayout *layoutGeneralHomepage = new QHBoxLayout();
labelHomepage = new QLabel();
labelHomepage->setOpenExternalLinks(true);
layoutGeneralHomepage->addWidget(labelHomepageCapt);
layoutGeneralHomepage->addWidget(labelHomepage, 1);
layoutGeneralGrid->addWidget(labelTitleCapt, 0, 0);
layoutGeneralGrid->addLayout(layoutGeneralTitle, 0 ,1);
layoutGeneralGrid->addWidget(labelURLCapt, 1, 0);
layoutGeneralGrid->addWidget(editURL, 1, 1);
QVBoxLayout *tabLayout = new QVBoxLayout(tab);
tabLayout->setMargin(10);
tabLayout->setSpacing(5);
tabLayout->addLayout(layoutGeneralGrid);
tabLayout->addLayout(layoutGeneralHomepage);
tabLayout->addSpacing(15);
tabLayout->addWidget(disableUpdate_);
tabLayout->addLayout(updateFeedsLayout);
tabLayout->addSpacing(15);
tabLayout->addWidget(starredOn_);
tabLayout->addWidget(displayOnStartup);
tabLayout->addWidget(duplicateNewsMode_);
tabLayout->addStretch();
connect(loadTitleButton, SIGNAL(clicked()), this, SLOT(setDefaultTitle()));
connect(selectIconButton_, SIGNAL(clicked()),
this, SLOT(selectIcon()));
connect(selectIconMenu->actions().at(0), SIGNAL(triggered()),
this, SLOT(loadDefaultIcon()));
connect(selectIconMenu->actions().at(2), SIGNAL(triggered()),
this, SLOT(selectIcon()));
if (!isFeed_) {
loadTitleButton->hide();
selectIconButton_->hide();
labelURLCapt->hide();
editURL->hide();
labelHomepageCapt->hide();
labelHomepage->hide();
starredOn_->hide();
duplicateNewsMode_->hide();
}
return tab;
}
示例3: fileDlg
ISOSelectView::ISOSelectView(QWidget *parent) : QFrame(parent)
{
setObjectName("ISOSelectView");
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(0, 9, 0, 0);
QLabel *m_title = new QLabel(tr("Select an ISO image file"));
m_title->setFixedHeight(38);
m_title->setStyleSheet("font-size: 26px;");
QLabel *isoIcon = new QLabel(this);
isoIcon->setObjectName("ISOIcon");
isoIcon->setFixedSize(96, 96);
isoIcon->setPixmap(WidgetUtil::getDpiPixmap(":/theme/light/image/media-optical-96px.svg", this));
QLabel *growIcon = new QLabel(this);
growIcon->setObjectName("GrowIcon");
growIcon->setPixmap(WidgetUtil::getDpiPixmap(":/theme/light/image/glow.svg", this));
growIcon->setFixedSize(220, 220);
growIcon->hide();
DropFrame *isoPanel = new DropFrame;
isoPanel->setObjectName("IosPanel");
isoPanel->setFixedSize(412, 322);
QVBoxLayout *isoPanelLayout = new QVBoxLayout(isoPanel);
isoPanelLayout->setMargin(0);
m_fileLabel = new QLabel(tr("Drag an ISO image file and drop it here"));
m_fileLabel->setObjectName("IsoFileName");
// m_fileLabel->setFixedHeight(18);
m_hits = new QLabel(tr("OR"));
m_hits->setObjectName("IsoHits");
m_hits->setFixedHeight(18);
QLabel *spliter = new QLabel;
spliter->setObjectName("IsoSpliter");
spliter->setFixedSize(230, 1);
m_fileSelect = new QLabel();
m_fileSelect->setObjectName("IsoFileSelect");
// m_fileSelect->setFixedHeight(15);
m_fileSelect->setOpenExternalLinks(false);
QString selectText = tr("Select an ISO image file");
QString linkText = QString(s_linkTemplate).arg(selectText).arg(selectText);
m_fileSelect->setText(linkText);
isoPanelLayout->addSpacing(62);
isoPanelLayout->addWidget(isoIcon, 0, Qt::AlignCenter);
isoPanelLayout->addSpacing(5);
isoPanelLayout->addWidget(m_fileLabel, 0, Qt::AlignCenter);
isoPanelLayout->addSpacing(4);
isoPanelLayout->addWidget(m_hits, 0, Qt::AlignCenter);
isoPanelLayout->addSpacing(7);
isoPanelLayout->addWidget(spliter, 0, Qt::AlignCenter);
isoPanelLayout->addSpacing(12);
isoPanelLayout->addWidget(m_fileSelect, 0, Qt::AlignCenter);
isoPanelLayout->addStretch();
m_nextSetp = new SuggestButton();
m_nextSetp->setObjectName("NextStepButton");
m_nextSetp->setText(tr("Next"));
m_nextSetp->setDisabled(true);
mainLayout->addWidget(m_title, 0, Qt::AlignCenter);
mainLayout->addSpacing(24);
mainLayout->addWidget(isoPanel, 0, Qt::AlignCenter);
mainLayout->addStretch();
mainLayout->addWidget(m_nextSetp, 0, Qt::AlignCenter);
this->setStyleSheet(WidgetUtil::getQss(":/theme/light/ISOSelectView.theme"));
#ifdef Q_OS_WIN
m_fileLabel->hide();
spliter->hide();
m_hits->hide();
#endif
connect(isoPanel, &DropFrame::fileAboutAccept, this, [ = ]() {
growIcon->show();
auto center = isoIcon->geometry().center();
growIcon->move(center);
auto topleft = growIcon->mapFromGlobal(isoIcon->mapToGlobal(center));
auto offset = 220 - 96;
topleft.setX(topleft.x() - offset / 2);
topleft.setY(topleft.y() - offset / 2);
growIcon->move(topleft);
isoPanel->setProperty("active", true);
this->style()->unpolish(isoPanel);
this->style()->polish(isoPanel);
});
connect(isoPanel, &DropFrame::fileCancel, this, [ = ]() {
growIcon->hide();
isoPanel->setProperty("active", false);
this->style()->unpolish(isoPanel);
this->style()->polish(isoPanel);
});
connect(m_fileSelect, &QLabel::linkActivated, this, [ = ](const QString & /*link*/) {
QFileDialog fileDlg(this);
//.........这里部分代码省略.........
示例4: main
//.........这里部分代码省略.........
layout->addWidget(text);
layout->addLayout(pane);
/* the window */
window.centralWidget()->setLayout(layout);
window.show();
/* future hashing */
QFutureWatcher<Vals> zu;
QObject::connect(&zu, &QFutureWatcher<Vals>::finished,
[&]() {
Vals valsi = zu.future().result();
window.idle(true);
if (valsi.path == "") {
error->setText(QString::fromStdString(valsi.name));
hash->setChecked(false);
} else {
error->clear();
vals += valsi;
test->textChanged(test->text());
}
});
QObject::connect(meth, &QComboBox::currentTextChanged,
[&](const QString &text) { if (vals.name != "") {
window.idle(false);
zu.setFuture(QtConcurrent::run(&update, text, vals));
}});
QObject::connect(&window, &Window::fileDroped,
[&](const QString &name, const QString &path) {
window.idle(false);
zu.setFuture(QtConcurrent::run(&update, meth->currentText(), Vals(name, path)));
});
/* hashing info */
QGraphicsBlurEffect blur;
blur.setBlurHints(QGraphicsBlurEffect::AnimationHint);
QPropertyAnimation anim(&blur, "blurRadius");
anim.setDuration(2000);
anim.setLoopCount(-1);
anim.setKeyValueAt(0, 0);
anim.setKeyValueAt(0.5, 3);
anim.setKeyValueAt(1, 0);
QLabel *hashing = new QLabel;
hashing->setPixmap(QPixmap(":/icon"));
hashing->setAttribute(Qt::WA_TransparentForMouseEvents);
hashing->setGraphicsEffect(&blur);
hashing->hide();
(new QHBoxLayout(text))->addWidget(hashing, 0, Qt::AlignCenter);
QObject::connect(&blur, &QGraphicsBlurEffect::blurRadiusChanged,
hashing, static_cast<void(QWidget::*)()>(&QWidget::update));
QObject::connect(&window, &Window::idle,
[&](bool idle) {
if (idle) {
hashing->hide();
anim.stop();
} else {
hashing->show();
anim.start();
}
});
/* about app */
QMenu about;
QAction *action = about.addAction(QIcon(":/icon"), Window::tr("About %1").arg(APP_NAME));
action->setMenuRole(QAction::AboutRole);
QObject::connect(action, &QAction::triggered, &window, &Window::about);
error->setContextMenuPolicy(Qt::NoContextMenu);
hash->setContextMenuPolicy(Qt::NoContextMenu);
meth->setContextMenuPolicy(Qt::NoContextMenu);
window.setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(&window, &QWidget::customContextMenuRequested,
[&about, &window](const QPoint &pos) { about.popup(window.mapToGlobal(pos)); });
text->setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(text, &QWidget::customContextMenuRequested,
[action, text](const QPoint &pos) {
if (QMenu *m = text->createStandardContextMenu()) {
m->insertAction(m->insertSeparator(m->actions()[0]), action);
m->popup(text->mapToGlobal(pos));
}
});
test->setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(test, &QWidget::customContextMenuRequested,
[action, test](const QPoint &pos) {
if (QMenu *m = test->createStandardContextMenu()) {
m->insertAction(m->insertSeparator(m->actions()[0]), action);
m->popup(test->mapToGlobal(pos));
}
});
return app.exec();
}
示例5: QFileDialog
MultiQFileDialog::MultiQFileDialog(QWidget *parent, const QString &caption, const QString &directory, bool multiSelect, const QString &filter)
: QFileDialog(parent, caption, directory, filter)
{
this->showHidden = false;
this->multiSelect = multiSelect;
setOption(QFileDialog::DontUseNativeDialog, false);
if (multiSelect)
{
setOption(QFileDialog::DontUseNativeDialog, true);
le = findChild<QLineEdit*>(QString::fromUtf8("fileNameEdit"));
QListView *l = findChild<QListView*>(QString::fromUtf8("listView"));
if (l)
{
l->setSelectionMode(QListView::ExtendedSelection);
if (le)
{
connect(l->selectionModel(),
SIGNAL(selectionChanged ( const QItemSelection &, const QItemSelection & )),
this,
SLOT(onSelectionChanged ( const QItemSelection &, const QItemSelection & )));
}
}
QTreeView *t = findChild<QTreeView*>();
if (t)
{
t->setSelectionMode(QAbstractItemView::ExtendedSelection);
if (le)
{
connect(t->selectionModel(),
SIGNAL(selectionChanged ( const QItemSelection &, const QItemSelection & )),
this,
SLOT(onSelectionChanged ( const QItemSelection &, const QItemSelection & )));
}
}
QLabel *label = findChild<QLabel*>(QString::fromUtf8("fileNameLabel"));
if (label)
{
label->hide();
}
label = findChild<QLabel*>(QString::fromUtf8("fileTypeLabel"));
if (label)
{
label->hide();
}
label = findChild<QLabel*>(QString::fromUtf8("lookInLabel"));
if (label)
{
label->hide();
}
QDialogButtonBox *buttonBox = findChild<QDialogButtonBox*>(QString::fromUtf8("buttonBox"));
if (buttonBox)
{
buttonBox->button(QDialogButtonBox::Open)->setText(QCoreApplication::translate("QDialogButtonBox", "&OK"));
}
setFileMode(QFileDialog::ExistingFiles);
if (le)
{
le->setText(QCoreApplication::translate("ShellExtension", "Upload to MEGA"));
}
}
QList<QWidget *> widgets = findChildren<QWidget *>();
for (QList<QWidget *>::const_iterator it = widgets.begin(); it != widgets.end(); ++it)
{
(*it)->installEventFilter(this);
}
installEventFilter(this);
}
示例6: QGroupBox
GltxFrame::GltxFrame(MainWindow* main, const QString& numText, QWidget* parent)
: QGroupBox(parent, "GltxFrame"), _main(main), _quasar(main->quasar())
{
numberLabel = new QLabel(numText, this);
number = new LineEdit(14, this);
numberLabel->setBuddy(number);
QLabel* dateLabel = new QLabel(tr("&Date:"), this);
date = new DatePopup(this);
dateLabel->setBuddy(date);
QLabel* storeLabel = new QLabel(tr("Store:"), this);
storeLookup = new StoreLookup(_main, parent);
store = new LookupEdit(storeLookup, this);
store->setLength(20);
storeLabel->setBuddy(store);
QLabel* referenceLabel = new QLabel(tr("Reference:"), this);
reference = new LineEdit(9, this);
referenceLabel->setBuddy(reference);
QLabel* timeLabel = new QLabel(tr("&Time:"), this);
time = new TimeEdit(this);
timeLabel->setBuddy(time);
QLabel* stationLabel = new QLabel(tr("Station:"), this);
station = new LookupEdit(new StationLookup(_main, parent), this);
station->setLength(20);
stationLabel->setBuddy(station);
QLabel* shiftLabel = new QLabel(tr("Shift:"), this);
shift = new LookupEdit(new GltxLookup(_main, parent, DataObject::SHIFT),
this);
shift->setSizeInfo(8, '9');
shift->setFocusPolicy(ClickFocus);
shiftLabel->setBuddy(shift);
QLabel* employeeLabel = new QLabel(tr("Employee:"), this);
employee = new LookupEdit(new EmployeeLookup(_main, parent), this);
employee->setLength(20);
employeeLabel->setBuddy(employee);
memoLabel = new QLabel(tr("&Memo:"), this);
memo = new LineEdit(this);
memo->setMaxLength(40);
memo->setMinimumWidth(memo->fontMetrics().width('x') * 40);
memoLabel->setBuddy(memo);
grid = new QGridLayout(this, 1, 1, frameWidth() * 2);
grid->setSpacing(3);
grid->setMargin(6);
grid->setColStretch(2, 1);
grid->addColSpacing(2, 10);
grid->setColStretch(5, 1);
grid->addColSpacing(5, 10);
grid->addWidget(numberLabel, 1, 0);
grid->addWidget(number, 1, 1);
grid->addWidget(dateLabel, 1, 3);
grid->addWidget(date, 1, 4);
grid->addWidget(storeLabel, 1, 6);
grid->addWidget(store, 1, 7);
grid->addWidget(referenceLabel, 2, 0);
grid->addWidget(reference, 2, 1);
grid->addWidget(timeLabel, 2, 3);
grid->addWidget(time, 2, 4);
grid->addWidget(stationLabel, 2, 6);
grid->addWidget(station, 2, 7);
grid->addWidget(shiftLabel, 3, 3);
grid->addWidget(shift, 3, 4);
grid->addWidget(employeeLabel, 3, 6);
grid->addWidget(employee, 3, 7);
grid->addWidget(memoLabel, 9, 0);
grid->addMultiCellWidget(memo, 9, 9, 1, 7);
// Hide store if only one possible
if (_quasar->storeCount() == 1) {
storeLabel->hide();
store->hide();
}
setFrameStyle(QFrame::Raised | QFrame::Panel);
memo->setFocus();
}
示例7: ActiveList
//.........这里部分代码省略.........
_customer->addTextColumn(tr("Name"), 30);
_customer->addTextColumn(tr("Number"), 12);
_customer->addTextColumn(tr("Phone Number"), 20);
_customer->addMoneyColumn(tr("Balance"));
_customer->setSorting(0);
connectList(_customer);
} else {
_customer = NULL;
}
// List for vendors tab
if (_quasar->securityCheck("VendorMaster", "View")) {
_vendor = new ListView(_tabs);
_tabs->addTab(_vendor, tr("&Vendors"));
_vendor->setAllColumnsShowFocus(true);
_vendor->setRootIsDecorated(false);
_vendor->setShowSortIndicator(true);
_vendor->addTextColumn(tr("Name"), 30);
_vendor->addTextColumn(tr("Number"), 12);
_vendor->addTextColumn(tr("Phone Number"), 20);
_vendor->addMoneyColumn(tr("Balance"));
_vendor->setSorting(0);
connectList(_vendor);
} else {
_vendor = NULL;
}
// List for employees tab
if (_quasar->securityCheck("EmployeeMaster", "View")) {
_employee = new ListView(_tabs);
_tabs->addTab(_employee, tr("&Employees"));
_employee->setAllColumnsShowFocus(true);
_employee->setRootIsDecorated(false);
_employee->setShowSortIndicator(true);
_employee->addTextColumn(tr("Name"), 30);
_employee->addTextColumn(tr("Number"), 12);
_employee->addTextColumn(tr("Phone Number"), 20);
_employee->setSorting(0);
connectList(_employee);
} else {
_employee = NULL;
}
// List for personal tab
if (_quasar->securityCheck("PersonalMaster", "View")) {
_personal = new ListView(_tabs);
_tabs->addTab(_personal, tr("&Personal"));
_personal->setAllColumnsShowFocus(true);
_personal->setRootIsDecorated(false);
_personal->setShowSortIndicator(true);
_personal->addTextColumn(tr("Name"), 30);
_personal->addTextColumn(tr("Phone Number"), 20);
_personal->setSorting(0);
connectList(_personal);
} else {
_personal = NULL;
}
QLabel* nameLabel = new QLabel(tr("Name:"), _search);
_name = new LineEdit(_search);
_name->setLength(40);
connect(_name, SIGNAL(returnPressed()), SLOT(slotRefresh()));
QLabel* numberLabel = new QLabel(tr("Number:"), _search);
_number = new LineEdit(_search);
_number->setLength(12);
connect(_number, SIGNAL(returnPressed()), SLOT(slotRefresh()));
QLabel* groupLabel = new QLabel(tr("Group:"), _search);
_groupLookup = new GroupLookup(_main, this, -1);
_group = new LookupEdit(_groupLookup, _search);
_group->setLength(15);
groupLabel->setBuddy(_group);
QLabel* storeLabel = new QLabel(tr("Store:"), _search);
_store = new LookupEdit(new StoreLookup(main, this), _search);
_store->setLength(30);
QGridLayout* grid = new QGridLayout(_search);
grid->setSpacing(3);
grid->setMargin(3);
grid->setColStretch(2, 1);
grid->addWidget(nameLabel, 0, 0);
grid->addWidget(_name, 0, 1, AlignLeft | AlignVCenter);
grid->addWidget(numberLabel, 1, 0);
grid->addWidget(_number, 1, 1, AlignLeft | AlignVCenter);
grid->addWidget(groupLabel, 2, 0);
grid->addWidget(_group, 2, 1, AlignLeft | AlignVCenter);
grid->addWidget(storeLabel, 3, 0);
grid->addWidget(_store, 3, 1, AlignLeft | AlignVCenter);
if (_quasar->storeCount() == 1) {
storeLabel->hide();
_store->hide();
}
setCaption(tr("Address Book"));
finalize(false);
_name->setFocus();
}
示例8: OverlayWidget
PopupMessage::PopupMessage( QWidget *parent, QWidget *anchor, int timeout)
: OverlayWidget( parent, anchor)
, m_anchor( anchor )
, m_parent( parent )
, m_maskEffect( Slide )
, m_dissolveSize( 0 )
, m_dissolveDelta( -1 )
, m_offset( 0 )
, m_counter( 0 )
, m_stage( 1 )
, m_timeout( timeout )
, m_showCounter( true )
{
setFrameStyle( QFrame::Panel | QFrame::Raised );
setFrameShape( QFrame::StyledPanel );
// overrideWindowFlags( Qt::WX11BypassWM );
QHBoxLayout *hbox;
QLabel *label;
QLabel *alabel;
//KActiveLabel *alabel;
m_layout = new QVBoxLayout( this );//, 9 /*margin*/, 6 /*spacing*/ );
m_layout->setMargin(9);
m_layout->setSpacing(6);
hbox = new QHBoxLayout; //( m_layout, 12 );
hbox->setMargin(12);
m_layout->addLayout(hbox);
hbox->addWidget( m_countdownFrame = new QFrame( this ));//, "counterVisual" ) );
m_countdownFrame->setObjectName( "counterVisual" );
m_countdownFrame->setFixedWidth( fontMetrics().width( "X" ) );
m_countdownFrame->setFrameStyle( QFrame::Plain | QFrame::Box );
QPalette tmp_palette;
tmp_palette.setColor(m_countdownFrame->foregroundRole(), palette().color(QPalette::Window).dark());
m_countdownFrame->setPalette(tmp_palette);
// m_countdownFrame->setPaletteForegroundColor( paletteBackgroundColor().dark() );
label = new QLabel( this );//, "image" );
label->setObjectName("image");
hbox->addWidget( label );
label->hide();
alabel = new QLabel( "Details of the tasks: ", this );//, "label");
alabel->setObjectName("label");
//alabel = new KActiveLabel( this, "label" );
//alabel->setTextFormat( Qt::RichText );
alabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
hbox->addWidget( alabel );
hbox = new QHBoxLayout;
m_layout->addLayout(hbox);
hbox->addItem( new QSpacerItem( 4, 4, QSizePolicy::Expanding, QSizePolicy::Preferred ) );
//FIXME: add icon
QPushButton * tmp_button = new QPushButton( "Close", this );
tmp_button->setObjectName( "closeButton" );
hbox->addWidget( tmp_button );//, "closeButton" ) );
connect( findChild<QPushButton *>( "closeButton" ), SIGNAL(clicked()), SLOT(close()) );
}
示例9: initLoadTab
void TrussPropertyTabWidget::initLoadTab ()
{
QFrame* parentFrame = new QFrame;
nodesNumbLabel = new QLabel( tr( "Total nodes: " ), parentFrame );
loadedNodesLabel = new QLabel( tr( "Nodes loaded: " ), parentFrame );
nodesNumbLabel->hide();
loadedNodesLabel->hide();
loadTable = new LoadTable( parentFrame );
TableHeader *horHeader = new TableHeader( Qt::Horizontal ),
*vertHeader = new TableHeader( Qt::Vertical );
loadTable->setHorizontalHeader( horHeader );
loadTable->setVerticalHeader( vertHeader );
LoadTableDelegate* delegate = new LoadTableDelegate;
loadTable->setItemDelegate( delegate );
connect( delegate, SIGNAL(cellWasChanged(int, int)),
SLOT(updateTrussLoad(int, int)) );
QGroupBox* loadCaseGroupBox =
new QGroupBox( tr( "Load cases" ), parentFrame );
QLabel* loadCaseNumb =
new QLabel( tr( "Current: " ), loadCaseGroupBox );
loadCaseNumb->hide();
loadCaseComboBox = new QComboBox( loadCaseGroupBox );
createLoadCaseBtn = new QPushButton( loadCaseGroupBox );
createLoadCaseBtn->setIcon( QIcon( Global::imagesPath() + "/plus.png" ) );
createLoadCaseBtn->setFixedSize( QSize( 22, 22 ) );
createLoadCaseBtn->setEnabled( false );
removeLoadCaseBtn = new QPushButton( loadCaseGroupBox );
removeLoadCaseBtn->setIcon( QIcon( Global::imagesPath() + "/minus.png" ) );
removeLoadCaseBtn->setFixedSize( QSize( 22, 22 ) );
removeLoadCaseBtn->setEnabled( false );
connect ( createLoadCaseBtn, SIGNAL(pressed()),
SLOT(addLoadCase()) );
connect ( removeLoadCaseBtn, SIGNAL(pressed()),
SLOT(removeLoadCase()) );
// init layout managers
QVBoxLayout* parentLayout = new QVBoxLayout( parentFrame );
QHBoxLayout* topLayout = new QHBoxLayout;
QVBoxLayout* tableLayout = new QVBoxLayout;
QHBoxLayout* loadCaseLayout = new QHBoxLayout( loadCaseGroupBox );
parentLayout->addLayout( topLayout );
parentLayout->addLayout( tableLayout );
topLayout->addWidget( nodesNumbLabel );
topLayout->addWidget( loadedNodesLabel );
tableLayout->addWidget( loadTable );
parentLayout->addWidget( loadCaseGroupBox );
loadCaseLayout->addWidget( loadCaseNumb );
loadCaseLayout->addWidget( loadCaseComboBox );
loadCaseLayout->addWidget( createLoadCaseBtn);
loadCaseLayout->addWidget( removeLoadCaseBtn );
topLayout->setMargin( 5 );
topLayout->setSpacing( 5 );
tableLayout->setMargin( 1 );
tableLayout->setSpacing( 1 );
loadCaseLayout->setMargin( 6 );
loadCaseLayout->setSpacing( 5 );
parentLayout->setMargin( 1 );
parentLayout->setSpacing( 1 );
// init load table
loadTable->setColumnCount( 2 );
loadTable->setSelectionMode( QAbstractItemView::NoSelection );
//TableHeader *horHeader = loadTable->horizontalHeader(),
// *vertHeader = loadTable->verticalHeader();
horHeader->setClickable( false );
horHeader->setResizeMode( QHeaderView::Custom );
vertHeader->setDefaultSectionSize( Global::tableRowHeight );
vertHeader->setClickable( false );
vertHeader->setResizeMode( QHeaderView::Custom );
vertHeader->setDefaultAlignment( Qt::AlignRight | Qt::AlignVCenter );
loadTable->setShowGrid( true );
QStringList headerList;
headerList << tr("Froce by X") << tr("Force by Y");
loadTable->setHorizontalHeaderLabels( headerList );
loadTable->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
loadTable->hide();
addTab( parentFrame, "Loads" );
}
示例10: createLayout
void BuildingComponentDialogCentralWidget::createLayout()
{
bool isConnected = false;
QLabel * label = new QLabel("Sort by:");
label->hide(); // TODO remove this hack when we have sorts to do
QComboBox * comboBox = new QComboBox(this);
comboBox->hide(); // TODO remove this hack when we have sorts to do
isConnected = connect(comboBox, SIGNAL(currentIndexChanged(const QString &)),
this, SLOT(comboBoxIndexChanged(const QString &)));
OS_ASSERT(isConnected);
QPushButton * upperPushButton = new QPushButton("Check All");
isConnected = connect(upperPushButton, SIGNAL(clicked()),
this, SLOT(upperPushButtonClicked()));
OS_ASSERT(isConnected);
QHBoxLayout * upperLayout = new QHBoxLayout();
upperLayout->addWidget(label);
upperLayout->addWidget(comboBox);
upperLayout->addStretch();
upperLayout->addWidget(upperPushButton);
m_collapsibleComponentList = new CollapsibleComponentList();
isConnected = connect(m_collapsibleComponentList, SIGNAL(headerClicked(bool)),
this, SIGNAL(headerClicked(bool)));
OS_ASSERT(isConnected);
isConnected = connect(m_collapsibleComponentList, SIGNAL(headerClicked(bool)),
this, SLOT(on_headerClicked(bool)));
OS_ASSERT(isConnected);
isConnected = connect(m_collapsibleComponentList, SIGNAL(componentClicked(bool)),
this, SIGNAL(componentClicked(bool)));
OS_ASSERT(isConnected);
isConnected = connect(m_collapsibleComponentList, SIGNAL(componentClicked(bool)),
this, SLOT(on_componentClicked(bool)));
OS_ASSERT(isConnected);
isConnected = connect(m_collapsibleComponentList, SIGNAL(collapsibleComponentClicked(bool)),
this, SIGNAL(collapsibleComponentClicked(bool)));
OS_ASSERT(isConnected);
isConnected = connect(m_collapsibleComponentList, SIGNAL(collapsibleComponentClicked(bool)),
this, SLOT(on_collapsibleComponentClicked(bool)));
OS_ASSERT(isConnected);
isConnected = connect(m_collapsibleComponentList, SIGNAL(getComponentsByPage(int)),
this, SIGNAL(getComponentsByPage(int)));
OS_ASSERT(isConnected);
isConnected = connect(m_collapsibleComponentList, SIGNAL(getComponentsByPage(int)),
this, SLOT(on_getComponentsByPage(int)));
OS_ASSERT(isConnected);
//*******************************************************************
// Hack code to be removed (TODO)
m_componentList = new ComponentList(); // TODO refactor and remove
CollapsibleComponentHeader * collapsibleComponentHeader = NULL;
collapsibleComponentHeader = new CollapsibleComponentHeader("Constructions",100,5);
CollapsibleComponent * collapsibleComponent = NULL;
collapsibleComponent = new CollapsibleComponent(collapsibleComponentHeader,m_componentList);
m_collapsibleComponentList->addCollapsibleComponent(collapsibleComponent);
//*******************************************************************
m_progressBar = new QProgressBar(this);
m_progressBar->setVisible(false);
QPushButton * lowerPushButton = new QPushButton("Download");
isConnected = connect(lowerPushButton, SIGNAL(clicked()),
this, SLOT(lowerPushButtonClicked()));
OS_ASSERT(isConnected);
QHBoxLayout * lowerLayout = new QHBoxLayout();
lowerLayout->addStretch();
lowerLayout->addWidget(m_progressBar);
lowerLayout->addWidget(lowerPushButton);
QVBoxLayout * mainLayout = new QVBoxLayout();
mainLayout->addLayout(upperLayout);
mainLayout->addWidget(m_collapsibleComponentList,0,Qt::AlignTop);
mainLayout->addLayout(lowerLayout);
setLayout(mainLayout);
}