本文整理汇总了C++中QScrollArea::setAutoFillBackground方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setAutoFillBackground方法的具体用法?C++ QScrollArea::setAutoFillBackground怎么用?C++ QScrollArea::setAutoFillBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setAutoFillBackground方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* parent )
: QWidget( parent )
, ui( new Ui::TrackInfoWidget )
{
QWidget* widget = new QWidget;
m_headerWidget = new BasicHeader;
ui->setupUi( widget );
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultTrackImage, TomahawkUtils::Original, QSize( 48, 48 ) );
m_relatedTracksModel = new PlayableModel( ui->trackView );
ui->trackView->trackView()->setPlayableModel( m_relatedTracksModel );
ui->trackView->setCaption( tr( "Similar Tracks" ) );
ui->trackView->setEmptyTip( tr( "Sorry, but we could not find similar tracks for this song!" ) );
ui->topHits->setStyleSheet( QString( "QListView { background-color: #f9f9f9; }" ) );
TomahawkStyle::stylePageFrame( ui->trackFrame );
ui->topHits->setVisible( false );
ui->topHitsLabel->setVisible( false );
{
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
area->setWidget( widget );
QPalette pal = palette();
pal.setBrush( backgroundRole(), Qt::white );
area->setPalette( pal );
area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( m_headerWidget );
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
}
load( query );
}
示例2: QWidget
//.........这里部分代码省略.........
ui->albums->delegate()->setItemSize( QSize( 170, 170 ) );
ui->albums->proxyModel()->setHideDupeItems( true );
TomahawkStyle::styleScrollBar( ui->albums->verticalScrollBar() );
TomahawkStyle::stylePageFrame( ui->albums );
TomahawkStyle::stylePageFrame( ui->albumFrame );
}
{
QFont f = ui->biography->font();
f.setFamily( "Titillium Web" );
QPalette p = ui->biography->palette();
p.setColor( QPalette::Text, TomahawkStyle::HEADER_TEXT );
ui->biography->setFont( f );
ui->biography->setPalette( p );
ui->biography->setOpenLinks( false );
ui->biography->setOpenExternalLinks( true );
ui->biography->document()->setDefaultStyleSheet( QString( "a { text-decoration: none; font-weight: bold; color: %1; }" ).arg( TomahawkStyle::HEADER_LINK.name() ) );
TomahawkStyle::stylePageFrame( ui->biography );
TomahawkStyle::styleScrollBar( ui->biography->verticalScrollBar() );
// connect( ui->biography, SIGNAL( anchorClicked( QUrl ) ), SLOT( onBiographyLinkClicked( QUrl ) ) );
}
{
QFont f = ui->albumLabel->font();
f.setFamily( "Titillium Web" );
QPalette p = ui->albumLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_LABEL );
ui->albumLabel->setFont( f );
ui->albumLabel->setPalette( p );
}
{
ui->artistLabel->setContentsMargins( 6, 2, 6, 2 );
ui->artistLabel->setElideMode( Qt::ElideMiddle );
ui->artistLabel->setType( QueryLabel::Artist );
connect( ui->artistLabel, SIGNAL( clickedArtist() ), SLOT( onArtistClicked() ) );
QFont f = ui->artistLabel->font();
f.setFamily( "Titillium Web" );
QPalette p = ui->artistLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
ui->artistLabel->setFont( f );
ui->artistLabel->setPalette( p );
}
{
QFont f = ui->label->font();
f.setFamily( "Pathway Gothic One" );
QPalette p = ui->label->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );
ui->label->setFont( f );
ui->label_2->setFont( f );
ui->label->setPalette( p );
ui->label_2->setPalette( p );
}
{
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );
area->setPalette( pal );
area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
}
{
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
ui->widget->setPalette( pal );
ui->widget->setAutoFillBackground( true );
}
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
mpl->addChildInterface( ui->tracks->playlistInterface() );
mpl->addChildInterface( ui->albums->playlistInterface() );
m_playlistInterface = playlistinterface_ptr( mpl );
load( album );
}
示例3: fm
Dashboard::Dashboard( QWidget* parent )
: QWidget( parent )
, ui( new Ui::Dashboard )
, m_header( new BasicHeader( this ) )
{
QWidget* widget = new QWidget;
ui->setupUi( widget );
m_header->setPixmap( ImageRegistry::instance()->pixmap( RESPATH "images/dashboard.svg", QSize( 0, 0 ) ) );
m_header->setCaption( tr( "Dashboard" ) );
m_header->setDescription( tr( "An overview of your recent activity" ) );
RecentPlaylistsModel* model = new RecentPlaylistsModel( HISTORY_PLAYLIST_ITEMS, this );
QPalette trackViewPal = ui->tracksView->palette();
trackViewPal.setColor( QPalette::Foreground, TomahawkStyle::PAGE_FOREGROUND );
trackViewPal.setColor( QPalette::Text, TomahawkStyle::PAGE_FOREGROUND );
trackViewPal.setColor( QPalette::Highlight, QColor( "#252020" ) );
trackViewPal.setColor( QPalette::HighlightedText, Qt::white );
ui->playlistWidget->setFrameShape( QFrame::NoFrame );
ui->playlistWidget->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->playlistWidget->setItemDelegate( new PlaylistDelegate() );
ui->playlistWidget->setModel( model );
ui->playlistWidget->overlay()->resize( 380, 86 );
ui->playlistWidget->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
ui->playlistWidget->setPalette( trackViewPal );
ui->playlistWidget->setMinimumHeight( 400 );
updatePlaylists();
m_tracksModel = new RecentlyPlayedModel( ui->tracksView, HISTORY_TRACK_ITEMS );
ui->tracksView->proxyModel()->setStyle( PlayableProxyModel::ShortWithAvatars );
ui->tracksView->overlay()->setEnabled( false );
ui->tracksView->setPlaylistModel( m_tracksModel );
ui->tracksView->setAutoResize( true );
m_tracksModel->setSource( source_ptr() );
ui->tracksView->setPalette( trackViewPal );
ui->tracksView->setAlternatingRowColors( false );
ui->tracksView->setFrameShape( QFrame::NoFrame );
ui->tracksView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
m_recentAlbumsModel = new AlbumModel( ui->additionsView );
ui->additionsView->setPlayableModel( m_recentAlbumsModel );
ui->additionsView->proxyModel()->sort( -1 );
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
QPalette pal = palette();
// background: qradialgradient(cx: 0.5, cy: -1.8, fx: 0.5, fy: 0, radius: 2, stop: 0 %1, stop: 1 %2);
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
area->setPalette( pal );
area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( m_header );
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
TomahawkStyle::styleScrollBar( ui->playlistWidget->verticalScrollBar() );
TomahawkStyle::styleScrollBar( ui->additionsView->verticalScrollBar() );
QFont f;
f.setBold( true );
QFontMetrics fm( f );
ui->tracksView->setMinimumWidth( fm.width( tr( "Recently played tracks" ) ) * 2 );
QPalette p = ui->label->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_FOREGROUND );
p.setColor( QPalette::Text, TomahawkStyle::PAGE_TEXT );
ui->label->setPalette( p );
ui->label_2->setPalette( p );
ui->label_3->setPalette( p );
ui->playlistWidget->setStyleSheet( "QListView { background-color: transparent; }" );
TomahawkStyle::stylePageFrame( ui->playlistFrame );
ui->additionsView->setStyleSheet( "QListView { background-color: transparent; }" );
TomahawkStyle::stylePageFrame( ui->additionsFrame );
ui->tracksView->setStyleSheet( "QTreeView { background-color: transparent; }" );
TomahawkStyle::stylePageFrame( ui->trackFrame );
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
mpl->addChildInterface( ui->tracksView->playlistInterface() );
mpl->addChildInterface( ui->additionsView->playlistInterface() );
m_playlistInterface = playlistinterface_ptr( mpl );
connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) );
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
connect( ui->playlistWidget, SIGNAL( activated( QModelIndex ) ), SLOT( onPlaylistActivated( QModelIndex ) ) );
connect( model, SIGNAL( emptinessChanged( bool ) ), this, SLOT( updatePlaylists() ) );
}
示例4: QWidget
//.........这里部分代码省略.........
f.setFamily( "Roboto" );
QPalette p = d->ui->hotPlaylistsLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );
d->ui->hotPlaylistsLabel->setFont( f );
d->ui->hotPlaylistsLabel->setPalette( p );
}
{
d->ui->playlistView->setItemDelegate( new PlaylistDelegate() );
d->ui->playlistView->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
QPalette p = d->ui->playlistView->palette();
p.setColor( QPalette::Text, TomahawkStyle::PAGE_FOREGROUND );
p.setColor( QPalette::BrightText, TomahawkStyle::PAGE_FOREGROUND );
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_FOREGROUND );
p.setColor( QPalette::Highlight, TomahawkStyle::PAGE_FOREGROUND );
p.setColor( QPalette::HighlightedText, TomahawkStyle::PAGE_BACKGROUND );
d->ui->playlistView->setPalette( p );
d->ui->playlistView->overlay()->setPalette( p );
TomahawkStyle::styleScrollBar( d->ui->playlistView->verticalScrollBar() );
TomahawkStyle::stylePageFrame( d->ui->playlistView );
TomahawkStyle::stylePageFrame( d->ui->playlistsFrame );
connect( d->ui->playlistView, SIGNAL( activated( QModelIndex ) ), SLOT( onPlaylistActivated( QModelIndex ) ) );
}
// Trending artists
{
d->artistsModel = new PlayableModel( d->ui->trendingArtistsView );
d->ui->trendingArtistsView->setPlayableModel( d->artistsModel );
d->artistsModel->startLoading();
}
{
d->ui->trendingArtistsView->proxyModel()->sort( -1 );
d->ui->trendingArtistsView->proxyModel()->setHideDupeItems( true );
d->ui->trendingArtistsView->setAutoResize( true );
d->ui->trendingArtistsView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
TomahawkStyle::stylePageFrame( d->ui->trendingArtistsView );
TomahawkStyle::stylePageFrame( d->ui->trendingArtistsFrame );
}
{
QFont f = d->ui->trendingArtistsLabel->font();
f.setFamily( "Roboto" );
QPalette p = d->ui->trendingArtistsLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );
d->ui->trendingArtistsLabel->setFont( f );
d->ui->trendingArtistsLabel->setPalette( p );
}
{
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
area->setPalette( pal );
area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
}
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
mpl->addChildInterface( d->ui->trendingTracksView->playlistInterface() );
mpl->addChildInterface( d->ui->tracksViewLeft->playlistInterface() );
d->playlistInterface = playlistinterface_ptr( mpl );
// Load data in separate thread
d->workerThread = new QThread();
d->workerThread->start();
d->worker = new NetworkActivityWorker();
d->worker->moveToThread( d->workerThread );
connect( d->worker, SIGNAL( trendingTracks( QList<Tomahawk::track_ptr> ) ),
SLOT( trendingTracks( QList<Tomahawk::track_ptr> ) ),
Qt::QueuedConnection );
connect( d->worker, SIGNAL( hotPlaylists(QList<Tomahawk::playlist_ptr>) ),
SLOT(hotPlaylists(QList<Tomahawk::playlist_ptr>)),
Qt::QueuedConnection );
connect( d->worker, SIGNAL( trendingArtists( QList< Tomahawk::artist_ptr > ) ),
SLOT( trendingArtists( QList< Tomahawk::artist_ptr > ) ),
Qt::QueuedConnection );
connect( d->worker, SIGNAL( finished() ),
d->workerThread, SLOT( quit() ),
Qt::QueuedConnection );
// connect( d->workerThread, SIGNAL( finished() ), d->workerThread, SLOT( deleteLater() ), Qt::QueuedConnection );
// connect( d->workerThread, SIGNAL( destroyed() ), d->worker, SLOT( deleteLater() ), Qt::QueuedConnection );
QMetaObject::invokeMethod( d->worker, "run", Qt::QueuedConnection );
}
示例5: QWidget
//.........这里部分代码省略.........
TomahawkStyle::stylePageFrame( ui->tracksView );
TomahawkStyle::stylePageFrame( ui->trackFrame );
}
{
RecentPlaylistsModel* model = new RecentPlaylistsModel( HISTORY_PLAYLIST_ITEMS, this );
ui->playlistWidget->setFrameShape( QFrame::NoFrame );
ui->playlistWidget->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->playlistWidget->setItemDelegate( new PlaylistDelegate() );
ui->playlistWidget->setModel( model );
ui->playlistWidget->overlay()->resize( 380, 86 );
ui->playlistWidget->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
QPalette p = ui->playlistWidget->palette();
p.setColor( QPalette::Text, TomahawkStyle::HEADER_TEXT );
p.setColor( QPalette::BrightText, TomahawkStyle::HEADER_TEXT );
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
p.setColor( QPalette::Highlight, TomahawkStyle::HEADER_TEXT );
p.setColor( QPalette::HighlightedText, TomahawkStyle::HEADER_BACKGROUND );
ui->playlistWidget->setPalette( p );
ui->playlistWidget->setMinimumHeight( 400 );
TomahawkStyle::styleScrollBar( ui->playlistWidget->verticalScrollBar() );
TomahawkStyle::stylePageFrame( ui->playlistWidget );
TomahawkStyle::stylePageFrame( ui->playlistFrame );
updatePlaylists();
connect( ui->playlistWidget, SIGNAL( activated( QModelIndex ) ), SLOT( onPlaylistActivated( QModelIndex ) ) );
connect( model, SIGNAL( emptinessChanged( bool ) ), this, SLOT( updatePlaylists() ) );
}
{
m_recentAlbumsModel = new AlbumModel( ui->additionsView );
ui->additionsView->setPlayableModel( m_recentAlbumsModel );
ui->additionsView->proxyModel()->sort( -1 );
TomahawkStyle::styleScrollBar( ui->additionsView->verticalScrollBar() );
TomahawkStyle::stylePageFrame( ui->additionsView );
TomahawkStyle::stylePageFrame( ui->additionsFrame );
}
{
QFont f = ui->label->font();
f.setFamily( "Pathway Gothic One" );
QPalette p = ui->label->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );
ui->label->setFont( f );
ui->label_2->setFont( f );
ui->label->setPalette( p );
ui->label_2->setPalette( p );
}
{
QFont f = ui->playlistLabel->font();
f.setFamily( "Pathway Gothic One" );
QPalette p = ui->playlistLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
ui->playlistLabel->setFont( f );
ui->playlistLabel->setPalette( p );
}
{
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );
area->setPalette( pal );
area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
}
{
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
ui->widget->setPalette( pal );
ui->widget->setAutoFillBackground( true );
}
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
mpl->addChildInterface( ui->tracksView->playlistInterface() );
mpl->addChildInterface( ui->additionsView->playlistInterface() );
m_playlistInterface = playlistinterface_ptr( mpl );
connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) );
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
}
示例6: QWidget
//.........这里部分代码省略.........
QPalette p = ui->topHits->palette();
p.setColor( QPalette::Text, TomahawkStyle::PAGE_TRACKLIST_TRACK_SOLVED );
p.setColor( QPalette::BrightText, TomahawkStyle::PAGE_TRACKLIST_TRACK_UNRESOLVED );
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_TRACKLIST_NUMBER );
p.setColor( QPalette::Highlight, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT );
p.setColor( QPalette::HighlightedText, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT_TEXT );
ui->topHits->setPalette( p );
TomahawkStyle::stylePageFrame( ui->topHits );
TomahawkStyle::stylePageFrame( ui->trackFrame );
}
{
QFont f = ui->biography->font();
f.setFamily( "Titillium Web" );
QPalette p = ui->biography->palette();
p.setColor( QPalette::Text, TomahawkStyle::HEADER_TEXT );
ui->biography->setFont( f );
ui->biography->setPalette( p );
ui->biography->setOpenLinks( false );
ui->biography->setOpenExternalLinks( true );
ui->biography->document()->setDefaultStyleSheet( QString( "a { text-decoration: none; font-weight: bold; color: %1; }" ).arg( TomahawkStyle::HEADER_LINK.name() ) );
TomahawkStyle::stylePageFrame( ui->biography );
TomahawkStyle::styleScrollBar( ui->biography->verticalScrollBar() );
connect( ui->biography, SIGNAL( anchorClicked( QUrl ) ), SLOT( onBiographyLinkClicked( QUrl ) ) );
}
{
QFont f = ui->artistLabel->font();
f.setFamily( "Titillium Web" );
QPalette p = ui->artistLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_LABEL );
ui->artistLabel->setFont( f );
ui->artistLabel->setPalette( p );
}
{
QFont f = ui->label->font();
f.setFamily( "Pathway Gothic One" );
QPalette p = ui->label->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );
ui->label->setFont( f );
ui->label_2->setFont( f );
ui->label->setPalette( p );
ui->label_2->setPalette( p );
}
{
QFont f = ui->albumLabel->font();
f.setFamily( "Pathway Gothic One" );
QPalette p = ui->albumLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
ui->albumLabel->setFont( f );
ui->albumLabel->setPalette( p );
}
{
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );
area->setPalette( pal );
area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
}
{
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
ui->widget->setPalette( pal );
ui->widget->setAutoFillBackground( true );
}
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
mpl->addChildInterface( ui->relatedArtists->playlistInterface() );
mpl->addChildInterface( ui->topHits->playlistInterface() );
mpl->addChildInterface( ui->albums->playlistInterface() );
m_plInterface = playlistinterface_ptr( mpl );
load( artist );
}