本文整理汇总了C++中QScrollArea::setPalette方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setPalette方法的具体用法?C++ QScrollArea::setPalette怎么用?C++ QScrollArea::setPalette使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setPalette方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* parent )
: QWidget( parent )
, ui( new Ui::AlbumInfoWidget )
{
QWidget* widget = new QWidget;
ui->setupUi( widget );
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::Original, QSize( 48, 48 ) );
ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::Grid, ui->cover->size() ) );
ui->cover->setShowText( false );
ui->lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
ui->lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );
{
m_tracksModel = new TreeModel( ui->tracks );
m_tracksModel->setMode( Mixed );
AlbumItemDelegate* del = new AlbumItemDelegate( ui->tracks, ui->tracks->proxyModel() );
ui->tracks->setPlaylistItemDelegate( del );
ui->tracks->setEmptyTip( tr( "Sorry, we could not find any tracks for this album!" ) );
ui->tracks->proxyModel()->setStyle( PlayableProxyModel::Large );
ui->tracks->setAutoResize( true );
ui->tracks->setPlayableModel( m_tracksModel );
ui->tracks->setAlternatingRowColors( false );
QPalette p = ui->tracks->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->tracks->setPalette( p );
TomahawkStyle::styleScrollBar( ui->tracks->horizontalScrollBar() );
TomahawkStyle::stylePageFrame( ui->tracks );
TomahawkStyle::stylePageFrame( ui->trackFrame );
}
{
m_albumsModel = new PlayableModel( ui->albums );
ui->albums->setPlayableModel( m_albumsModel );
ui->albums->setEmptyTip( tr( "Sorry, we could not find any other albums for this artist!" ) );
/* ui->albums->setAutoFitItems( true );
* ui->albums->setWrapping( false );
* ui->albums->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
* ui->albums->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );*/
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 );
//.........这里部分代码省略.........
示例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
NetworkActivityWidget::NetworkActivityWidget( QWidget* parent )
: QWidget( parent )
, d_ptr( new NetworkActivityWidgetPrivate ( this ) )
{
Q_D( NetworkActivityWidget );
QWidget* widget = new QWidget();
d->ui->setupUi( widget );
d->crumbModelLeft = new QStandardItemModel( this );
d->sortedProxy = new QSortFilterProxyModel( this );
// d_func()->ui->breadCrumbLeft->setRootIcon( TomahawkUtils::defaultPixmap( TomahawkUtils::NetworkActivity, TomahawkUtils::Original ) );
connect( d->ui->breadCrumbLeft, SIGNAL( activateIndex( QModelIndex ) ), SLOT( leftCrumbIndexChanged( QModelIndex ) ) );
// Build up breadcrumb
QStandardItem* rootItem = d->crumbModelLeft->invisibleRootItem();
// Breadcumps for Charts
{
QStandardItem* chartItem = new QStandardItem( tr( "Charts" ) );
rootItem->appendRow( chartItem );
QStandardItem* overallItem = new QStandardItem( tr( "Overall" ) );
overallItem->setData( OverallChart, Breadcrumb::DefaultRole );
chartItem->appendRow( overallItem );
QStandardItem* yearItem = new QStandardItem( tr( "Last Year" ) );
yearItem->setData( YearChart, Breadcrumb::DefaultRole );
chartItem->appendRow( yearItem );
QStandardItem* monthItem = new QStandardItem( tr( "Last Month" ) );
monthItem->setData( MonthChart, Breadcrumb::DefaultRole );
chartItem->appendRow( monthItem );
QStandardItem* weekItem = new QStandardItem( tr( "Last Week" ) );
weekItem->setData( WeekChart, Breadcrumb::DefaultRole );
chartItem->appendRow( weekItem );
}
// Breadcrumbs for Loved Tracks
{
QStandardItem* lovedItem = new QStandardItem( tr( "Loved Tracks" ) );
rootItem->appendRow( lovedItem );
QStandardItem* topItem = new QStandardItem( tr( "Top Loved" ) );
topItem->setData( TopLoved, Breadcrumb::DefaultRole );
lovedItem->appendRow( topItem );
QStandardItem* recentlyItem = new QStandardItem( tr( "Recently Loved" ) );
recentlyItem->setData( RecentlyLoved, Breadcrumb::DefaultRole );
lovedItem->appendRow( recentlyItem );
}
d->sortedProxy->setSourceModel( d->crumbModelLeft );
d->ui->breadCrumbLeft->setModel( d->sortedProxy );
d->ui->breadCrumbLeft->setVisible( true );
{
TrackItemDelegate* del = new TrackItemDelegate( d->ui->tracksViewLeft, d->ui->tracksViewLeft->proxyModel(), true );
d->ui->tracksViewLeft->setPlaylistItemDelegate( del );
d->ui->tracksViewLeft->proxyModel()->setStyle( PlayableProxyModel::Short );
d->ui->tracksViewLeft->setAutoResize( true );
d->ui->tracksViewLeft->setAlternatingRowColors( false );
d->ui->tracksViewLeft->setSortingEnabled( false );
d->ui->tracksViewLeft->setEmptyTip( tr( "Sorry, we are still loading the charts." ) );
QPalette p = d->ui->tracksViewLeft->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 );
d->ui->tracksViewLeft->setPalette( p );
TomahawkStyle::stylePageFrame( d->ui->tracksViewLeft );
TomahawkStyle::stylePageFrame( d->ui->chartsFrame );
}
// Trending Tracks
{
d->trendingTracksModel = new PlaylistModel( d->ui->trendingTracksView );
d->ui->trendingTracksView->proxyModel()->setStyle( PlayableProxyModel::Short );
d->ui->trendingTracksView->overlay()->setEnabled( true );
d->ui->trendingTracksView->setPlaylistModel( d->trendingTracksModel );
d->ui->trendingTracksView->setAutoResize( true );
d->ui->trendingTracksView->setAlternatingRowColors( false );
d->ui->trendingTracksView->setEmptyTip( tr( "Sorry, we couldn't find any trending tracks." ) );
d->trendingTracksModel->startLoading();
QPalette p = d->ui->trendingTracksView->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 );
d->ui->trendingTracksView->setPalette( p );
TomahawkStyle::stylePageFrame( d->ui->trendingTracksView );
TomahawkStyle::stylePageFrame( d->ui->trendingTracksFrame );
}
{
QFont f = d->ui->trendingTracksLabel->font();
f.setFamily( "Roboto" );
QPalette p = d->ui->trendingTracksLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );
//.........这里部分代码省略.........
示例5: QWidget
DashboardWidget::DashboardWidget( QWidget* parent )
: QWidget( parent )
, ui( new Ui::DashboardWidget )
{
QWidget* widget = new QWidget;
ui->setupUi( widget );
ui->lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );
ui->lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
{
m_tracksModel = new RecentlyPlayedModel( ui->tracksView, HISTORY_TRACK_ITEMS );
ui->tracksView->proxyModel()->setStyle( PlayableProxyModel::Short );
ui->tracksView->overlay()->setEnabled( false );
ui->tracksView->setPlaylistModel( m_tracksModel );
ui->tracksView->setAutoResize( true );
ui->tracksView->setAlternatingRowColors( false );
m_tracksModel->setSource( source_ptr() );
QPalette p = ui->tracksView->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->tracksView->setPalette( p );
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();
//.........这里部分代码省略.........
示例6: palette
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent)
{
//init color palette for variables
VariableColorPalette palette(QColor(50,100,200));
preview = new CubeMapPreview(500);
loader = new CubeMapLoader();
curveEditor = new CurveEditor(this);
curveEditor->setViewScale(0.1,-1);
setEditorRange(100);
curveEditor->setSnap(1,0);
curveEditor->setCurrentFrame(0);
//create and init variables
CurveVariable * pitch = new CurveVariable("Pitch");
CurveVariable * yaw = new CurveVariable("Yaw");
CurveVariable * roll = new CurveVariable("Roll");
CurveVariable * zoom = new CurveVariable("Zoom");
CurveVariable * fov = new CurveVariable("Fov",180);
CurveVariable * frame = new CurveVariable("Cubemap",0);
//add variables to key frames watcher
KeyFrames * keyFrames = KeyFrames::getInstance();
keyFrames->addVariable(pitch);
keyFrames->addVariable(zoom);
keyFrames->addVariable(roll);
keyFrames->addVariable(fov);
keyFrames->addVariable(yaw);
keyFrames->addVariable(frame);
curveEditor->addVariable(pitch);
curveEditor->addVariable(yaw);
curveEditor->addVariable(roll);
curveEditor->addVariable(zoom);
curveEditor->addVariable(fov);
curveEditor->addVariable(frame);
preview->setPitchVar(pitch);
preview->setFovVar(fov);
preview->setYawVar(yaw);
preview->setRollVar(roll);
preview->setZoomVar(zoom);
loader->setFrameVar(frame);
//setup time line
timeLine = new TimeLine(this);
//init IO module
importExport = new IOWidget(loader, timeLine, this);
//let the timeline know that a frame has been keyed/un keyed
connect(pitch,SIGNAL(changed(float,float)), timeLine, SLOT(update()));
connect(yaw,SIGNAL(changed(float,float)), timeLine, SLOT(update()));
connect(roll,SIGNAL(changed(float,float)), timeLine, SLOT(update()));
connect(zoom,SIGNAL(changed(float,float)), timeLine, SLOT(update()));
connect(fov,SIGNAL(changed(float,float)), timeLine, SLOT(update()));
connect(frame,SIGNAL(changed(float,float)), timeLine, SLOT(update()));
//update preview when cube map changes
connect(loader,SIGNAL(faceChanged(QImage *,CubeFace)),preview,SLOT(setFace(QImage *, CubeFace)));
//tells the cube map loader to load the cube map corresponding to the new frame
connect(timeLine,SIGNAL(frameChanged(float)),loader,SLOT(variablesValues(float)));
//tells the preview to display a new frame
connect(timeLine,SIGNAL(frameChanged(float)),preview,SLOT(variablesValues(float)));
//update the frame cursor of the curve editor
connect(timeLine,SIGNAL(frameChanged(float)),curveEditor,SLOT(setCurrentFrame(float)));
//Change the range of frames displayed by the curvor editor when the number of frames changes
connect(timeLine,SIGNAL(frameNumberChanged(int)), this, SLOT(setEditorRange(int)));
//Refresh preview when curves have been edited
connect(curveEditor,SIGNAL(curvesChanged(float, float)),preview,SLOT(refreshVariablesValues(float, float)));
//connect(timeLine,SIGNAL(frameChanged(float)),preview,SLOT(refresh()));
//stop playback if the user interacts with the preview
connect(preview,SIGNAL(previewChanged()),timeLine,SLOT(stop()));
QTabWidget * tabWidget = new QTabWidget(this);
tabWidget->addTab(loader,"Cube&map");
tabWidget->addTab(curveEditor,"Curve &Editor");
tabWidget->addTab(importExport,"E&xport");
QScrollArea * previewScroll = new QScrollArea(this);
previewScroll->setWidget(preview);
previewScroll->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
QPalette pal = previewScroll->palette();
pal.setColor(QPalette::Background,Qt::black);
previewScroll->setPalette(pal);
//.........这里部分代码省略.........
示例7: QWidget
ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* parent )
: QWidget( parent )
, ui( new Ui::ArtistInfoWidget )
, m_artist( artist )
{
QWidget* widget = new QWidget;
ui->setupUi( widget );
artist->loadStats();
connect( artist.data(), SIGNAL( statsLoaded() ), SLOT( onArtistStatsLoaded() ) );
ui->lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
ui->lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );
ui->lineAbove2->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );
ui->lineBelow2->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
QHBoxLayout* l = new QHBoxLayout( ui->statsWidget );
m_playStatsGauge = new StatsGauge( ui->statsWidget );
m_playStatsGauge->setText( tr( "YOUR ARTIST RANK" ) );
m_playStatsGauge->setInvertedAppearance( true );
l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) );
l->addWidget( m_playStatsGauge );
l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) );
ui->statsWidget->setLayout( l );
TomahawkUtils::unmarginLayout( l );
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Original, QSize( 48, 48 ) );
ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Grid, ui->cover->size() ) );
ui->cover->setShowText( false );
{
m_relatedModel = new PlayableModel( ui->relatedArtists );
ui->relatedArtists->setPlayableModel( m_relatedModel );
ui->relatedArtists->proxyModel()->sort( -1 );
ui->relatedArtists->setEmptyTip( tr( "Sorry, we could not find any related artists!" ) );
ui->relatedArtists->setAutoFitItems( true );
/* ui->relatedArtists->setWrapping( false );
ui->relatedArtists->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
ui->relatedArtists->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );*/
ui->relatedArtists->delegate()->setItemSize( QSize( 170, 170 ) );
TomahawkStyle::stylePageFrame( ui->relatedArtists );
TomahawkStyle::stylePageFrame( ui->artistFrame );
TomahawkStyle::styleScrollBar( ui->relatedArtists->verticalScrollBar() );
}
{
ui->albums->setAutoResize( true );
ui->albums->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
/* ui->albums->setWrapping( false );
ui->albums->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );*/
ui->albums->delegate()->setItemSize( QSize( 170, 170 ) );
ui->albums->proxyModel()->setHideDupeItems( true );
m_albumsModel = new PlayableModel( ui->albums );
ui->albums->setPlayableModel( m_albumsModel );
ui->albums->proxyModel()->sort( -1 );
ui->albums->setEmptyTip( tr( "Sorry, we could not find any albums for this artist!" ) );
ui->albums->setStyleSheet( QString( "QListView { background-color: %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
TomahawkStyle::stylePageFrame( ui->albumFrame );
TomahawkStyle::styleScrollBar( ui->albums->verticalScrollBar() );
}
{
m_topHitsModel = new PlaylistModel( ui->topHits );
AlbumItemDelegate* del = new AlbumItemDelegate( ui->topHits, ui->topHits->proxyModel() );
ui->topHits->setPlaylistItemDelegate( del );
ui->topHits->proxyModel()->setStyle( PlayableProxyModel::Short );
ui->topHits->setPlayableModel( m_topHitsModel );
ui->topHits->setSortingEnabled( false );
ui->topHits->setEmptyTip( tr( "Sorry, we could not find any top hits for this artist!" ) );
ui->topHits->setAutoResize( true );
ui->topHits->setAlternatingRowColors( false );
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 );
//.........这里部分代码省略.........
示例8: numTableIm
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
//ui->setupUi(this);
setFixedHeight(768); //1024
setFixedWidth(768);
//Define page structure
QWidget * page = new QWidget(this);
page->setFixedWidth(this->width());
page->setFixedHeight(this->height());
page->setStyleSheet("background-color:white;");
QVBoxLayout * pageLayout = new QVBoxLayout();
//Define the fixed header
QWidget * header = new QWidget(page);
header->setFixedWidth(page->width());
QGridLayout * headerLayout = new QGridLayout();
headerLayout->setHorizontalSpacing(2);
headerLayout->setVerticalSpacing(2);
QLabel * numTable = new QLabel();
QPixmap numTableIm(":/Images/images/NumTable.png");
// numTable->setStyleSheet("margin-right: 5px");
numTable->setPixmap(numTableIm);
numTable->setFixedSize(numTableIm.rect().size());
QLabel * banner = new QLabel(header);
QPixmap bannerIm(":/Images/images/Banner.png");
banner->setPixmap(bannerIm);
banner->setFixedSize(bannerIm.rect().size());
QPushButton * pain = new QPushButton("");
QPixmap painIm(":/Images/images/Pain.png");
QIcon painIcon(painIm);
pain->setIcon(painIcon);
pain->setIconSize(painIm.rect().size());
pain->setFixedSize(painIm.rect().size());
QPushButton * eau = new QPushButton("");
QPixmap eauIm(":/Images/images/eau.png");
QIcon eauIcon(eauIm);
eau->setIcon(eauIcon);
eau->setIconSize(eauIm.rect().size());
eau->setFixedSize(eauIm.rect().size());
QPushButton * serveur = new QPushButton("");
QPixmap serveurIm(":/Images/images/Serveur.png");
QIcon serveurIcon(serveurIm);
serveur->setIcon(serveurIcon);
serveur->setIconSize(serveurIm.rect().size());
serveur->setFixedSize(serveurIm.rect().size());
headerLayout->addWidget(numTable, 0, 0, 2, 0);
headerLayout->addWidget(banner, 0, 1, 2, 1);
headerLayout->addWidget(serveur,0, 2, 2, 2);
headerLayout->addWidget(pain, 0, 3);
headerLayout->addWidget(eau, 1, 3);
header->setLayout(headerLayout);
//Define the widget containing all the meals (Tabs)
QTabWidget * repasFrame = new QTabWidget(page);
//For one Meal, define the widget containing all the bands
QWidget * area = new QWidget(repasFrame);
QScrollArea * sArea = new QScrollArea(area);
QPalette * palette = new QPalette();
palette->setColor(QPalette::Background, Qt::white);
sArea->setPalette(*palette);
sArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
sArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
sArea->setFixedWidth(page->width() -20);
sArea->setFixedHeight(page->height() - header->height() - 125);
bands = new QWidget();
bands->setFixedWidth(page->width() -25);
// bands->setMinimumHeight(page->height() - header->height() - 125);
bands->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
bandsLayout = new QVBoxLayout(bands);
Headband* menus = HeadbandFactory::buildMenus(bands);
bandList.append(menus);
bandsLayout->addWidget(menus);
usefulLabel = new QLabel();
bandsLayout->addWidget(usefulLabel);
bands->setLayout(bandsLayout);
sArea->setWidget(bands);
repasFrame->setFixedWidth(page->width());
repasFrame->setFixedHeight(page->height() - header->height());
repasFrame->addTab(area, "Repas 1");
repasFrame->addTab(new QLabel(), "+");
//Define the confirmation button
//.........这里部分代码省略.........