本文整理汇总了C++中QSizePolicy::setHorizontalStretch方法的典型用法代码示例。如果您正苦于以下问题:C++ QSizePolicy::setHorizontalStretch方法的具体用法?C++ QSizePolicy::setHorizontalStretch怎么用?C++ QSizePolicy::setHorizontalStretch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSizePolicy
的用法示例。
在下文中一共展示了QSizePolicy::setHorizontalStretch方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cStr
/**
* Constructs a DlgParameterImp which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
DlgParameterImp::DlgParameterImp( QWidget* parent, Qt::WFlags fl )
: QDialog( parent, fl|Qt::WindowMinMaxButtonsHint )
{
this->setupUi(this);
QStringList groupLabels;
groupLabels << tr( "Group" );
paramGroup = new ParameterGroup(splitter3);
paramGroup->setHeaderLabels(groupLabels);
paramGroup->setRootIsDecorated(false);
QStringList valueLabels;
valueLabels << tr( "Name" ) << tr( "Type" ) << tr( "Value" );
paramValue = new ParameterValue(splitter3);
paramValue->setHeaderLabels(valueLabels);
paramValue->setRootIsDecorated(false);
paramValue->header()->setResizeMode(0, QHeaderView::Stretch);
QSizePolicy policy = paramValue->sizePolicy();
policy.setHorizontalStretch(3);
paramValue->setSizePolicy(policy);
#if 0 // This is needed for Qt's lupdate
qApp->translate( "Gui::Dialog::DlgParameterImp", "System parameter" );
qApp->translate( "Gui::Dialog::DlgParameterImp", "User parameter" );
#endif
ParameterManager* sys = App::GetApplication().GetParameterSet("System parameter");
const std::map<std::string,ParameterManager *>& rcList = App::GetApplication().GetParameterSetList();
for (std::map<std::string,ParameterManager *>::const_iterator it= rcList.begin();it!=rcList.end();++it) {
if (it->second != sys) // for now ignore system parameters because they are nowhere used
parameterSet->addItem(tr(it->first.c_str()), QVariant(QByteArray(it->first.c_str())));
}
QByteArray cStr("User parameter");
parameterSet->setCurrentIndex(parameterSet->findData(cStr));
onChangeParameterSet(parameterSet->currentIndex());
if (parameterSet->count() < 2)
parameterSet->hide();
connect(parameterSet, SIGNAL(activated(int)),
this, SLOT(onChangeParameterSet(int)));
connect(paramGroup, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(onGroupSelected(QTreeWidgetItem*)));
onGroupSelected(paramGroup->currentItem());
}
示例2: QWidget
OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QSplitter* parent)
: QWidget(parent), d(new OutputPanePlaceHolderPrivate(mode, parent))
{
setVisible(false);
setLayout(new QVBoxLayout);
QSizePolicy sp;
sp.setHorizontalPolicy(QSizePolicy::Preferred);
sp.setVerticalPolicy(QSizePolicy::Preferred);
sp.setHorizontalStretch(0);
setSizePolicy(sp);
layout()->setMargin(0);
connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(currentModeChanged(Core::IMode*)));
// d->m_current = this;
// Internal::OutputPaneManager *om = Internal::OutputPaneManager::instance();
// layout()->addWidget(om);
// om->show();
// om->updateStatusButtons(isVisible());
}
示例3: init_controls_area
void Data_analysis_gui::init_controls_area() {
QVBoxLayout * vbox = new QVBoxLayout();
controls_box_->setLayout(vbox);
/*
controls_box_->setOrientation( Qt::Vertical );
controls_box_->setColumns( 1 );
*/
QRect controls_tabwidget_geom = controls_tabwidget_->geometry();
controls_tabwidget_geom.setWidth( 220 );
controls_tabwidget_->setGeometry( controls_tabwidget_geom );
QSizePolicy policy;
policy.setHorizontalStretch(1);
policy.setVerticalStretch(1);
controls_tabwidget_->setSizePolicy(policy);
//splitter_->setResizeMode( controls_tabwidget_, QSplitter::KeepSize );
// signal-slot connections for the axis preferences
QObject::connect( minx_edit_, SIGNAL( returnPressed() ),
this, SLOT( set_x_axis_min() ) );
QObject::connect( maxx_edit_, SIGNAL( returnPressed() ),
this, SLOT( set_x_axis_max() ) );
QObject::connect( miny_edit_, SIGNAL( returnPressed() ),
this, SLOT( set_y_axis_min() ) );
QObject::connect( maxy_edit_, SIGNAL( returnPressed() ),
this, SLOT( set_y_axis_max() ) );
QObject::connect( reset_axis_x_button_, SIGNAL( clicked() ),
this, SLOT( reset_x_axis() ) );
QObject::connect( reset_axis_y_button_, SIGNAL( clicked() ),
this, SLOT( reset_y_axis() ) );
QObject::connect( x_logscale_checkbox_, SIGNAL( toggled( bool ) ),
this, SLOT( set_x_axis_logscale( bool ) ) );
QObject::connect( y_logscale_checkbox_, SIGNAL( toggled( bool ) ),
this, SLOT( set_y_axis_logscale( bool ) ) );
}
示例4: RazorPanelPlugin
/**
* @brief constructor
*/
RazorClock::RazorClock(const RazorPanelPluginStartInfo* startInfo, QWidget* parent):
RazorPanelPlugin(startInfo, parent),
calendarDialog(0)
{
setObjectName("Clock");
clockFormat = "hh:mm";
gui = new ClockLabel(this);
gui->setAlignment(Qt::AlignCenter);
this->layout()->setAlignment(Qt::AlignCenter);
QSizePolicy sizePolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
gui->setSizePolicy(sizePolicy);
this->setSizePolicy(sizePolicy);
addWidget(gui);
connect(gui, SIGNAL(fontChanged()), this, SLOT(updateMinWidth()));
settigsChanged();
clocktimer = new QTimer(this);
connect (clocktimer, SIGNAL(timeout()), this, SLOT(updateTime()));
clocktimer->start(1000);
}
示例5: plot
void param_plot_window::plot(QStringList &properties,
std::vector<float> &values, QString parameter)
{
parameter.replace("$","/");
qvtkWidget_ = new QVTKWidget(this);
setWindowTitle(parameter);
view_ = vtkSmartPointer<vtkContextView>::New();
view_->GetRenderer()->SetBackground(1.0,1.0,1.0);
view_->GetRenderWindow()->SetSize(400,300);
view_->SetInteractor(qvtkWidget_->GetInteractor());
qvtkWidget_->SetRenderWindow(view_->GetRenderWindow());
// Create new table with some points
chart_ = vtkSmartPointer<vtkChartXY>::New();
view_->GetScene()->AddItem(chart_);
QSizePolicy vtkPolicy = qvtkWidget_->sizePolicy();
vtkPolicy.setHorizontalStretch(3);
qvtkWidget_->setSizePolicy(vtkPolicy);
// Create a VTK table for storing data
table_ = vtkSmartPointer<vtkTable>::New();
// Create an array for listing property index
arrId_ = vtkSmartPointer<vtkDoubleArray>::New();
arrId_->SetName("Id");
// Label for storing name of property
labels_ = vtkSmartPointer<vtkStringArray>::New();
labels_->SetName("Property");
// Create a float array for storing metric data
arrMetricValues_ = vtkSmartPointer<vtkFloatArray>::New();
arrMetricValues_->SetName("Values");
// Add columns to table
table_->AddColumn(arrId_);
table_->AddColumn(labels_);
table_->AddColumn(arrMetricValues_);
table_->SetNumberOfRows(properties.size());
// Write data
for (unsigned int i = 0; i < properties.size(); ++i)
{
// Set ID
table_->SetValue(i,0,float(i));
// Set Label
table_->SetValue(i,1,properties.at(i).toStdString().c_str());
// Set Value
table_->SetValue(i,2,values.at(i));
}
// Add multiple line plots, setting the colors etc
vtkPlot *line = 0;
line = chart_->AddPlot(vtkChart::BAR);
line->SetInputData(table_, 0, 2);
line->SetColor(67, 110 ,238, 255);
vtkAxis *x_axis = chart_->GetAxis(vtkAxis::BOTTOM);
x_axis->SetBehavior(1);
x_axis->SetMinimum(-1);
x_axis->SetMaximum(properties.size());
x_axis->SetTitle("Realizations");
x_axis->GetTitleProperties()->SetFontSize(16);
x_axis->SetCustomTickPositions(arrId_,labels_);
x_axis->GetLabelProperties()->SetOrientation(90);
x_axis->GetLabelProperties()->SetFontSize(24);
vtkAxis *y_axis = chart_->GetAxis(vtkAxis::LEFT);
y_axis->SetTitle("Parameter");
y_axis->GetTitleProperties()->SetFontSize(14);
x_axis->GetLabelProperties()->SetFontSize(14);
chart_->Update();
view_->GetInteractor()->Initialize();
view_->GetInteractor()->Start();
ui->scrollArea->setWidget(qvtkWidget_);
}
示例6: generateWidget
void TransferFunctionPropertyDialog::generateWidget() {
vec2 minEditorDims = vec2(255.0f, 100.0f);
tfEditorView_ = new TransferFunctionEditorView(tfProperty_);
tfProperty_->get().addObserver(tfEditorView_);
// put origin to bottom left corner
tfEditorView_->scale(1.0, -1.0);
tfEditorView_->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
tfEditorView_->setMinimumSize(minEditorDims.x, minEditorDims.y);
tfEditorView_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
tfEditorView_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
tfEditor_ = new TransferFunctionEditor(&tfProperty_->get(), tfEditorView_);
connect(tfEditor_, SIGNAL(doubleClick()), this, SLOT(showColorDialog()));
connect(tfEditor_, SIGNAL(selectionChanged()), this, SLOT(updateColorWheel()));
tfEditorView_->setScene(tfEditor_);
zoomVSlider_ = new RangeSliderQt(Qt::Vertical, this);
zoomVSlider_->setRange(0, sliderRange_);
zoomVSlider_->setMinSeparation(5);
// flip slider values to compensate for vertical slider layout
zoomVSlider_->setValue(sliderRange_ - static_cast<int>(tfProperty_->getZoomV().y*sliderRange_),
sliderRange_ - static_cast<int>(tfProperty_->getZoomV().x*sliderRange_));
connect(zoomVSlider_, SIGNAL(valuesChanged(int, int)),
this, SLOT(changeVerticalZoom(int, int)));
zoomHSlider_ = new RangeSliderQt(Qt::Horizontal, this);
zoomHSlider_->setRange(0, sliderRange_);
zoomHSlider_->setMinSeparation(5);
zoomHSlider_->setValue(static_cast<int>(tfProperty_->getZoomH().x*sliderRange_),
static_cast<int>(tfProperty_->getZoomH().y*sliderRange_));
connect(zoomHSlider_, SIGNAL(valuesChanged(int, int)),
this, SLOT(changeHorizontalZoom(int, int)));
maskSlider_ = new RangeSliderQt(Qt::Horizontal, this);
maskSlider_->setRange(0, sliderRange_);
maskSlider_->setValue(static_cast<int>(tfProperty_->getMask().x*sliderRange_),
static_cast<int>(tfProperty_->getMask().y*sliderRange_));
connect(maskSlider_, SIGNAL(valuesChanged(int, int)),
this, SLOT(changeMask(int, int)));
colorWheel_ = new ColorWheel();
connect(colorWheel_, SIGNAL(colorChange(QColor)), this, SLOT(setPointColor(QColor)));
btnClearTF_ = new QPushButton("Reset");
connect(btnClearTF_, SIGNAL(clicked()), tfEditor_, SLOT(resetTransferFunction()));
btnClearTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;"));
btnImportTF_ = new QPushButton("Import");
connect(btnImportTF_, SIGNAL(clicked()), this, SLOT(importTransferFunction()));
btnImportTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;"));
btnExportTF_ = new QPushButton("Export");
connect(btnExportTF_, SIGNAL(clicked()), this, SLOT(exportTransferFunction()));
btnExportTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;"));
tfPreview_ = new QLabel();
tfPreview_->setMinimumSize(1,20);
QSizePolicy sliderPol = tfPreview_->sizePolicy();
sliderPol.setHorizontalStretch(3);
tfPreview_->setSizePolicy(sliderPol);
cmbInterpolation_ = new QComboBox();
cmbInterpolation_->addItem("Interpolation: Linear");
//cmbInterpolation_->addItem("Interpolation: Cubic"); // Not implemented... (yet)
cmbInterpolation_->setCurrentIndex(tfProperty_->get().getInterpolationType());
connect(cmbInterpolation_, SIGNAL(currentIndexChanged(int)),
this, SLOT(switchInterpolationType(int)));
chkShowHistogram_ = new QComboBox();
chkShowHistogram_->addItem("Histogram: Off");
chkShowHistogram_->addItem("Histogram: 100%");
chkShowHistogram_->addItem("Histogram: 99%");
chkShowHistogram_->addItem("Histogram: 95%");
chkShowHistogram_->addItem("Histogram: 90%");
chkShowHistogram_->addItem("Histogram: Log");
chkShowHistogram_->setCurrentIndex(tfProperty_->getShowHistogram());
connect(chkShowHistogram_, SIGNAL(currentIndexChanged(int)), this, SLOT(showHistogram(int)));
pointMoveMode_ = new QComboBox();
pointMoveMode_->addItem("Point Movement: Free");
pointMoveMode_->addItem("Point Movement: Restrict");
pointMoveMode_->addItem("Point Movement: Push");
pointMoveMode_->setCurrentIndex(0);
connect(pointMoveMode_, SIGNAL(currentIndexChanged(int)), this, SLOT(changeMoveMode(int)));
colorDialog_ = new QColorDialog(this);
colorDialog_->hide();
colorDialog_->setOption(QColorDialog::ShowAlphaChannel, true);
colorDialog_->setOption(QColorDialog::NoButtons, true);
colorDialog_->setWindowModality(Qt::NonModal);
colorDialog_->setWindowTitle(QString::fromStdString(tfProperty_->getDisplayName()));
connect(colorDialog_, SIGNAL(currentColorChanged(QColor)),
this, SLOT(setPointColorDialog(QColor)));
QFrame* leftPanel = new QFrame(this);
QGridLayout* leftLayout = new QGridLayout();
leftLayout->setContentsMargins(0, 0, 0, 0);
leftLayout->setSpacing(7);
leftLayout->addWidget(zoomVSlider_, 0, 0);
//.........这里部分代码省略.........
示例7: domPropertyToVariant
//.........这里部分代码省略.........
case DomProperty::Font: {
const DomFont *font = p->elementFont();
QFont f;
if (font->hasElementFamily() && !font->elementFamily().isEmpty())
f.setFamily(font->elementFamily());
if (font->hasElementPointSize() && font->elementPointSize() > 0)
f.setPointSize(font->elementPointSize());
if (font->hasElementWeight() && font->elementWeight() > 0)
f.setWeight(font->elementWeight());
if (font->hasElementItalic())
f.setItalic(font->elementItalic());
if (font->hasElementBold())
f.setBold(font->elementBold());
if (font->hasElementUnderline())
f.setUnderline(font->elementUnderline());
if (font->hasElementStrikeOut())
f.setStrikeOut(font->elementStrikeOut());
if (font->hasElementKerning())
f.setKerning(font->elementKerning());
if (font->hasElementAntialiasing())
f.setStyleStrategy(font->elementAntialiasing() ? QFont::PreferDefault : QFont::NoAntialias);
if (font->hasElementStyleStrategy()) {
f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy", font->elementStyleStrategy().toLatin1()));
}
return QVariant::fromValue(f);
}
case DomProperty::Date: {
const DomDate *date = p->elementDate();
return QVariant(QDate(date->elementYear(), date->elementMonth(), date->elementDay()));
}
case DomProperty::Time: {
const DomTime *t = p->elementTime();
return QVariant(QTime(t->elementHour(), t->elementMinute(), t->elementSecond()));
}
case DomProperty::DateTime: {
const DomDateTime *dateTime = p->elementDateTime();
const QDate d(dateTime->elementYear(), dateTime->elementMonth(), dateTime->elementDay());
const QTime tm(dateTime->elementHour(), dateTime->elementMinute(), dateTime->elementSecond());
return QVariant(QDateTime(d, tm));
}
case DomProperty::Url: {
const DomUrl *url = p->elementUrl();
return QVariant(QUrl(url->elementString()->text()));
}
#ifndef QT_NO_CURSOR
case DomProperty::Cursor:
return QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(p->elementCursor())));
case DomProperty::CursorShape:
return QVariant::fromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape", p->elementCursorShape().toLatin1())));
#endif
case DomProperty::Locale: {
const DomLocale *locale = p->elementLocale();
return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language", locale->attributeLanguage().toLatin1()),
enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country", locale->attributeCountry().toLatin1())));
}
case DomProperty::SizePolicy: {
const DomSizePolicy *sizep = p->elementSizePolicy();
QSizePolicy sizePolicy;
sizePolicy.setHorizontalStretch(sizep->elementHorStretch());
sizePolicy.setVerticalStretch(sizep->elementVerStretch());
const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");
if (sizep->hasElementHSizeType()) {
sizePolicy.setHorizontalPolicy((QSizePolicy::Policy) sizep->elementHSizeType());
} else if (sizep->hasAttributeHSizeType()) {
const QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeHSizeType().toLatin1());
sizePolicy.setHorizontalPolicy(sp);
}
if (sizep->hasElementVSizeType()) {
sizePolicy.setVerticalPolicy((QSizePolicy::Policy) sizep->elementVSizeType());
} else if (sizep->hasAttributeVSizeType()) {
const QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeVSizeType().toLatin1());
sizePolicy.setVerticalPolicy(sp);
}
return QVariant::fromValue(sizePolicy);
}
case DomProperty::StringList:
return QVariant(p->elementStringList()->elementString());
default:
uiLibWarning(QCoreApplication::translate("QFormBuilder", "Reading properties of the type %1 is not supported yet.").arg(p->kind()));
break;
}
return QVariant();
}
示例8: BackstagePage
BackstageOSF::BackstageOSF(QWidget *parent) : BackstagePage(parent)
{
QGridLayout *layout = new QGridLayout(this);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
QWidget *topRow = new QWidget(this);
layout->addWidget(topRow);
QGridLayout *topRowLayout = new QGridLayout();
topRowLayout->setContentsMargins(0, 6, 12, 0);
topRow->setLayout(topRowLayout);
QLabel *label = new QLabel("Open Science Framework", topRow);
QSizePolicy sp = label->sizePolicy();
sp.setHorizontalStretch(1);
label->setSizePolicy(sp);
label->setContentsMargins(12, 12, 12, 1);
topRowLayout->addWidget(label, 0, 0);
_nameButton = new QToolButton(topRow);
_nameButton->hide();
topRowLayout->addWidget(_nameButton, 0, 1);
connect(_nameButton, SIGNAL(clicked(bool)), this, SLOT(nameClicked()));
QWidget *buttonsWidget = new QWidget(this);
buttonsWidget->setContentsMargins(0, 0, 0, 0);
layout->addWidget(buttonsWidget);
QGridLayout *buttonsWidgetLayout = new QGridLayout(buttonsWidget);
buttonsWidgetLayout->setContentsMargins(0, 0, 12, 0);
buttonsWidget->setLayout(buttonsWidgetLayout);
_breadCrumbs = new BreadCrumbs(buttonsWidget);
buttonsWidgetLayout->addWidget(_breadCrumbs, 0, 0);
_newFolderButton = new QToolButton(buttonsWidget);
_newFolderButton->setText("New Folder");
_newFolderButton->hide();
buttonsWidgetLayout->addWidget(_newFolderButton, 0, 2);
_fileNameContainer = new QWidget(this);
_fileNameContainer->hide();
_fileNameContainer->setObjectName("browseContainer");
layout->addWidget(_fileNameContainer);
QHBoxLayout *saveLayout = new QHBoxLayout(_fileNameContainer);
_fileNameContainer->setLayout(saveLayout);
_fileNameTextBox = new QLineEdit(_fileNameContainer);
QSizePolicy policy = _fileNameTextBox->sizePolicy();
policy.setHorizontalStretch(1);
_fileNameTextBox->setSizePolicy(policy);
_fileNameTextBox->setEnabled(false);
saveLayout->addWidget(_fileNameTextBox);
_saveButton = new QPushButton(_fileNameContainer);
_saveButton->setText("Save");
_saveButton->setEnabled(false);
saveLayout->addWidget(_saveButton, 0, Qt::AlignRight);
QWidget *line;
line = new QWidget(this);
line->setFixedHeight(1);
line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
layout->addWidget(line);
_model = new FSBMOSF();
connect(_model, SIGNAL(authenticationSuccess()), this, SLOT(updateUserDetails()));
connect(_model, SIGNAL(authenticationClear()), this, SLOT(updateUserDetails()));
_fsBrowser = new FSBrowser(this);
_fsBrowser->setViewType(FSBrowser::ListView);
_fsBrowser->setFSModel(_model);
layout->addWidget(_fsBrowser);
_breadCrumbs->setModel(_model);
_breadCrumbs->setEnabled(false);
connect(_fsBrowser, SIGNAL(entryOpened(QString)), this, SLOT(notifyDataSetOpened(QString)));
connect(_fsBrowser, SIGNAL(entrySelected(QString)), this, SLOT(notifyDataSetSelected(QString)));
connect(_saveButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
connect(_newFolderButton, SIGNAL(clicked(bool)), this, SLOT(newFolderClicked()));
line = new QWidget(this);
line->setFixedWidth(1);
line->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
layout->addWidget(line, 0, 1, 6, 1);
QWidget *about = new QWidget(this);
about->setObjectName("aboutOSF");
about->setStyleSheet("#aboutOSF { border-top: 1px solid #A3A4A5 ; }");
//.........这里部分代码省略.........
示例9: QStackedWidget
DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
: QStackedWidget(parent)
, m_db(db)
, m_searchUi(new Ui::SearchWidget())
, m_searchWidget(new QWidget())
, m_newGroup(Q_NULLPTR)
, m_newEntry(Q_NULLPTR)
, m_newParent(Q_NULLPTR)
{
m_searchUi->setupUi(m_searchWidget);
m_searchTimer = new QTimer(this);
m_searchTimer->setSingleShot(true);
m_mainWidget = new QWidget(this);
QLayout* layout = new QHBoxLayout(m_mainWidget);
QSplitter* splitter = new QSplitter(m_mainWidget);
QWidget* rightHandSideWidget = new QWidget(splitter);
m_searchWidget->setParent(rightHandSideWidget);
m_groupView = new GroupView(db, splitter);
m_groupView->setObjectName("groupView");
m_groupView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_groupView, SIGNAL(customContextMenuRequested(QPoint)),
SLOT(emitGroupContextMenuRequested(QPoint)));
m_entryView = new EntryView(rightHandSideWidget);
m_entryView->setObjectName("entryView");
m_entryView->setContextMenuPolicy(Qt::CustomContextMenu);
m_entryView->setGroup(db->rootGroup());
connect(m_entryView, SIGNAL(customContextMenuRequested(QPoint)),
SLOT(emitEntryContextMenuRequested(QPoint)));
QSizePolicy policy;
policy = m_groupView->sizePolicy();
policy.setHorizontalStretch(30);
m_groupView->setSizePolicy(policy);
policy = rightHandSideWidget->sizePolicy();
policy.setHorizontalStretch(70);
rightHandSideWidget->setSizePolicy(policy);
QAction* closeAction = new QAction(m_searchWidget);
QIcon closeIcon = filePath()->icon("actions", "dialog-close");
closeAction->setIcon(closeIcon);
m_searchUi->closeSearchButton->setDefaultAction(closeAction);
m_searchUi->closeSearchButton->setShortcut(Qt::Key_Escape);
m_searchWidget->hide();
m_searchUi->caseSensitiveCheckBox->setVisible(false);
QVBoxLayout* vLayout = new QVBoxLayout(rightHandSideWidget);
vLayout->setMargin(0);
vLayout->addWidget(m_searchWidget);
vLayout->addWidget(m_entryView);
rightHandSideWidget->setLayout(vLayout);
splitter->addWidget(m_groupView);
splitter->addWidget(rightHandSideWidget);
layout->addWidget(splitter);
m_mainWidget->setLayout(layout);
m_editEntryWidget = new EditEntryWidget();
m_editEntryWidget->setObjectName("editEntryWidget");
m_historyEditEntryWidget = new EditEntryWidget();
m_editGroupWidget = new EditGroupWidget();
m_editGroupWidget->setObjectName("editGroupWidget");
m_changeMasterKeyWidget = new ChangeMasterKeyWidget();
m_changeMasterKeyWidget->headlineLabel()->setText(tr("Change master key"));
QFont headlineLabelFont = m_changeMasterKeyWidget->headlineLabel()->font();
headlineLabelFont.setBold(true);
headlineLabelFont.setPointSize(headlineLabelFont.pointSize() + 2);
m_changeMasterKeyWidget->headlineLabel()->setFont(headlineLabelFont);
m_databaseSettingsWidget = new DatabaseSettingsWidget();
m_databaseSettingsWidget->setObjectName("databaseSettingsWidget");
m_databaseOpenWidget = new DatabaseOpenWidget();
m_databaseOpenWidget->setObjectName("databaseOpenWidget");
m_keepass1OpenWidget = new KeePass1OpenWidget();
m_keepass1OpenWidget->setObjectName("keepass1OpenWidget");
m_unlockDatabaseWidget = new UnlockDatabaseWidget();
m_unlockDatabaseWidget->setObjectName("unlockDatabaseWidget");
addWidget(m_mainWidget);
addWidget(m_editEntryWidget);
addWidget(m_editGroupWidget);
addWidget(m_changeMasterKeyWidget);
addWidget(m_databaseSettingsWidget);
addWidget(m_historyEditEntryWidget);
addWidget(m_databaseOpenWidget);
addWidget(m_keepass1OpenWidget);
addWidget(m_unlockDatabaseWidget);
connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(clearLastGroup(Group*)));
connect(m_groupView, SIGNAL(groupChanged(Group*)), SIGNAL(groupChanged()));
connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
connect(m_entryView, SIGNAL(entryActivated(Entry*, EntryModel::ModelColumn)),
SLOT(entryActivationSignalReceived(Entry*, EntryModel::ModelColumn)));
connect(m_entryView, SIGNAL(entrySelectionChanged()), SIGNAL(entrySelectionChanged()));
connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));
//.........这里部分代码省略.........
示例10: pxEditHeader
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
// set working dir to executable work directory
QDir::setCurrent(QCoreApplication::applicationDirPath());
QString resDir = ResourceFinder::getPath();
//chess::FuncT *f = new chess::FuncT();
//f->run_pgn_speedtest();
//f->run_polyglot();
/*
f->run_pgnt();
f->run_pgn_scant();
*/
// reconstruct gameModel
this->gameModel = new GameModel();
this->gameModel->restoreGameState();
this->gameModel->getGame()->setTreeWasChanged(true);
this->boardViewController = new BoardViewController(gameModel, this);
this->moveViewController = new MoveViewController(gameModel, this);
this->moveViewController->setFocus();
this->engineViewController = new EngineView(gameModel, this);
engineViewController->setFocusPolicy(Qt::NoFocus);
moveViewController->setFocusPolicy(Qt::ClickFocus);
this->name = new QLabel();
name->setText("<b>Robert James Fisher - Reuben Fine</b><br/>New York(USA) 1963.03.??");
name->setAlignment(Qt::AlignCenter);
name->setBuddy(moveViewController);
QHBoxLayout *hbox_name_editHeader = new QHBoxLayout();
QPushButton *editHeader = new QPushButton();
QPixmap pxEditHeader(*this->fromSvgToPixmap(editHeader->iconSize(),resDir + "/res/icons/document-properties.svg"));
editHeader->setIcon(QIcon(pxEditHeader));
hbox_name_editHeader->addStretch(1);
hbox_name_editHeader->addWidget(this->name);
hbox_name_editHeader->addStretch(1);
hbox_name_editHeader->addWidget(editHeader);
this->uciController = new UciController();
this->modeController = new ModeController(gameModel, uciController, this);
this->editController = new EditController(gameModel, this);
this->fileController = new FileController(gameModel, this);
QSize btnSize = QSize(this->height()/19, this->height()/19);
QSize btnSizeLR = QSize(this->height()/14, this->height()/14);
QPushButton *left = new QPushButton();
QPushButton *right = new QPushButton();
QPushButton *beginning = new QPushButton();
QPushButton *end = new QPushButton();
left->setIconSize(btnSizeLR);
right->setIconSize(btnSizeLR);
beginning->setIconSize(btnSize);
end->setIconSize(btnSize);
QPixmap pxRight(*this->fromSvgToPixmap(right->iconSize(),resDir + "/res/icons/go-next.svg"));
QPixmap pxLeft(*this->fromSvgToPixmap(left->iconSize(),resDir + "/res/icons/go-previous.svg"));
QPixmap pxBeginning(*this->fromSvgToPixmap(left->iconSize(),resDir + "/res/icons/go-first.svg"));
QPixmap pxEnd(*this->fromSvgToPixmap(left->iconSize(),resDir + "/res/icons/go-last.svg"));
right->setIcon(QIcon(pxRight));
left->setIcon(QIcon(pxLeft));
beginning->setIcon(QIcon(pxBeginning));
end->setIcon(QIcon(pxEnd));
QWidget *mainWidget = new QWidget();
// setup the main window
// consisting of:
//
// <-------menubar---------------------------->
// <chess- -> <label w/ game data ->
// <board -> <moves_edit_view---------->
// <view -> <engine output view ->
QSizePolicy *spLeft = new QSizePolicy();
spLeft->setHorizontalStretch(1);
QSizePolicy *spRight = new QSizePolicy();
spRight->setHorizontalStretch(2);
QHBoxLayout *hbox_buttons = new QHBoxLayout();
hbox_buttons->addStretch(1);
hbox_buttons->addWidget(beginning);
hbox_buttons->addWidget(left);
hbox_buttons->addWidget(right);
hbox_buttons->addWidget(end);
hbox_buttons->addStretch(1);
QHBoxLayout *hbox_right_engine_buttons = new QHBoxLayout();
this->pbEngineOnOff = new OnOffButton(this); //new QPushButton("OFF");
this->lblMultiPv = new QLabel(this->tr("Lines:"), this);
this->spinMultiPv = new QSpinBox(this);
//.........这里部分代码省略.........
示例11: QWidget
FSBrowser::FSBrowser(QWidget *parent, FSBrowser::BrowseMode mode) : QWidget(parent)
{
QLabel *label = NULL;
_browseMode = mode;
_viewType = FSBrowser::IconView;
QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(12, 12, 0, 0); //Position all file and folder elements asn recent file label
setLayout(layout);
switch(mode)
{
case FSBrowser::BrowseRecentFiles:
label = new QLabel("Recent Files");
break;
case FSBrowser::BrowseExamples:
label = new QLabel("Examples");
break;
case FSBrowser::BrowseCurrent:
layout->addWidget(new QLabel(QString("Double-click on the file below to synchronize or use ") + getShortCutKey() + "-Y"));
break;
default:
break;
}
if (label)
{
QFont f= QFont("SansSerif");
f.setPointSize(18);
label->setFont(f);
QSizePolicy sp = label->sizePolicy();
sp.setHorizontalStretch(1);
label->setSizePolicy(sp);
label->setContentsMargins(0, 0, 0, 0);
layout->addWidget(label);
}
_scrollArea = new VerticalScrollArea(this);
_scrollArea->setFrameShape(QScrollArea::NoFrame);
layout->addWidget(_scrollArea);
_scrollPane = new QWidget;
_scrollArea->setWidget(_scrollPane);
_scrollPaneLayout = new QVBoxLayout(_scrollPane);
_scrollPaneLayout->setSpacing(1);
_scrollPaneLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
_scrollPane->setLayout(_scrollPaneLayout);
_buttonGroup = new QButtonGroup(this);
_authWidget = new AuthWidget(this);
_authWidget->hide();
_processLabel = new QLabel(this);
_processLabel->setAlignment(Qt::AlignCenter);
_processLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
_processLabel->setMovie(new QMovie(":/icons/loading.gif", QByteArray(), _processLabel));
_processLabel->setHidden(true);
layout->addWidget(_processLabel);
connect(_authWidget, SIGNAL(loginRequested(QString,QString)), this, SLOT(loginRequested(QString,QString)));
}
示例12: construct
//-----------------------------------------------------------------------------------------------
// constructs the view
//-----------------------------------------------------------------------------------------------
void InspectorProdWell::construct()
{
setWindowTitle("Production Well " + p_well->name() + " Properties");
QScrollArea *scroll_area = new QScrollArea(this);
widget = new QWidget(this);
widget->setMinimumSize(600, 300);
scroll_area->setAlignment(Qt::AlignCenter);
scroll_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scroll_area->setWidget(widget);
QSizePolicy policy = scroll_area->sizePolicy();
policy.setVerticalStretch(1);
policy.setHorizontalStretch(1);
policy.setVerticalPolicy(QSizePolicy::Expanding);
QVBoxLayout *layout_main = new QVBoxLayout(this);
setLayout(layout_main);
QVBoxLayout *layout = new QVBoxLayout(widget);
int row = 0;
widget->setLayout(layout);
// ---- setting up the control variables -----
box_control = new QGroupBox("Control Variables", widget);
box_control->setStyleSheet("QGroupBox{border:2px solid gray;border-radius:5px;margin-top: 1ex;} QGroupBox::title{subcontrol-origin: margin;subcontrol-position:top center;padding:0 3px;}");
box_control->setFixedWidth(500);
QVBoxLayout *layout_control = new QVBoxLayout(box_control);
box_control->setLayout(layout_control);
for(int i = 0; i < p_well->numberOfControls(); ++i)
{
WellControl *wc = p_well->control(i);
InspectorWellControl *iwc = new InspectorWellControl(wc->endTime(), wc->controlVar()->value(), wc->controlVar()->max(), wc->controlVar()->min(), wc->type(), widget, i == 0);
m_controls.push_back(iwc);
layout_control->addWidget(iwc);
}
// show/hide
p_btn_control = new QPushButton("-", widget);
p_btn_control->setFixedSize(25, 25);
p_btn_control->setCheckable(true);
p_btn_control->setChecked(false);
connect(p_btn_control, SIGNAL(toggled(bool)), this, SLOT(hideControls(bool)));
layout_control->addWidget(p_btn_control);
layout->addWidget(box_control, 0, Qt::AlignHCenter);
++row;
// ---- setting up the gas lift variables -----
if(p_well->hasGasLift())
{
box_gaslift = new QGroupBox("Gas Lift Variables", widget);
box_gaslift->setStyleSheet("QGroupBox{border:2px solid gray;border-radius:5px;margin-top: 1ex;} QGroupBox::title{subcontrol-origin: margin;subcontrol-position:top center;padding:0 3px;}");
box_gaslift->setFixedWidth(500);
QVBoxLayout *layout_gaslift = new QVBoxLayout(box_gaslift);
//layout_control->setSizeConstraint(QLayout::SetFixedSize);
box_gaslift->setLayout(layout_gaslift);
for(int i = 0; i < p_well->numberOfGasLiftControls(); ++i)
{
WellControl *gl = p_well->gasLiftControl(i);
InspectorGasLift *igl = new InspectorGasLift(gl->endTime(), gl->controlVar()->value(), gl->controlVar()->max(), gl->controlVar()->min(), widget, i == 0);
m_gaslift.push_back(igl);
layout_gaslift->addWidget(igl);
}
// show/hide
p_btn_gaslift = new QPushButton("-", widget);
p_btn_gaslift->setFixedSize(25, 25);
p_btn_gaslift->setCheckable(true);
p_btn_gaslift->setChecked(false);
connect(p_btn_gaslift, SIGNAL(toggled(bool)), this, SLOT(hideGasLift(bool)));
layout_gaslift->addWidget(p_btn_gaslift);
layout->addWidget(box_gaslift, 0, Qt::AlignHCenter);
++row;
}
示例13: QWidget
//.........这里部分代码省略.........
QToolButton* tempo100 = new QToolButton();
tempo100->setText(tr("N"));
tempo100->setFocusPolicy(Qt::NoFocus);
toolbar->addWidget(tempo100);
connect(tempo100, SIGNAL(clicked()), SLOT(setTempo100()));
QToolButton* tempo200 = new QToolButton();
tempo200->setText(QString("200%"));
tempo200->setFocusPolicy(Qt::NoFocus);
toolbar->addWidget(tempo200);
connect(tempo200, SIGNAL(clicked()), SLOT(setTempo200()));
QVBoxLayout* box = new QVBoxLayout(this);
box->setContentsMargins(0, 0, 0, 0);
box->setSpacing(0);
box->addWidget(MusECore::hLine(this), Qt::AlignTop);
//---------------------------------------------------
// Tracklist
//---------------------------------------------------
int xscale = -100;
int yscale = 1;
split = new Splitter(Qt::Horizontal, this, "split");
split->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
box->addWidget(split, 1000);
tracklist = new QWidget(split);
split->setStretchFactor(split->indexOf(tracklist), 0);
QSizePolicy tpolicy = QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
tpolicy.setHorizontalStretch(0);
tpolicy.setVerticalStretch(100);
tracklist->setSizePolicy(tpolicy);
editor = new QWidget(split);
split->setStretchFactor(split->indexOf(editor), 1);
QSizePolicy epolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
epolicy.setHorizontalStretch(255);
epolicy.setVerticalStretch(100);
editor->setSizePolicy(epolicy);
//---------------------------------------------------
// Track Info
//---------------------------------------------------
infoScroll = new ScrollBar(Qt::Vertical, true, tracklist);
infoScroll->setObjectName("infoScrollBar");
//genTrackInfo(tracklist); // Moved below
// Track-Info Button
ib = new QToolButton(tracklist);
ib->setText(tr("TrackInfo"));
ib->setCheckable(true);
ib->setChecked(showTrackinfoFlag);
ib->setFocusPolicy(Qt::NoFocus);
connect(ib, SIGNAL(toggled(bool)), SLOT(showTrackInfo(bool)));
// set up the header
header = new Header(tracklist, "header");
header->setFixedHeight(30);
QFontMetrics fm1(header->font());
int fw = 11;
示例14: QGroupBox
CompositionWidget::CompositionWidget(void)
{
/* ViewGroup */
QGroupBox* viewGroup = new QGroupBox(this);
QGroupBox* meshViewGroup = new QGroupBox(viewGroup);
meshViewGroup->setTitle(tr("Mesh View"));
mMeshViewer = new MeshViewer(meshViewGroup);
QGroupBox* skeletonViewGroup = new QGroupBox(viewGroup);
skeletonViewGroup->setTitle(tr("Skeleton View"));
mSkeletonViewer = new SkeletonViewer(skeletonViewGroup);
/* ControlGroup */
QGroupBox* buttonGroup = new QGroupBox(this);
buttonGroup->setTitle(QObject::tr("Drape"));
QPushButton* extractSkeletonButton = new QPushButton(buttonGroup);
extractSkeletonButton->setText(QObject::tr("Extract Skeleton"));
QPushButton* findNeckButton = new QPushButton(buttonGroup);
findNeckButton->setText(QObject::tr("Deform Cloth"));
QPushButton* moveClothButton = new QPushButton(buttonGroup);
moveClothButton->setText(QObject::tr("Move Cloth"));
QPushButton* resolvePenetrationButton = new QPushButton(buttonGroup);
resolvePenetrationButton->setText(QObject::tr("Resolve Penetration"));
QPushButton* physicalSimuationButton = new QPushButton(buttonGroup);
physicalSimuationButton->setText(QObject::tr("PhysicalSimuate"));
QPushButton* physicalSimuationStopButton = new QPushButton(buttonGroup);
physicalSimuationStopButton->setText(QObject::tr("Stop PhysicalSimuation"));
/* Layout */
QHBoxLayout* mainLayout = new QHBoxLayout(this);
QSizePolicy sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(4);
viewGroup->setSizePolicy(sizePolicy);
sizePolicy.setHorizontalStretch(1);
buttonGroup->setSizePolicy(sizePolicy);
mainLayout->addWidget(viewGroup);
mainLayout->addWidget(buttonGroup);
QVBoxLayout* viewGroupLayout = new QVBoxLayout(viewGroup);
viewGroupLayout->addWidget(meshViewGroup);
viewGroupLayout->addWidget(skeletonViewGroup);
QVBoxLayout* meshViewGroupLayout = new QVBoxLayout(meshViewGroup);
meshViewGroupLayout->addWidget(mMeshViewer);
QVBoxLayout* skeletonViewGroupLayout = new QVBoxLayout(skeletonViewGroup);
skeletonViewGroupLayout->addWidget(mSkeletonViewer);
QVBoxLayout* buttonGroupLayout = new QVBoxLayout(buttonGroup);
buttonGroupLayout->addWidget(extractSkeletonButton);
buttonGroupLayout->addWidget(findNeckButton);
buttonGroupLayout->addWidget(moveClothButton);
buttonGroupLayout->addWidget(resolvePenetrationButton);
buttonGroupLayout->addWidget(physicalSimuationButton);
buttonGroupLayout->addWidget(physicalSimuationStopButton);
connect(extractSkeletonButton, SIGNAL(clicked()), this, SLOT(extractSkeleton()));
connect(moveClothButton, SIGNAL(clicked()), this, SLOT(moveCloth()));
connect(findNeckButton, SIGNAL(clicked()), this, SLOT(deformCloth()));
connect(resolvePenetrationButton, SIGNAL(clicked()), this, SLOT(resolvePenetration()));
connect(physicalSimuationButton, SIGNAL(clicked()), this, SLOT(startPhysicalSimulation()));
connect(physicalSimuationStopButton, SIGNAL(clicked()), this, SLOT(stopPhysicalSimulation()));
// SkeletonUtility utility;
// utility.readIntoContainer("humanskeleton.txt");
// utility.readIntoContainer("clothskeleton.txt");
//
// for (int i = 0; i < globalSkeletonContainer.size(); i++)
// {
// Skeleton& skeleton = globalSkeletonContainer.getSkeletonRef(i);
// skeleton.findNeck();
// skeleton.findHand();
// }
// utility.skeletonMatch(globalSkeletonContainer.getSkeletonRef(0), globalSkeletonContainer.getSkeletonRef(1));
//
// mSkeletonViewer->updateSkeleton();
mInterval = 1000/25;
}