• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setContentsMargins函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setContentsMargins函数的典型用法代码示例。如果您正苦于以下问题:C++ setContentsMargins函数的具体用法?C++ setContentsMargins怎么用?C++ setContentsMargins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setContentsMargins函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: TestLayout

 TestLayout(QGraphicsLayoutItem *parent = 0)
     : QGraphicsLinearLayout(parent)
 {
     setContentsMargins(0,0,0,0);
     setSpacing(0);
 }
开发者ID:maxxant,项目名称:qt,代码行数:6,代码来源:tst_qgraphicslayout.cpp


示例2: QLayout

FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing)
    : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing)
{
    setContentsMargins(margin, margin, margin, margin);
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:5,代码来源:flowlayout.cpp


示例3: GcWindow

AllPlotWindow::AllPlotWindow(MainWindow *mainWindow) :
    GcWindow(mainWindow), current(NULL), mainWindow(mainWindow), active(false), stale(true)
{
    setInstanceName("Ride Plot Window");

    QWidget *c = new QWidget;
    QVBoxLayout *cl = new QVBoxLayout(c);
    setControls(c);

    setContentsMargins(0,0,0,0);

    // setup the controls
    QLabel *showLabel = new QLabel(tr("Show"), c);
    cl->addWidget(showLabel);

    showStack = new QCheckBox(tr("Stacked view"), this);
    showStack->setCheckState(Qt::Unchecked);
    cl->addWidget(showStack);

    stackWidth = 15;
    stackZoomUp = new QwtArrowButton(1, Qt::UpArrow,this);
    stackZoomUp->setFixedHeight(15);
    stackZoomUp->setFixedWidth(15);
    stackZoomUp->setEnabled(false);
    stackZoomUp->setContentsMargins(0,0,0,0);
    stackZoomUp->setFlat(true);
    cl->addWidget(stackZoomUp);

    stackZoomDown = new QwtArrowButton(1, Qt::DownArrow,this);
    stackZoomDown->setFixedHeight(15);
    stackZoomDown->setFixedWidth(15);
    stackZoomDown->setEnabled(false);
    stackZoomDown->setContentsMargins(0,0,0,0);
    stackZoomDown->setFlat(true);
    cl->addWidget(stackZoomDown);

    showFull = new QCheckBox(tr("Full plot"), this);
    showFull->setCheckState(Qt::Checked);
    cl->addWidget(showFull);

    paintBrush = new QCheckBox(tr("Fill Curves"), this);
    paintBrush->setCheckState(Qt::Unchecked);
    cl->addWidget(paintBrush);

    showGrid = new QCheckBox(tr("Grid"), this);
    showGrid->setCheckState(Qt::Checked);
    cl->addWidget(showGrid);

    showHr = new QCheckBox(tr("Heart Rate"), this);
    showHr->setCheckState(Qt::Checked);
    cl->addWidget(showHr);

    showSpeed = new QCheckBox(tr("Speed"), this);
    showSpeed->setCheckState(Qt::Checked);
    cl->addWidget(showSpeed);

    showCad = new QCheckBox(tr("Cadence"), this);
    showCad->setCheckState(Qt::Checked);
    cl->addWidget(showCad);

    showAlt = new QCheckBox(tr("Altitude"), this);
    showAlt->setCheckState(Qt::Checked);
    cl->addWidget(showAlt);

    showTemp = new QCheckBox(tr("Temperature"), this);
    showTemp->setCheckState(Qt::Checked);
    cl->addWidget(showTemp);

    showWind = new QCheckBox(tr("Headwind"), this);
    showWind->setCheckState(Qt::Checked);
    cl->addWidget(showWind);

    showTorque = new QCheckBox(tr("Torque"), this);
    showTorque->setCheckState(Qt::Checked);
    cl->addWidget(showTorque);

    showBalance = new QCheckBox(tr("Power balance"), this);
    showBalance->setCheckState(Qt::Checked);
    cl->addWidget(showBalance);

    showPower = new QComboBox();
    showPower->addItem(tr("Power + shade"));
    showPower->addItem(tr("Power - shade"));
    showPower->addItem(tr("No Power"));
    cl->addWidget(showPower);
    showPower->setCurrentIndex(0);

    comboDistance = new QComboBox();
    comboDistance->addItem(tr("X Axis Shows Time"));
    comboDistance->addItem(tr("X Axis Shows Distance"));
    cl->addWidget(comboDistance);

    QLabel *smoothLabel = new QLabel(tr("Smoothing (secs)"), this);
    smoothLineEdit = new QLineEdit(this);
    smoothLineEdit->setFixedWidth(40);

    cl->addWidget(smoothLabel);
    cl->addWidget(smoothLineEdit);
    smoothSlider = new QSlider(Qt::Horizontal);
    smoothSlider->setTickPosition(QSlider::TicksBelow);
//.........这里部分代码省略.........
开发者ID:BryanF1947,项目名称:GoldenCheetah,代码行数:101,代码来源:AllPlotWindow.cpp


示例4: QDialog

PropertiesDialog::PropertiesDialog(std::shared_ptr<ObjectProperties> objectProperties, GraphNode* node, QWidget* parent)
	: QDialog(parent)
	, m_graphNode(node)
	, m_objectProperties(objectProperties)
{
	setMinimumSize(300, 200);
	resize(500, 600);
	setWindowTitle(QString::fromStdString(m_objectProperties->name()));
	setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

	auto tabWidget = new QTabWidget;
	auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Apply	|
										  QDialogButtonBox::Cancel	|
										  QDialogButtonBox::Reset	|
										  QDialogButtonBox::Ok);

	auto applyButton = buttonBox->button(QDialogButtonBox::Apply);
	auto resetButton = buttonBox->button(QDialogButtonBox::Reset);
	auto OkButton = buttonBox->button(QDialogButtonBox::Ok);
	connect(applyButton, &QPushButton::clicked, this, &PropertiesDialog::apply);
	connect(resetButton, &QPushButton::clicked, this, &PropertiesDialog::resetWidgets);
	connect(OkButton, &QPushButton::clicked, this, &PropertiesDialog::applyAndClose);
	connect(buttonBox, &QDialogButtonBox::rejected, this, &PropertiesDialog::reject);

	auto mainLayout = new QVBoxLayout;
	mainLayout->addWidget(tabWidget);
	mainLayout->addWidget(buttonBox);
	mainLayout->setContentsMargins(5, 5, 5, 5);

	std::map<std::string, std::vector<int>> propertyGroups;
	m_propertyWidgets.reserve(m_objectProperties->properties().size());

	// Create the property widgets
	for(const auto& prop : m_objectProperties->properties())
	{
		// create property type specific widget
		std::shared_ptr<BasePropertyWidget> propWidget = PropertyWidgetFactory::instance().create(prop, this);
		if(propWidget)
		{
			connect(propWidget.get(), &BasePropertyWidget::stateChanged, this, &PropertiesDialog::stateChanged);
			int id  = m_propertyWidgets.size();
			propertyGroups[prop->group()].push_back(id);

			PropertyStruct propStruct;
			propStruct.property = prop;
			propStruct.widget = propWidget;
			m_propertyWidgets.push_back(propStruct);
		}
		else
		{
			std::cerr << "Couldn't create a widget for the property " << prop->name() << std::endl;
		}
	}

	// Group the widgets and add them to the dialog
	for(const auto& group : propertyGroups)
	{
		QString name = QString::fromStdString(group.first);
		if(name.isEmpty())
			name = "Property";

		const int maxPerTab = 10; // TODO: use combined default height of widgets instead
		const auto& properties = group.second;
		const int nb = properties.size();
		if(nb > maxPerTab)
		{
			int nbTabs = (properties.size() + maxPerTab - 1) / maxPerTab;
			auto beginIt = properties.begin();
			for(int i = 0; i < nbTabs; ++i)
			{
				QString tabName = name + " " + QString::number(i+1) + "/" + QString::number(nbTabs);
				auto startDist = i * maxPerTab;
				auto endDist = std::min(nb, startDist + maxPerTab);
				addTab(tabWidget, tabName, beginIt + startDist, beginIt + endDist);
			}
		}
		else
			addTab(tabWidget, name, properties.begin(), properties.end());
	}

	setLayout(mainLayout);

	m_objectProperties->addModifiedCallback([this](){
		readFromProperties();
	});
}
开发者ID:cguebert,项目名称:SofaViewer,代码行数:86,代码来源:PropertiesDialog.cpp


示例5: PatMainTabView

MeasuresTabView::MeasuresTabView()
  : PatMainTabView()
{
  setTitle("Organize and Edit Measures for Project");

  // Main Content

  mainContent = new QWidget();

  auto mainContentVLayout = new QVBoxLayout();
  mainContentVLayout->setContentsMargins(0,0,0,0);
  mainContentVLayout->setSpacing(0);
  mainContentVLayout->setAlignment(Qt::AlignTop);
  mainContent->setLayout(mainContentVLayout);

  viewSwitcher->setView(mainContent);

  // Select Baseline Header

  auto selectBaselineHeader = new QWidget();
  selectBaselineHeader->setFixedHeight(30);
  selectBaselineHeader->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
  selectBaselineHeader->setObjectName("SelectBaselineHeader");
  selectBaselineHeader->setStyleSheet("QWidget#SelectBaselineHeader { background: #494949; }");

  mainContentVLayout->addWidget(selectBaselineHeader);

  auto baselineHeaderHLayout = new QHBoxLayout(); 
  baselineHeaderHLayout->setContentsMargins(5,5,5,5);
  baselineHeaderHLayout->setSpacing(10);

  selectBaselineHeader->setLayout(baselineHeaderHLayout);

  baselineCautionLabel = new QLabel();
  baselineCautionLabel->setPixmap(QPixmap(":shared_gui_components/images/warning_icon.png"));
  baselineHeaderHLayout->addWidget(baselineCautionLabel);

  QLabel * selectBaselineLabel = new QLabel("Select Your Baseline Model");
  selectBaselineLabel->setStyleSheet("QLabel { color: white; font: bold; }");
  baselineHeaderHLayout->addWidget(selectBaselineLabel);

  baselineNameBackground = new QWidget();
  baselineNameBackground->setObjectName("BaselineNameBackground");
  baselineNameBackground->setStyleSheet("QWidget#BaselineNameBackground { background: #D9D9D9 }");
  baselineNameBackground->setMinimumWidth(250);
  auto baselineNameBackgroundLayout = new QHBoxLayout();
  baselineNameBackgroundLayout->setContentsMargins(5,2,5,2);
  baselineNameBackgroundLayout->setSpacing(5);
  baselineNameBackground->setLayout(baselineNameBackgroundLayout);
  baselineHeaderHLayout->addWidget(baselineNameBackground);

  baselineLabel = new QLabel();
  baselineNameBackgroundLayout->addWidget(baselineLabel);

  selectBaselineButton = new GrayButton();
  selectBaselineButton->setText("Browse");
  baselineHeaderHLayout->addWidget(selectBaselineButton);

  baselineHeaderHLayout->addStretch();

  variableGroupListView = new OSListView(true);
  variableGroupListView->setContentsMargins(0,0,0,0);
  variableGroupListView->setSpacing(0);
  mainContentVLayout->addWidget(variableGroupListView);

  QString style;
  style.append("QWidget#Footer {");
  style.append("border-top: 1px solid black; ");
  style.append("background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop: 0 #B6B5B6, stop: 1 #737172); ");
  style.append("}");

  auto footer = new QWidget();
  footer->setObjectName("Footer");
  footer->setStyleSheet(style);
  mainContentVLayout->addWidget(footer);

  auto layout = new QHBoxLayout();
  layout->setSpacing(0);
  footer->setLayout(layout);

  m_updateMeasuresButton = new BlueButton();
  m_updateMeasuresButton->setText("Sync Project Measures with Library");
  m_updateMeasuresButton->setToolTip("Check the Library for Newer Versions of the Measures in Your Project and Provides Sync Option");
  layout->addStretch();
  layout->addWidget(m_updateMeasuresButton);

  connect(m_updateMeasuresButton, &QPushButton::clicked, this, &MeasuresTabView::openUpdateMeasuresDlg);
}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:88,代码来源:MeasuresView.cpp


示例6: QDialog

SettingsDialog::SettingsDialog( QWidget *parent )
    : QDialog( parent )
    , ui( new Ui_StackedSettingsDialog )
    , m_proxySettings( this )
    , m_rejected( false )
    , m_sipModel( 0 )
    , m_resolversModel( 0 )
{
    ui->setupUi( this );
    TomahawkSettings* s = TomahawkSettings::instance();

    ui->checkBoxHttp->setChecked( s->httpEnabled() );
    ui->checkBoxStaticPreferred->setChecked( s->preferStaticHostPort() );
    ui->checkBoxUpnp->setChecked( s->externalAddressMode() == TomahawkSettings::Upnp );
    ui->checkBoxUpnp->setEnabled( !s->preferStaticHostPort() );

    createIcons();
#ifdef Q_WS_X11
    ui->listWidget->setFrameShape( QFrame::StyledPanel );
    ui->listWidget->setFrameShadow( QFrame::Sunken );
    setContentsMargins( 4, 4, 4, 4 );
#else
    ui->verticalLayout->removeItem( ui->verticalSpacer_3 );
#endif

#ifdef Q_WS_MAC
    // Avoid resize handles on sheets on osx
    m_proxySettings.setSizeGripEnabled( true );
    QSizeGrip* p = m_proxySettings.findChild< QSizeGrip* >();
    p->setFixedSize( 0, 0 );
#endif

    // SIP PLUGINS
    SipConfigDelegate* sipdel = new SipConfigDelegate( this );
    ui->accountsView->setItemDelegate( sipdel );
    ui->accountsView->setContextMenuPolicy( Qt::CustomContextMenu );

    connect( ui->accountsView, SIGNAL( clicked( QModelIndex ) ), this, SLOT( sipItemClicked( QModelIndex ) ) );
    connect( sipdel, SIGNAL( openConfig( SipPlugin* ) ), this, SLOT( openSipConfig( SipPlugin* ) ) );
    connect( ui->accountsView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sipContextMenuRequest( QPoint ) ) );
    m_sipModel = new SipModel( this );
    ui->accountsView->setModel( m_sipModel );

    setupSipButtons();

    ui->staticHostName->setText( s->externalHostname() );
    ui->staticPort->setValue( s->externalPort() );

    ui->proxyButton->setVisible( true );

    // MUSIC SCANNER
    //FIXME: MULTIPLECOLLECTIONDIRS
    if ( s->scannerPaths().count() )
        ui->lineEditMusicPath_2->setText( s->scannerPaths().first() );
    else
    {
        ui->lineEditMusicPath_2->setText( QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) );
    }

    // WATCH CHANGES
    // FIXME: QFileSystemWatcher is broken (as we know) and deprecated. Find another way.
    ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() );
    ui->checkBoxWatchForChanges->setVisible( false );

    // LAST FM
    ui->checkBoxEnableLastfm->setChecked( s->scrobblingEnabled() );
    ui->lineEditLastfmUsername->setText( s->lastFmUsername() );
    ui->lineEditLastfmPassword->setText(s->lastFmPassword() );
    connect( ui->pushButtonTestLastfmLogin, SIGNAL( clicked( bool) ), this, SLOT( testLastFmLogin() ) );

    // SCRIPT RESOLVER
    ui->removeScript->setEnabled( false );
    ResolverConfigDelegate* del = new ResolverConfigDelegate( this );
    connect( del, SIGNAL( openConfig( QString ) ), this, SLOT( openResolverConfig( QString ) ) );
    ui->scriptList->setItemDelegate( del );
    m_resolversModel = new ResolversModel( s->allScriptResolvers(), s->enabledScriptResolvers(), this );
    ui->scriptList->setModel( m_resolversModel );

    connect( ui->scriptList->selectionModel(), SIGNAL( selectionChanged( QItemSelection,QItemSelection ) ), this, SLOT( scriptSelectionChanged() ) );
    connect( ui->addScript, SIGNAL( clicked( bool ) ), this, SLOT( addScriptResolver() ) );
    connect( ui->removeScript, SIGNAL( clicked( bool ) ), this, SLOT( removeScriptResolver() ) );

    connect( ui->buttonBrowse_2, SIGNAL( clicked() ),  SLOT( showPathSelector() ) );
    connect( ui->proxyButton,  SIGNAL( clicked() ),  SLOT( showProxySettings() ) );
    connect( ui->checkBoxStaticPreferred, SIGNAL( toggled(bool) ), SLOT( toggleUpnp(bool) ) );
    connect( this,             SIGNAL( rejected() ), SLOT( onRejected() ) );

    ui->listWidget->setCurrentRow( 0 );
}
开发者ID:euroelessar,项目名称:tomahawk,代码行数:89,代码来源:settingsdialog.cpp


