本文整理汇总了C++中KHBox::setMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ KHBox::setMargin方法的具体用法?C++ KHBox::setMargin怎么用?C++ KHBox::setMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KHBox
的用法示例。
在下文中一共展示了KHBox::setMargin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
FontColourChooser::FontColourChooser(QWidget *parent,
const QStringList &fontList, const QString& frameLabel, bool fg, bool defaultFont, int visibleListSize)
: QWidget(parent),
mFgColourButton(0),
mReadOnly(false)
{
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
topLayout->setSpacing(KDialog::spacingHint());
QWidget* page = this;
if (!frameLabel.isNull())
{
page = new QGroupBox(frameLabel, this);
topLayout->addWidget(page);
topLayout = new QVBoxLayout(page);
topLayout->setMargin(KDialog::marginHint());
topLayout->setSpacing(KDialog::spacingHint());
}
QHBoxLayout* hlayout = new QHBoxLayout();
hlayout->setMargin(0);
topLayout->addLayout(hlayout);
QVBoxLayout* colourLayout = new QVBoxLayout();
colourLayout->setMargin(0);
hlayout->addLayout(colourLayout);
if (fg)
{
KHBox* box = new KHBox(page); // to group widgets for QWhatsThis text
box->setMargin(0);
box->setSpacing(KDialog::spacingHint()/2);
colourLayout->addWidget(box);
QLabel* label = new QLabel(i18nc("@label:listbox", "Foreground color:"), box);
box->setStretchFactor(new QWidget(box), 0);
mFgColourButton = new ColourButton(box);
connect(mFgColourButton, SIGNAL(changed(const QColor&)), SLOT(setSampleColour()));
label->setBuddy(mFgColourButton);
box->setWhatsThis(i18nc("@info:whatsthis", "Select the alarm message foreground color"));
}
KHBox* box = new KHBox(page); // to group widgets for QWhatsThis text
box->setMargin(0);
box->setSpacing(KDialog::spacingHint()/2);
colourLayout->addWidget(box);
QLabel* label = new QLabel(i18nc("@label:listbox", "Background color:"), box);
box->setStretchFactor(new QWidget(box), 0);
mBgColourButton = new ColourButton(box);
connect(mBgColourButton, SIGNAL(changed(const QColor&)), SLOT(setSampleColour()));
label->setBuddy(mBgColourButton);
box->setWhatsThis(i18nc("@info:whatsthis", "Select the alarm message background color"));
hlayout->addStretch();
if (defaultFont)
{
QHBoxLayout* layout = new QHBoxLayout();
layout->setMargin(0);
topLayout->addLayout(layout);
mDefaultFont = new CheckBox(i18nc("@option:check", "Use default font"), page);
mDefaultFont->setMinimumSize(mDefaultFont->sizeHint());
connect(mDefaultFont, SIGNAL(toggled(bool)), SLOT(slotDefaultFontToggled(bool)));
mDefaultFont->setWhatsThis(i18nc("@info:whatsthis", "Check to use the default font current at the time the alarm is displayed."));
layout->addWidget(mDefaultFont);
layout->addWidget(new QWidget(page)); // left adjust the widget
}
else
mDefaultFont = 0;
mFontChooser = new KFontChooser(page, KFontChooser::DisplayFrame, fontList, visibleListSize);
mFontChooser->installEventFilter(this); // for read-only mode
QList<QWidget*> kids = mFontChooser->findChildren<QWidget*>();
for (int i = 0, end = kids.count(); i < end; ++i)
kids[i]->installEventFilter(this);
topLayout->addWidget(mFontChooser);
slotDefaultFontToggled(false);
}
示例3: KVBox
Playlist::Widget::Widget( QWidget* parent )
: KVBox( parent )
{
setContentsMargins( 1, 1, 1, 1 );
m_searchWidget = new ProgressiveSearchWidget( this );
//this is really only useful for debugging at the moment, so dont show it to users and testers
/*m_sortBox = new QComboBox( this );
m_sortBox->insertItem( 0, "Album", Album);
m_sortBox->insertItem( 1, "AlbumArtist", Album);
m_sortBox->insertItem( 2, "Artist", Artist );
m_sortBox->insertItem( 3, "Bitrate", Bitrate );
m_sortBox->insertItem( 4, "Bpm", Bpm );
m_sortBox->insertItem( 5, "Comment", Comment );
m_sortBox->insertItem( 6, "Composer", Composer );
m_sortBox->insertItem( 7, "Directory", Directory );
m_sortBox->insertItem( 8, "DiscNumber", DiscNumber );
m_sortBox->insertItem( 9, "Filename", Filename );
m_sortBox->insertItem( 10, "Filesize", Filesize );
m_sortBox->insertItem( 11, "Genre", Genre );
m_sortBox->insertItem( 12, "LastPlayed", LastPlayed );
m_sortBox->insertItem( 13, "Length", Length );
m_sortBox->insertItem( 14, "Mood", Mood );
m_sortBox->insertItem( 15, "PlayCount", PlayCount );
m_sortBox->insertItem( 16, "Rating", Rating );
m_sortBox->insertItem( 17, "SampleRate", SampleRate );
m_sortBox->insertItem( 18, "Score", Score );
m_sortBox->insertItem( 29, "Source", Source );
m_sortBox->insertItem( 30, "Title", Title );
m_sortBox->insertItem( 31, "TrackNumber", TrackNumber );
m_sortBox->insertItem( 32, "Type", Type );
m_sortBox->insertItem( 33, "Year", Year );
connect( m_sortBox, SIGNAL( activated( int ) ), this, SLOT( sort( int ) ) );*/
QWidget * layoutHolder = new QWidget( this );
QVBoxLayout* mainPlaylistlayout = new QVBoxLayout( layoutHolder );
mainPlaylistlayout->setContentsMargins( 0, 0, 0, 0 );
m_playlistView = new PrettyListView( this );
m_playlistView->show();
connect( m_searchWidget, SIGNAL( filterChanged( const QString &, int, bool ) ), m_playlistView, SLOT( find( const QString &, int, bool ) ) );
connect( m_searchWidget, SIGNAL( next( const QString &, int ) ), m_playlistView, SLOT( findNext( const QString &, int ) ) );
connect( m_searchWidget, SIGNAL( previous( const QString &, int ) ), m_playlistView, SLOT( findPrevious( const QString &, int ) ) );
connect( m_searchWidget, SIGNAL( filterCleared() ), m_playlistView, SLOT( clearSearchTerm() ) );
connect( m_searchWidget, SIGNAL( showOnlyMatches( bool ) ), m_playlistView, SLOT( showOnlyMatches( bool ) ) );
connect( m_searchWidget, SIGNAL( activateFilterResult() ), m_playlistView, SLOT( playFirstSelected() ) );
connect( m_searchWidget, SIGNAL( downPressed() ), m_playlistView, SLOT( setFocus() ) );
connect( m_playlistView, SIGNAL( found() ), m_searchWidget, SLOT( match() ) );
connect( m_playlistView, SIGNAL( notFound() ), m_searchWidget, SLOT( noMatch() ) );
connect( LayoutManager::instance(), SIGNAL( activeLayoutChanged() ), m_playlistView, SLOT( reset() ) );
mainPlaylistlayout->setSpacing( 0 );
mainPlaylistlayout->addWidget( m_playlistView );
KHBox *barBox = new KHBox( this );
barBox->setMargin( 0 );
KToolBar *plBar = new Amarok::ToolBar( barBox );
plBar->setObjectName( "PlaylistToolBar" );
Model::instance();
// the Controller ctor creates the undo/redo actions that we use below, so we want
// to make sure that it's been constructed and the the actions registered
Controller::instance();
{
//START Playlist toolbar
plBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
plBar->setIconDimensions( 22 );
plBar->setMovable( false );
plBar->addAction( new KToolBarSpacerAction( this ) );
plBar->addAction( Amarok::actionCollection()->action( "playlist_clear" ) );
//FIXME this action should go in ActionController, but we don't have any visibility to the view
KAction *action = new KAction( KIcon( "music-amarok" ), i18n("Show active track"), this );
connect( action, SIGNAL( triggered( bool ) ), m_playlistView, SLOT( scrollToActiveTrack() ) );
plBar->addAction( action );
plBar->addSeparator();
plBar->addAction( Amarok::actionCollection()->action( "playlist_undo" ) );
plBar->addAction( Amarok::actionCollection()->action( "playlist_redo" ) );
plBar->addSeparator();
plBar->addAction( Amarok::actionCollection()->action( "playlist_save" ) );
plBar->addAction( Amarok::actionCollection()->action( "playlist_export" ) );
plBar->addSeparator();
Playlist::LayoutConfigAction *layoutConfigAction = new Playlist::LayoutConfigAction( this );
plBar->addAction( layoutConfigAction );
QToolButton *tbutton = qobject_cast<QToolButton*>(plBar->widgetForAction( layoutConfigAction ) );
if( tbutton )
tbutton->setPopupMode( QToolButton::InstantPopup );
//.........这里部分代码省略.........