本文整理汇总了C++中QToolBar::setContentsMargins方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar::setContentsMargins方法的具体用法?C++ QToolBar::setContentsMargins怎么用?C++ QToolBar::setContentsMargins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolBar
的用法示例。
在下文中一共展示了QToolBar::setContentsMargins方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QToolButton
VolumePopupButton::VolumePopupButton( QWidget * parent, PlayerManager *mgr ) :
QToolButton( parent ),
m_prevVolume(0.0),
m_curVolume(0.0),
player(mgr)
{
//create the volume popup
m_volumeMenu = new QMenu( this );
KVBox *mainBox = new KVBox( this );
m_volumeLabel= new QLabel( mainBox );
m_volumeLabel->setAlignment( Qt::AlignHCenter );
KHBox *sliderBox = new KHBox( mainBox );
m_volumeSlider = new VolumeSlider( 100, sliderBox, false );
m_volumeSlider->setFixedHeight( 170 );
mainBox->setMargin( 0 );
mainBox->setSpacing( 0 );
sliderBox->setSpacing( 0 );
sliderBox->setMargin( 0 );
mainBox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
sliderBox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
QWidgetAction *sliderActionWidget = new QWidgetAction( this );
sliderActionWidget->setDefaultWidget( mainBox );
// volumeChanged is a customSignal, is not emited by setValue()
connect( m_volumeSlider, SIGNAL(volumeChanged(float)), player, SLOT(setVolume(float)) );
QToolBar *muteBar = new QToolBar( QString(), mainBox );
muteBar->setContentsMargins( 0, 0, 0, 0 );
muteBar->setIconSize( QSize( 16, 16 ) );
// our popup's mute-toggle button
m_muteAction = new QAction( KIcon( "audio-volume-muted" ), QString(), muteBar );
m_muteAction->setToolTip( i18n( "Mute/Unmute" ) );
connect( m_muteAction, SIGNAL(triggered(bool)), this, SLOT(slotToggleMute(bool)) );
connect( player, SIGNAL(mutedChanged(bool)), this, SLOT(slotMuteStateChanged(bool)) );
m_volumeMenu->addAction( sliderActionWidget );
muteBar->addAction( m_muteAction );
/* set icon and label to match create state of AudioOutput, as the
* desired volume value is not available yet (because the player
* object is not set up yet.) Someone must call PlayerManager::setVolume()
* later.
*/
slotVolumeChanged( 1.0 );
// let player notify us when volume changes
connect( player, SIGNAL(volumeChanged(float)), this, SLOT(slotVolumeChanged(float)) );
}
示例2: QWidget
TimelineWidget::TimelineWidget(QWidget* parent) :
QWidget(parent),
m_timelineView(NULL),
m_timeRate(1.0),
m_paused(true)
{
m_timelineView = new TimelineView(this);
connect(m_timelineView, SIGNAL(currentTimeChanged(double)), this, SIGNAL(currentTimeChanged(double)));
QWidget* controls = new QWidget(this);
controls->setContentsMargins(0, 0, 0, 0);
QHBoxLayout* controlsLayout = new QHBoxLayout(controls);
QLabel* zoomLabel = new QLabel(controls);
zoomLabel->setText("Zoom: "
"<a href=\"0.04167\">1h</a> "
"<a href=\"0.08333\">6h</a> "
"<a href=\"0.5\">12h</a> "
"<a href=\"1\">1d</a> "
"<a href=\"5\">5d</a> "
"<a href=\"10\">10d</a> "
"<a href=\"30\">1m</a> "
"<a href=\"180\">6m</a> "
"<a href=\"365\">1y</a> "
"<a href=\"all\">all</a>");
QToolBar* toolbar = new QToolBar(controls);
toolbar->setIconSize(QSize(24, 24));
toolbar->setMaximumHeight(24);
toolbar->setMovable(false);
toolbar->setFloatable(false);
toolbar->setContentsMargins(0, 0, 0, 0);
QAction* reverseTimeAction = new QAction(QIcon(":/icons/timeline-reverse.png"),
tr("Reverse time"), toolbar);
QAction* slowTimeAction = new QAction(QIcon(":/icons/timeline-slower.png"),
tr("10x slower"), toolbar);
QAction* halfTimeAction = new QAction(QIcon(":/icons/timeline-half.png"),
tr("2x slower"), toolbar);
QAction* pauseAction = new QAction(QIcon(":/icons/timeline-pause.png"),
tr("Pause time"), toolbar);
QAction* realTimeAction = new QAction(QIcon(":/icons/timeline-realtime.png"),
tr("Real time"), toolbar);
QAction* doubleTimeAction = new QAction(QIcon(":/icons/timeline-double.png"),
tr("2x faster"), toolbar);
QAction* fastTimeAction = new QAction(QIcon(":/icons/timeline-faster.png"),
tr("10x faster"), toolbar);
connect(reverseTimeAction, SIGNAL(triggered()), this, SLOT(reverseTime()));
toolbar->addAction(reverseTimeAction);
connect(slowTimeAction, SIGNAL(triggered()), this, SLOT(slowerTime()));
toolbar->addAction(slowTimeAction);
connect(halfTimeAction, SIGNAL(triggered()), this, SLOT(halfTime()));
toolbar->addAction(halfTimeAction);
connect(pauseAction, SIGNAL(triggered()), this, SLOT(togglePaused()));
toolbar->addAction(pauseAction);
connect(realTimeAction, SIGNAL(triggered()), this, SLOT(realTime()));
toolbar->addAction(realTimeAction);
connect(doubleTimeAction, SIGNAL(triggered()), this, SLOT(doubleTime()));
toolbar->addAction(doubleTimeAction);
connect(fastTimeAction, SIGNAL(triggered()), this, SLOT(fasterTime()));
toolbar->addAction(fastTimeAction);
controlsLayout->addWidget(toolbar);
controlsLayout->addStretch(1);
controlsLayout->addWidget(zoomLabel);
controls->setLayout(controlsLayout);
connect(zoomLabel, SIGNAL(linkActivated(const QString&)), this, SLOT(setZoom(const QString&)));
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_timelineView);
layout->addWidget(controls);
//layout->addLayout(controlsLayout);
layout->setContentsMargins(0, 0, 0, 0);
this->setLayout(layout);
this->show();
m_timelineView->setTimeRange(0.0, 5.0);
}
示例3: toolBar
QToolBar* specActionLibrary::toolBar(QWidget* target)
{
QToolBar* bar = new QToolBar(target) ;
bar->setContentsMargins(0, 0, 0, 0) ;
bar->setIconSize(QSize(20, 20)) ;
specView* view = dynamic_cast<specView*>(target) ;
specDataView* dataView = dynamic_cast<specDataView*>(target) ;
specMetaView* metaView = dynamic_cast<specMetaView*>(target) ;
specLogView* logView = dynamic_cast<specLogView*>(target) ;
specPlot* plot = dynamic_cast<specPlot*>(target) ;
specPlotWidget* plotWidget = dynamic_cast<specPlotWidget*>(target) ;
if(view && view->model())
{
addParent(view) ;
addParent(view->model()) ;
addNewAction(bar, new specAddFolderAction(target)) ;
if(metaView)
addNewAction(bar, new specNewMetaItemAction(target));
else
{
addNewAction(bar, new specImportSpecAction(target)) ;
addNewAction(bar, new specTreeAction(target)) ;
addNewAction(bar, new specFlattenTreeAction(target)) ;
}
if(dataView || metaView)
addNewAction(bar, new specAddSVGItemAction(target)) ;
addNewAction(bar, new genericExportAction(target)) ;
bar->addSeparator() ;
addNewAction(bar, new specCopyAction(target)) ;
if(dataView || metaView)
addNewAction(bar, new matrixExportAction(target)) ;
addNewAction(bar, new specCutAction(target)) ;
addNewAction(bar, new specPasteAction(target)) ;
addNewAction(bar, new specDeleteAction(target)) ;
bar->addSeparator() ;
if(metaView || logView)
{
bar->addAction(undoAction(view)) ;
bar->addAction(redoAction(view)) ;
bar->addSeparator() ;
}
if(dataView)
{
addNewAction(bar, new toggle3DPlotAction(target)) ;
addNewAction(bar, new specMergeAction(target)) ;
addNewAction(bar, new specTiltMatrixAction(target)) ;
addNewAction(bar, new specDescriptorEditAction(target)) ;
bar->addSeparator() ;
addNewAction(bar, new specRemoveDataAction(target)) ;
addNewAction(bar, new specAverageDataAction(target)) ;
addNewAction(bar, new specSpectrumCalculatorAction(target)) ;
addNewAction(bar, new specNormalizeAction(target)) ;
}
addNewAction(bar, new specItemPropertiesAction(target)) ;
addNewAction(bar, new specSetMultilineAction(target)) ;
if(metaView)
{
addNewAction(bar, new specAddConnectionsAction(target)) ;
addNewAction(bar, new specSelectConnectedAction(target)) ;
addNewAction(bar, new specAddFitAction(target)) ;
addNewAction(bar, new specRemoveFitAction(target)) ;
addNewAction(bar, new specToggleFitStyleAction(target));
addNewAction(bar, new specConductFitAction(target)) ;
}
if(logView)
addNewAction(bar, new specDescriptorEditAction(target)) ;
bar->addSeparator() ;
if(dataView || metaView)
addNewAction(bar, new changePlotStyleAction(target)) ;
bar->setWindowTitle(tr("Items toolbar"));
}
if(plot)
{
addParent(plot);
addNewAction(bar, new specTitleAction(target)) ;
addNewAction(bar, new specXLabelAction(target)) ;
addNewAction(bar, new specYLabelAction(target)) ;
bar->addActions(plot->actions());
bar->setWindowTitle(tr("Plot toolbar"));
}
if(plotWidget)
{
delete bar ;
bar = plotWidget->createToolbar() ;
bar-> addSeparator() ;
bar-> addAction(purgeUndoAction) ;
bar-> addSeparator() ;
bar-> addAction(undoAction(this)) ;
bar-> addAction(redoAction(this)) ;
bar->setWindowTitle(tr("Main toolbar"));
}
return bar ;
}
示例4: QWidget
Player::Player(QWidget *parent)
: QWidget(parent)
, m_position(0)
, m_isMeltedPlaying(-1)
, m_zoomToggleFactor(Settings.playerZoom() == 0.0f? 1.0f : Settings.playerZoom())
, m_pauseAfterOpen(false)
, m_monitorScreen(-1)
, m_currentTransport(0)
{
setObjectName("Player");
Mlt::Controller::singleton();
setupActions(this);
m_playIcon = actionPlay->icon();
m_pauseIcon = actionPause->icon();
// Create a layout.
QVBoxLayout *vlayout = new QVBoxLayout(this);
vlayout->setObjectName("playerLayout");
vlayout->setContentsMargins(0, 0, 0, 0);
vlayout->setSpacing(4);
// Add tab bar to indicate/select what is playing: clip, playlist, timeline.
m_tabs = new QTabBar;
m_tabs->setShape(QTabBar::RoundedSouth);
m_tabs->addTab(tr("Source"));
m_tabs->addTab(tr("Program"));
m_tabs->setTabEnabled(ProgramTabIndex, false);
QHBoxLayout* tabLayout = new QHBoxLayout;
tabLayout->addWidget(m_tabs);
tabLayout->addStretch();
connect(m_tabs, SIGNAL(tabBarClicked(int)), SLOT(onTabBarClicked(int)));
// Add the layouts for managing video view, scroll bars, and audio controls.
m_videoLayout = new QHBoxLayout;
m_videoLayout->setSpacing(4);
m_videoLayout->setContentsMargins(0, 0, 0, 0);
vlayout->addLayout(m_videoLayout, 10);
vlayout->addStretch();
m_videoScrollWidget = new QWidget;
m_videoLayout->addWidget(m_videoScrollWidget, 10);
m_videoLayout->addStretch();
QGridLayout* glayout = new QGridLayout(m_videoScrollWidget);
glayout->setSpacing(0);
glayout->setContentsMargins(0, 0, 0, 0);
// Add the video widgets.
m_videoWidget = QWidget::createWindowContainer(qobject_cast<QWindow*>(MLT.videoWidget()));
m_videoWidget->setMinimumSize(QSize(320, 180));
glayout->addWidget(m_videoWidget, 0, 0);
m_verticalScroll = new QScrollBar(Qt::Vertical);
glayout->addWidget(m_verticalScroll, 0, 1);
m_verticalScroll->hide();
m_horizontalScroll = new QScrollBar(Qt::Horizontal);
glayout->addWidget(m_horizontalScroll, 1, 0);
m_horizontalScroll->hide();
// Add the volume and signal level meter
m_volumePopup = new QFrame(this, Qt::Popup);
QVBoxLayout *volumeLayoutV = new QVBoxLayout(m_volumePopup);
volumeLayoutV->setContentsMargins(0, 0, 0, 0);
volumeLayoutV->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
QBoxLayout *volumeLayoutH = new QHBoxLayout;
volumeLayoutH->setSpacing(0);
volumeLayoutH->setContentsMargins(0, 0, 0, 0);
volumeLayoutH->addWidget(new AudioScale);
m_volumeSlider = new QSlider(Qt::Vertical);
m_volumeSlider->setFocusPolicy(Qt::NoFocus);
m_volumeSlider->setMinimumHeight(VOLUME_SLIDER_HEIGHT);
m_volumeSlider->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
volumeLayoutH->addWidget(m_volumeSlider);
volumeLayoutV->addLayout(volumeLayoutH);
m_volumeSlider->setRange(0, 99);
m_volumeSlider->setValue(Settings.playerVolume());
onVolumeChanged(m_volumeSlider->value());
m_savedVolume = MLT.volume();
m_volumeSlider->setToolTip(tr("Adjust the audio volume"));
connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(onVolumeChanged(int)));
// Add mute-volume buttons layout
#ifdef Q_OS_MAC
if (Settings.theme() == "system")
volumeLayoutH = new QVBoxLayout;
else
#endif
volumeLayoutH = new QHBoxLayout;
volumeLayoutH->setContentsMargins(0, 0, 0, 0);
volumeLayoutH->setSpacing(0);
volumeLayoutV->addLayout(volumeLayoutH);
// Add mute button
QPushButton* muteButton = new QPushButton(this);
muteButton->setFocusPolicy(Qt::NoFocus);
muteButton->setObjectName(QString::fromUtf8("muteButton"));
muteButton->setIcon(QIcon::fromTheme("dialog-cancel", QIcon(":/icons/oxygen/16x16/actions/dialog-cancel.png")));
muteButton->setToolTip(tr("Silence the audio"));
muteButton->setCheckable(true);
muteButton->setChecked(Settings.playerMuted());
onMuteButtonToggled(Settings.playerMuted());
volumeLayoutH->addWidget(muteButton);
connect(muteButton, SIGNAL(toggled(bool)), this, SLOT(onMuteButtonToggled(bool)));
//.........这里部分代码省略.........