示例7: QWidget

StyleButtonBox::StyleButtonBox(QWidget* parent, int rows, int columns)
: QWidget(parent)
, d(new Private(rows, columns))
{
    //setMinimumSize(45, 70);
    setContentsMargins(0, 0, 0, 0);

    QGridLayout * layout = new QGridLayout(this);
    d->group = new QButtonGroup(this);

    // The button for no fill
    QToolButton* button = new QToolButton(this);
    //button->setIcon(QPixmap((const char **) buttonnone));
    button->setIcon(koIcon("edit-delete"));
    button->setToolTip(QObject::tr("No stroke or fill"));
    d->group->addButton(button, None);

    // The button for solid fill
    button = new QToolButton(this);
    button->setIcon(QPixmap((const char **) buttonsolid));
    button->setToolTip(QObject::tr("Solid color stroke or fill"));
    d->group->addButton(button, Solid);

    // The button for gradient fill
    button = new QToolButton(this);
    button->setIcon(QPixmap((const char **) buttongradient));
    button->setToolTip(QObject::tr("Gradient"));
    d->group->addButton(button, Gradient);

    // The button for pattern fill
    button = new QToolButton(this);
    button->setIcon(QPixmap((const char **) buttonpattern));
    button->setToolTip(QObject::tr("Pattern"));
    d->group->addButton(button, Pattern);

    // The button for even-odd fill rule
    button = new QToolButton(this);
    button->setIcon(QPixmap((const char **) buttonevenodd));
    button->setToolTip(QObject::tr("Even-Odd Fill"));
    d->group->addButton(button, EvenOdd);

    // The button for winding fill-rule
    button = new QToolButton(this);
    button->setIcon(QPixmap((const char **) buttonwinding));
    button->setToolTip(QObject::tr("Winding Fill"));
    d->group->addButton(button, Winding);

    int index = 1;
    for(int row = 0; row < d->rowCount; ++row) {
        for(int col = 0; col < d->columnCount; ++col) {
            layout->addWidget(d->group->button(index), row, col);
            index = index<<1;
            if(index > Winding)
                break;
        }
        if(index > Winding)
            break;
    }

    layout->setMargin(0);
    layout->setSpacing(1);
    layout->setColumnStretch(0, 1);
    layout->setColumnStretch(1, 1);
    layout->setRowStretch(3, 1);

    connect(d->group, SIGNAL(buttonClicked(int)), this, SIGNAL(buttonPressed(int)));
}
开发者ID:NavyZhao1978,项目名称:QCalligra,代码行数:67,代码来源:StyleButtonBox.cpp


示例8: connect

void ptToolBox::createGui() {
  GInfo->Assert(FBodyWidget, "The toolbox cannot have a null body widget.", AT);
  GInfo->Assert(FFilter, "The filter associated with the toolbox cannot be null.", AT);

  this->setObjectName(FFilter->uniqueName());

  FIsFolded = Settings->m_IniSettings->value(this->objectName() + "/Folded", true).toBool();

  FHeaderWidget = new QWidget;
  FHeaderWidget->setContextMenuPolicy(Qt::NoContextMenu);  // event filter handles context menu
  FHeaderWidget->installEventFilter(this);

  // The header contains from left to right:
  // left-justified: FStatusArrow, FCaption; right-justified: FHelpIcon, FSlowIcon
  FStatusArrow = new QLabel;
  connect(FFilter, SIGNAL(activityChanged()), this, SLOT(updateGui()));

  FCaption = new QLabel(FFilter->caption());
  FCaption->setTextFormat(Qt::PlainText);
  FCaption->setTextInteractionFlags(Qt::NoTextInteraction);
  auto hFont = FCaption->font();
  hFont.setBold(true);
  FCaption->setFont(hFont);

  FHelpIcon = new QLabel;
  FHelpIcon->setPixmap(*Theme->ptIconQuestion);
  FHelpIcon->setCursor(QCursor(Qt::PointingHandCursor));
  FHelpIcon->setToolTip(tr("Open help page in web browser."));
  FHelpIcon->hide();
  FHelpIcon->installEventFilter(this);

  FSlowIcon = new QLabel;
  FSlowIcon->setPixmap(QPixmap(QString::fromUtf8(":/dark/ui-graphics/bubble-attention.png")));
  FSlowIcon->setToolTip(tr("Complex filter. Might be slow."));
  FSlowIcon->hide();

  // layout for the header
  auto hHeaderLayout = new QHBoxLayout(FHeaderWidget);
  hHeaderLayout->addWidget(FStatusArrow);
  hHeaderLayout->addWidget(FCaption);
  hHeaderLayout->addStretch();
  hHeaderLayout->addWidget(FHelpIcon);
  hHeaderLayout->addWidget(FSlowIcon);
  hHeaderLayout->setContentsMargins(3,3,3,3);
  hHeaderLayout->setSpacing(4);

  // body widget with the main filter config widgets
  FBodyWidget->setParent(this);
  FBodyWidget->setObjectName("ToolBoxBody");
  FBodyWidget->setVisible(!FIsFolded);

  // Toolbox handles margins and spacing of the body widget’s main layout to ensure consistency.
  auto hBodyLayout = FBodyWidget->layout();
  GInfo->Assert(hBodyLayout, QString("Error! GUI widget of filter \"%1\" does not have a layout.")
                             .arg(FFilter->uniqueName()), AT);
  hBodyLayout->setContentsMargins(8,5,2,5);
  hBodyLayout->setSpacing(4);

  // assemble the toolbox: place header and body in a vertical layout
  auto hBoxLayout = new QVBoxLayout(this);
  hBoxLayout->addWidget(FHeaderWidget);
  hBoxLayout->addWidget(FBodyWidget);
  hBoxLayout->setContentsMargins(0,0,0,0);
  hBoxLayout->setSpacing(0);
  hBoxLayout->setAlignment(Qt::AlignTop);
}
开发者ID:divyang4481,项目名称:photivo,代码行数:66,代码来源:ptToolBox.cpp


示例9: InstrumentParameterPanel


//.........这里部分代码省略.........
    connect(m_variationComboBox, SIGNAL(activated(int)),
            SLOT(slotSelectVariation(int)));

    // Channel Label
    QLabel *channelLabel = new QLabel(tr("Channel"), this);
    channelLabel->setFont(f);
    QString channelTip(tr("<qt><p><i>Auto</i>, allocate channel automatically; <i>Fixed</i>, fix channel to instrument number</p></qt>"));
    channelLabel->setToolTip(channelTip);

    // Channel ComboBox
    m_channelValue = new QComboBox;
    m_channelValue->setFont(f);
    m_channelValue->setToolTip(channelTip);
    m_channelValue->setMaxVisibleItems(2);
    // Everything else sets up elsewhere, but these don't vary per instrument:
    m_channelValue->addItem(tr("Auto"));
    m_channelValue->addItem(tr("Fixed"));
    m_channelValue->setMinimumContentsLength(minimumContentsLength);
    connect(m_channelValue, SIGNAL(activated(int)),
            SLOT(slotSelectChannel(int)));

    // Receive External Label
    QLabel *receiveExternalLabel = new QLabel(tr("Receive external"), this);
    receiveExternalLabel->setFont(f);
    QString receiveExternalTip = tr("<qt>Use program changes from an external source to manipulate these controls (only valid for the currently-active track) [Shift + P]</qt>");
    receiveExternalLabel->setToolTip(receiveExternalTip);
    
    // Receive External CheckBox
    m_receiveExternalCheckBox = new QCheckBox;
    m_receiveExternalCheckBox->setFont(f);
    m_receiveExternalCheckBox->setToolTip(receiveExternalTip);
    m_receiveExternalCheckBox->setShortcut((QKeySequence)"Shift+P");
    m_receiveExternalCheckBox->setChecked(false);

    // Rotary Frame and Grid
    m_rotaryFrame = new QFrame(this);
    m_rotaryFrame->setContentsMargins(8, 8, 8, 8);
    m_rotaryGrid = new QGridLayout(m_rotaryFrame);
    m_rotaryGrid->setSpacing(1);
    m_rotaryGrid->setMargin(0);
    m_rotaryGrid->addItem(new QSpacerItem(10, 4), 0, 1);
    m_rotaryFrame->setLayout(m_rotaryGrid);

    // Rotary Mapper
    m_rotaryMapper = new QSignalMapper(this);
    connect(m_rotaryMapper, SIGNAL(mapped(int)),
            SLOT(slotControllerChanged(int)));

    connect(Instrument::getStaticSignals().data(),
            SIGNAL(changed(Instrument *)),
            SLOT(slotInstrumentChanged(Instrument *)));

    // Layout

    QGridLayout *mainGrid = new QGridLayout(this);
    mainGrid->setMargin(0);
    mainGrid->setSpacing(3);
    mainGrid->setColumnStretch(2, 1);

    mainGrid->addWidget(m_instrumentLabel, 0, 0, 1, 4, Qt::AlignCenter);

    mainGrid->addWidget(m_connectionLabel, 1, 0, 1, 4, Qt::AlignCenter);

    mainGrid->addItem(new QSpacerItem(1, 5), 2, 0, 1, 4);

    mainGrid->addWidget(percussionLabel, 3, 0, 1, 2, Qt::AlignLeft);
    mainGrid->addWidget(m_percussionCheckBox, 3, 3, Qt::AlignLeft);

    mainGrid->addWidget(m_bankLabel, 4, 0, Qt::AlignLeft);
    mainGrid->addWidget(m_bankCheckBox, 4, 1, Qt::AlignRight);
    mainGrid->addWidget(m_bankComboBox, 4, 2, 1, 2, Qt::AlignRight);

    mainGrid->addWidget(m_programLabel, 5, 0, Qt::AlignLeft);
    mainGrid->addWidget(m_programCheckBox, 5, 1, Qt::AlignRight);
    mainGrid->addWidget(m_programComboBox, 5, 2, 1, 2, Qt::AlignRight);

    mainGrid->addWidget(m_variationLabel, 6, 0);
    mainGrid->addWidget(m_variationCheckBox, 6, 1);
    mainGrid->addWidget(m_variationComboBox, 6, 2, 1, 2, Qt::AlignRight);

    mainGrid->addWidget(channelLabel, 7, 0, Qt::AlignLeft);
    mainGrid->addWidget(m_channelValue, 7, 2, 1, 2, Qt::AlignRight);

    mainGrid->addWidget(m_receiveExternalCheckBox, 8, 3, Qt::AlignLeft);
    mainGrid->addWidget(receiveExternalLabel, 8, 0, 1, 3, Qt::AlignLeft);

    mainGrid->addItem(new QSpacerItem(1, 5), 9, 0, 1, 4);

    // Add the rotary frame to the main grid layout.
    mainGrid->addWidget(m_rotaryFrame, 10, 0, 1, 4, Qt::AlignHCenter);

    mainGrid->addItem(new QSpacerItem(1, 1), 11, 0, 1, 4);
    // Let the last row take up the rest of the space.  This keeps
    // the widgets above compact vertically.
    mainGrid->setRowStretch(11, 1);

    setLayout(mainGrid);

    setContentsMargins(2, 7, 2, 2);
}
开发者ID:tedfelix,项目名称:rosegarden,代码行数:101,代码来源:MIDIInstrumentParameterPanel.cpp


示例10: setContentsMargins

void EditWidget::majMargin(int left, int right)
{
    setContentsMargins(left, 5, right, 5);
}
开发者ID:zakynes,项目名称:Web-Administrator,代码行数:4,代码来源:editwidget.cpp


示例11: OSListView

DataPointRunContentView::DataPointRunContentView()
  : OSListView()
{
  setContentsMargins(0,5,0,5);
}
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:5,代码来源:RunView.cpp


示例12: ModelObjectInspectorView

LuminaireDefinitionInspectorView::LuminaireDefinitionInspectorView(bool isIP, const openstudio::model::Model& model, QWidget * parent)
  : ModelObjectInspectorView(model, true, parent)
{
  m_isIP = isIP;

  auto visibleWidget = new QWidget();
  this->stackedWidget()->addWidget(visibleWidget);

  auto mainGridLayout = new QGridLayout();
  mainGridLayout->setContentsMargins(7,7,7,7);
  mainGridLayout->setSpacing(14);
  visibleWidget->setLayout(mainGridLayout);

  // Name

  QLabel * label = new QLabel("Name: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,0,0);

  m_nameEdit = new OSLineEdit();
  mainGridLayout->addWidget(m_nameEdit,1,0,1,2);

  // Lighting Power

  label = new QLabel("Lighting Power: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,2,0);

  m_lightingPowerEdit = new OSQuantityEdit(m_isIP);
  connect(this, &LuminaireDefinitionInspectorView::toggleUnitsClicked, m_lightingPowerEdit, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_lightingPowerEdit,3,0);

  // Fraction Radiant

  label = new QLabel("Fraction Radiant: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,4,0);

  m_fractionRadiantEdit = new OSQuantityEdit(m_isIP);
  connect(this, &LuminaireDefinitionInspectorView::toggleUnitsClicked, m_fractionRadiantEdit, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_fractionRadiantEdit,5,0);

  // Fraction Visible

  label = new QLabel("Fraction Visible: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,4,1);

  m_fractionVisibleEdit = new OSQuantityEdit(m_isIP);
  connect(this, &LuminaireDefinitionInspectorView::toggleUnitsClicked, m_fractionVisibleEdit, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_fractionVisibleEdit,5,1);

  // Return Air Fraction 

  label = new QLabel("Return Air Fraction: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,6,0);

  m_returnAirFractionEdit = new OSQuantityEdit(m_isIP);
  connect(this, &LuminaireDefinitionInspectorView::toggleUnitsClicked, m_returnAirFractionEdit, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_returnAirFractionEdit,7,0);

  // Stretch

  mainGridLayout->setRowStretch(8,100);

  mainGridLayout->setColumnStretch(2,100);
}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:68,代码来源:LuminaireInspectorView.cpp


示例13: QWidget

VolumeRenderWidget::VolumeRenderWidget(QWidget *parent)
	:m_renderMode(0), QWidget(parent)
{
	
	m_openGLWidget = new QVTKOpenGLWidget(this);
	vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;
	m_openGLWidget->SetRenderWindow(renderWindow);
	m_renderer = vtkSmartPointer<vtkOpenGLRenderer>::New();
	m_renderer->BackingStoreOn();
	renderWindow->AddRenderer(m_renderer);
	renderWindow->Render(); // making opengl context

	vtkSmartPointer<vtkVolumeProperty> volumeProperty = vtkSmartPointer<vtkVolumeProperty>::New();
	vtkSmartPointer<vtkColorTransferFunction> colorFun = vtkSmartPointer<vtkColorTransferFunction>::New();
	vtkSmartPointer<vtkPiecewiseFunction> opacityFun = vtkSmartPointer<vtkPiecewiseFunction>::New();
	vtkSmartPointer<vtkPiecewiseFunction> gradientFun = vtkSmartPointer<vtkPiecewiseFunction>::New();
	volumeProperty->SetColor(colorFun);
	volumeProperty->SetScalarOpacity(opacityFun);
	volumeProperty->SetGradientOpacity(gradientFun);
	volumeProperty->ShadeOn();
	volumeProperty->SetInterpolationTypeToLinear();
	volumeProperty->SetAmbient(0.6);
	volumeProperty->SetDiffuse(0.9);
	volumeProperty->SetSpecular(0.5);
	volumeProperty->SetSpecularPower(10.0);
	//volumeProperty->IndependentComponentsOff();

	m_settingsWidget = new VolumeRenderSettingsWidget(volumeProperty, this);
	connect(this, &VolumeRenderWidget::imageDataChanged, m_settingsWidget, &VolumeRenderSettingsWidget::setImage);
	connect(m_settingsWidget, &VolumeRenderSettingsWidget::propertyChanged, this, &VolumeRenderWidget::updateRendering);
	connect(m_settingsWidget, &VolumeRenderSettingsWidget::renderModeChanged, this, &VolumeRenderWidget::setRenderMode);
	connect(m_settingsWidget, &VolumeRenderSettingsWidget::cropPlanesChanged, this, &VolumeRenderWidget::setCropPlanes);

	auto layout = new QVBoxLayout;
	layout->setContentsMargins(0, 0, 0, 0);
	layout->addWidget(m_openGLWidget);
	this->setLayout(layout);


	//adding orientation prop
	m_orientationProp = std::make_shared<OrientationActorContainer>();
	auto orientationPropPtr = std::static_pointer_cast<VolumeActorContainer>(m_orientationProp).get();
	m_volumeProps.push_back(orientationPropPtr);
	m_renderer->AddActor(m_orientationProp->getActor());	


	//window settings
	m_renderer->SetBackground(0, 0, 0);
	auto menuIcon = QIcon(QString("resources/icons/settings.svg"));
	auto menuButton = new QPushButton(menuIcon, QString(), m_openGLWidget);
	menuButton->setIconSize(QSize(24, 24));
	menuButton->setStyleSheet("QPushButton {background-color:transparent;}");
	auto menu = new QMenu(menuButton);
	menuButton->setMenu(menu);


	auto showAdvancedAction = menu->addAction(tr("Advanced"));
	connect(showAdvancedAction, &QAction::triggered, m_settingsWidget, &VolumeRenderSettingsWidget::toggleVisibility);


	auto showGrapicsAction = menu->addAction(tr("Show graphics"));
	showGrapicsAction->setCheckable(true);
	showGrapicsAction->setChecked(true);
	connect(showGrapicsAction, &QAction::toggled, this, &VolumeRenderWidget::setActorsVisible);

	menu->addAction(QString(tr("Set background color")), [=]() {
		auto color = QColorDialog::getColor(Qt::black, this);
		if (color.isValid())
			m_renderer->SetBackground(color.redF(), color.greenF(), color.blueF());
		updateRendering();
	});
	menu->addAction(QString(tr("Save image to file")), [=]() {
		auto filename = QFileDialog::getSaveFileName(this, tr("Save File"), "untitled.png", tr("Images (*.png)"));
		if (!filename.isEmpty())
		{
			auto renderWindow = m_openGLWidget->GetRenderWindow();
			vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter =
				vtkSmartPointer<vtkWindowToImageFilter>::New();
			windowToImageFilter->SetInput(renderWindow);
			windowToImageFilter->SetScale(3, 3); //set the resolution of the output image (3 times the current resolution of vtk render window)
			windowToImageFilter->SetInputBufferTypeToRGBA(); //also record the alpha (transparency) channel
			windowToImageFilter->ReadFrontBufferOff(); // read from the back buffer
			windowToImageFilter->Update();
			vtkSmartPointer<vtkPNGWriter> writer =
				vtkSmartPointer<vtkPNGWriter>::New();
			writer->SetFileName(filename.toLatin1().data());
			writer->SetInputConnection(windowToImageFilter->GetOutputPort());
			writer->Write();
		}
	});


}
开发者ID:medicalphysics,项目名称:OpenDXMC,代码行数:93,代码来源:volumerenderwidget.cpp


示例14: QWidget

ChartBar::ChartBar(Context *context) : QWidget(context->mainWindow), context(context)
{
    // left / right scroller icon
    static QIcon leftIcon = iconFromPNG(":images/mac/left.png");
    static QIcon rightIcon = iconFromPNG(":images/mac/right.png");

    setContentsMargins(0,0,0,0);

    // main layout
    QHBoxLayout *mlayout = new QHBoxLayout(this);
    mlayout->setSpacing(0);
    mlayout->setContentsMargins(0,0,0,0);

    // buttonBar Widget
    buttonBar = new ButtonBar(this);
    buttonBar->setContentsMargins(0,0,0,0);

    QHBoxLayout *vlayout = new QHBoxLayout(buttonBar); 
    vlayout->setSpacing(0);
    vlayout->setContentsMargins(0,0,0,0);

    layout = new QHBoxLayout;
    layout->setSpacing(2);
    layout->setContentsMargins(0,0,0,0);
    vlayout->addLayout(layout);
    vlayout->addStretch();

    // scrollarea
    scrollArea = new QScrollArea(this);
    scrollArea->setAutoFillBackground(false);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameStyle(QFrame::NoFrame);
    scrollArea->setContentsMargins(0,0,0,0);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QFontMetrics fs(buttonFont);
    setFixedHeight(fs.height()+spacing_);
    scrollArea->setFixedHeight(fs.height()+spacing_);
    buttonBar->setFixedHeight(fs.height()+spacing_);

    scrollArea->setWidget(buttonBar);

    // scroll area turns it on .. we turn it off!
    buttonBar->setAutoFillBackground(false);

    // scroller buttons
    left = new QToolButton(this);
    left->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    left->setAutoFillBackground(false);
    left->setFixedSize(20,20);
    left->setIcon(leftIcon);
    left->setIconSize(QSize(20,20));
    left->setFocusPolicy(Qt::NoFocus);
    mlayout->addWidget(left);
    connect(left, SIGNAL(clicked()), this, SLOT(scrollLeft()));

    // menu bar in the middle of the buttons
    mlayout->addWidget(scrollArea);

    right = new QToolButton(this);
    right->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    right->setAutoFillBackground(false);
    right->setFixedSize(20,20);
    right->setIcon(rightIcon);
    right->setIconSize(QSize(20,20));
    right->setFocusPolicy(Qt::NoFocus);
    mlayout->addWidget(right);
    connect(right, SIGNAL(clicked()), this, SLOT(scrollRight()));

    // spacer to make the menuButton on the right
    QLabel *spacer = new QLabel("", this);
    spacer->setAutoFillBackground(false);
    spacer->setFixedHeight(20);
    spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
    mlayout->addWidget(spacer);

    menuButton = new QToolButton(this);
    menuButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    menuButton->setAutoFillBackground(false);
    menuButton->setFixedSize(20,20);
    menuButton->setIcon(iconFromPNG(":images/sidebar/extra.png"));
    menuButton->setIconSize(QSize(10,10));
    menuButton->setFocusPolicy(Qt::NoFocus);
    mlayout->addWidget(menuButton);
    //connect(p, SIGNAL(clicked()), action, SLOT(trigger()));

    signalMapper = new QSignalMapper(this); // maps each option
    connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(clicked(int)));

    barMenu = new QMenu("Add");
    chartMenu = barMenu->addMenu(tr("Add Chart"));

#ifdef GC_HAS_CLOUD_DB
    barMenu->addAction(tr("Upload Chart..."), context->mainWindow, SLOT(exportChartToCloudDB()));
    barMenu->addAction(tr("Download Chart..."), context->mainWindow, SLOT(addChartFromCloudDB()));
#endif
    // menu
    connect(menuButton, SIGNAL(clicked()), this, SLOT(menuPopup()));
    connect(chartMenu, SIGNAL(aboutToShow()), this, SLOT(setChartMenu()));
//.........这里部分代码省略.........
开发者ID:viiru-,项目名称:GoldenCheetah,代码行数:101,代码来源:ChartBar.cpp


示例15: QToolBar

ViewerToolBar::ViewerToolBar(QWidget *parent) :
    QToolBar(parent)
{
    downloadIsCompleted = true;
    //start_Action = new QAction(this);
    //start_Action->setIcon(QIcon::fromTheme("start"));
    //start_Action->setToolTip(tr("Start"));
    //start_Menu = new QMenu(this);
    //restore_Action = start_Menu->addAction(tr("Restore"));
    //restore_Action->setIcon(QIcon::fromTheme("start"));
    //start_Action->setMenu(start_Menu);
    pause_Action = new QAction(this);
    pause_Action->setIcon(QIcon::fromTheme("pause"));
    pause_Action->setToolTip(tr("Pause"));
    destroy_Menu = new QMenu(this);
    reboot_Action = destroy_Menu->addAction(tr("Reboot"));
    reboot_Action->setIcon(QIcon::fromTheme("reboot"));
    reset_Action = destroy_Menu->addAction(tr("Reset"));
    reset_Action->setIcon(QIcon::fromTheme("reset"));
    destroy_Menu->addSeparator();
    shutdown_Action = destroy_Menu->addAction(tr("Shutdown"));
    shutdown_Action->setIcon(QIcon::fromTheme("shutdown"));
    save_Action = destroy_Menu->addAction(tr("Save"));
    save_Action->setIcon(QIcon::fromTheme("save"));
    destroy_Action = new QAction(this);
    destroy_Action->setIcon(QIcon::fromTheme("destroy"));
    destroy_Action->setToolTip(tr("Stop"));
    destroy_Action->setMenu(destroy_Menu);
    snapshot_Menu = new QMenu(this);
    createSnapshot = snapshot_Menu->addAction(
                tr("create Snapshot of Current Domain"));
    createSnapshot->setIcon(QIcon::fromTheme("camera-photo"));
    moreSnapshot_Actions = snapshot_Menu->addAction(
                tr("more Snapshot actions for Domain"));
    moreSnapshot_Actions->setIcon(QIcon::fromTheme("camera-photo"));
    snapshot_Action = new QAction(this);
    snapshot_Action->setIcon(QIcon::fromTheme("camera-photo"));
    snapshot_Action->setToolTip(tr("Snapshot now!"));
    snapshot_Action->setMenu(snapshot_Menu);
    reconnect_Action = new QAction(this);
    reconnect_Action->setIcon(QIcon::fromTheme("view-refresh"));
    reconnect_Action->setToolTip(tr("Reconnect"));
    keySeq_Action = new QAction(this);
    keySeq_Action->setIcon(QIcon::fromTheme("input-keyboard"));
    keySeq_Action->setToolTip(tr("Send key sequence"));
    keySequenceMenu = new QMenu(this);
    keySeq_Action->setMenu(keySequenceMenu);
    sendKeySeq_BackSpc = keySequenceMenu->addAction("Ctrl+Alt+BackSpace");
    sendKeySeq_Del = keySequenceMenu->addAction("Ctrl+Alt+Del");
    keySequenceMenu->addSeparator();
    sendKeySeq_1 = keySequenceMenu->addAction("Ctrl+Alt+F1");
    sendKeySeq_2 = keySequenceMenu->addAction("Ctrl+Alt+F2");
    sendKeySeq_3 = keySequenceMenu->addAction("Ctrl+Alt+F3");
    sendKeySeq_4 = keySequenceMenu->addAction("Ctrl+Alt+F4");
    sendKeySeq_5 = keySequenceMenu->addAction("Ctrl+Alt+F5");
    sendKeySeq_6 = keySequenceMenu->addAction("Ctrl+Alt+F6");
    sendKeySeq_7 = keySequenceMenu->addAction("Ctrl+Alt+F7");
    sendKeySeq_8 = keySequenceMenu->addAction("Ctrl+Alt+F8");
    keySequenceMenu->addSeparator();
    getScreenshot = keySequenceMenu->addAction(tr("get Guest Screenshot"));
    copyFiles_Action = new QAction(this);
    copyFiles_Action->setIcon(QIcon::fromTheme("document-send"));
    copyFiles_Action->setToolTip(tr("Copy Files to Guest"));
    copyToClipboard = new QAction(this);
    copyToClipboard->setIcon(QIcon::fromTheme("edit-copy"));
    copyToClipboard->setToolTip(tr("Copy from Guest to Clipboard"));
    pasteClipboard = new QAction(this);
    pasteClipboard->setIcon(QIcon::fromTheme("edit-paste"));
    pasteClipboard->setToolTip(tr("Paste Clipboard to Guest"));
    fullScreen = new QAction(this);
    fullScreen->setIcon(QIcon::fromTheme("fullscreen"));
    fullScreen->setToolTip(tr("FullScreen"));
    scaled_to = new QAction(this);
    scaled_to->setIcon(QIcon::fromTheme("scaled_to_window"));
    scaled_to->setToolTip(tr("Scale to window"));
    vm_stateWdg = new VM_State_Widget(this);

    //addAction(start_Action);
    addAction(pause_Action);
    addAction(destroy_Action);
    sep1 = addSeparator();
    addAction(snapshot_Action);
    sep2 = addSeparator();
    addAction(reconnect_Action);
    addSeparator();
    addAction(keySeq_Action);
    addAction(copyFiles_Action);
    addAction(copyToClipboard);
    addAction(pasteClipboard);
    addSeparator();
    addAction(fullScreen);
    addAction(scaled_to);
    addSeparator();
    stateWdg_Action = addWidget(vm_stateWdg);

    connect(this, SIGNAL(actionTriggered(QAction*)),
            this, SLOT(detectTriggeredAction(QAction*)));
    setContentsMargins(0,0,0,0);
}
开发者ID:F1ash,项目名称:qt-virt-manager,代码行数:99,代码来源:viewer_toolbar.cpp


示例16: QWidget

TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) :
    QWidget(parent), model(0), transactionProxyModel(0),
    transactionView(0), abandonAction(0)
{
    // Build filter row
    setContentsMargins(0,0,0,0);

    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setContentsMargins(0,0,0,0);

    if (platformStyle->getUseExtraSpacing()) {
        hlayout->setSpacing(5);
        hlayout->addSpacing(26);
    } else {
        hlayout->setSpacing(0);
        hlayout->addSpacing(23);
    }

    watchOnlyWidget = new QComboBox(this);
    watchOnlyWidget->setFixedWidth(24);
    watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All);
    watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_plus"), "", TransactionF 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setContext函数代码示例发布时间:2022-05-30
下一篇:
C++ setContentType函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap