本文整理汇总了C++中QScrollArea::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setAttribute方法的具体用法?C++ QScrollArea::setAttribute怎么用?C++ QScrollArea::setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setAttribute方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activated
void FileBrowser::activated(const QModelIndex &index)
{
QFileInfo fileInfo = fileSystemModel->fileInfo(index);
if (fileInfo.isDir() && fileInfo.fileName() != QLatin1String(".")) {
if (fileInfo.fileName() == QLatin1String("..")) {
QModelIndex parent = view->rootIndex().parent();
fileInfo = fileSystemModel->fileInfo(parent);
if (fileInfo.absoluteFilePath() == rootPath)
fileSystemModel->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs);
view->setRootIndex(parent);
} else {
fileSystemModel->setFilter(QDir::AllEntries | QDir::AllDirs);
view->setRootIndex(index);
}
setWindowTitle(fileInfo.fileName());
} else {
if (fileInfo.fileName() == QLatin1String("."))
fileInfo = fileSystemModel->fileInfo(view->rootIndex());
#if defined(Q_WS_MAEMO_5)
DocumentPropertiesWidget *widget = new DocumentPropertiesWidget(fileInfo, gallery, this);
widget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
QScrollArea *window = new QScrollArea(this);
window->setWindowFlags(window->windowFlags() | Qt::Window);
window->setAttribute(Qt::WA_DeleteOnClose);
window->setAttribute(Qt::WA_Maemo5StackedWindow);
window->setWidgetResizable(true);
window->setWidget(widget);
window->show();
#elif defined (Q_OS_SYMBIAN)
QScrollArea *window = new QScrollArea(this);
DocumentPropertiesWidget *widget = new DocumentPropertiesWidget(fileInfo, gallery, window);
widget->setWindowModality(Qt::WindowModal);
window->setWindowFlags(window->windowFlags() | Qt::Dialog);
window->setAttribute(Qt::WA_DeleteOnClose);
window->setWidgetResizable(true);
window->setWidget(widget);
window->showMaximized();
#else
DocumentPropertiesWidget *widget = new DocumentPropertiesWidget(fileInfo, gallery, this);
widget->setWindowFlags(widget->windowFlags() | Qt::Dialog);
widget->setAttribute(Qt::WA_DeleteOnClose);
widget->setWindowModality(Qt::WindowModal);
# if defined(Q_OS_SYMBIAN)
widget->showMaximized();
# else
widget->show();
# endif
#endif
}
}
示例2: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QScrollArea scrollView;
QWidget * staticWidget = new StaticWidget();
staticWidget->resize(400, 200);
scrollView.setWidget(staticWidget);
scrollView.setAttribute(Qt::WA_StaticContents);
scrollView.resize(600, 400);
scrollView.show();
return app.exec();
}
示例3: 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 );
}
示例4: initializeNewTab
void MainWindow::initializeNewTab(const bool &isOpen, const QString &filePath)
{
ImageArea *imageArea;
QString fileName(tr("Untitled Image"));
if(isOpen && filePath.isEmpty())
{
imageArea = new ImageArea(isOpen, "", this);
fileName = imageArea->getFileName();
}
else if(isOpen && !filePath.isEmpty())
{
imageArea = new ImageArea(isOpen, filePath, this);
fileName = imageArea->getFileName();
}
else
{
imageArea = new ImageArea(false, "", this);
}
if (!imageArea->getFileName().isNull())
{
QScrollArea *scrollArea = new QScrollArea();
scrollArea->setAttribute(Qt::WA_DeleteOnClose);
scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(imageArea);
mTabWidget->addTab(scrollArea, fileName);
mTabWidget->setCurrentIndex(mTabWidget->count()-1);
mUndoStackGroup->addStack(imageArea->getUndoStack());
connect(imageArea, SIGNAL(sendPrimaryColorView()), mToolbar, SLOT(setPrimaryColorView()));
connect(imageArea, SIGNAL(sendSecondaryColorView()), mToolbar, SLOT(setSecondaryColorView()));
connect(imageArea, SIGNAL(sendRestorePreviousInstrument()), this, SLOT(restorePreviousInstrument()));
connect(imageArea, SIGNAL(sendSetInstrument(InstrumentsEnum)), this, SLOT(setInstrument(InstrumentsEnum)));
connect(imageArea, SIGNAL(sendNewImageSize(QSize)), this, SLOT(setNewSizeToSizeLabel(QSize)));
connect(imageArea, SIGNAL(sendCursorPos(QPoint)), this, SLOT(setNewPosToPosLabel(QPoint)));
connect(imageArea, SIGNAL(sendColor(QColor)), this, SLOT(setCurrentPipetteColor(QColor)));
connect(imageArea, SIGNAL(sendEnableCopyCutActions(bool)), this, SLOT(enableCopyCutActions(bool)));
connect(imageArea, SIGNAL(sendEnableSelectionInstrument(bool)), this, SLOT(instumentsAct(bool)));
setWindowTitle(QString("%1 - EasyPaint").arg(fileName));
}
示例5: ShowFullsize
void PrettyImage::ShowFullsize() {
// Work out how large to make the window, based on the size of the screen
QRect desktop_rect(QApplication::desktop()->availableGeometry(this));
QSize window_size(qMin(desktop_rect.width() - 20, image_.width()),
qMin(desktop_rect.height() - 20, image_.height()));
// Create the window
QScrollArea* window = new QScrollArea;
window->setAttribute(Qt::WA_DeleteOnClose, true);
window->setWindowTitle(tr("Clementine image viewer"));
window->resize(window_size);
// Create the label that displays the image
QLabel* label = new QLabel(window);
label->setPixmap(QPixmap::fromImage(image_));
// Show the label in the window
window->setWidget(label);
window->setFrameShape(QFrame::NoFrame);
window->show();
}
示例6: 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 );
QPalette pal = palette();
pal.setColor( QPalette::Window, QColor( "#393840" ) );
widget->setPalette( pal );
widget->setAutoFillBackground( true );
/* TomahawkUtils::unmarginLayout( ui->layoutWidget->layout() );
TomahawkUtils::unmarginLayout( ui->layoutWidget1->layout() );
TomahawkUtils::unmarginLayout( ui->layoutWidget2->layout() );
TomahawkUtils::unmarginLayout( ui->albumHeader->layout() );*/
m_albumsModel = new PlayableModel( ui->albums );
ui->albums->setPlayableModel( m_albumsModel );
ui->albums->setEmptyTip( tr( "Sorry, we could not find any albums for this artist!" ) );
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!" ) );
m_topHitsModel = new PlaylistModel( ui->topHits );
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->relatedArtists->setAutoFitItems( false );
ui->relatedArtists->setWrapping( false );
ui->relatedArtists->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
ui->relatedArtists->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
ui->relatedArtists->delegate()->setItemSize( QSize( 170, 170 ) );
ui->albums->setAutoFitItems( false );
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 );
ui->topHits->setFrameShape( QFrame::StyledPanel );
ui->topHits->setAttribute( Qt::WA_MacShowFocusRect, 0 );
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Original, QSize( 48, 48 ) );
ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Grid ) );
ui->cover->setShowText( true );
QFont f = font();
f.setPointSize( f.pointSize() + 1 );
ui->biography->setOpenLinks( false );
ui->biography->setOpenExternalLinks( true );
ui->biography->setFrameShape( QFrame::NoFrame );
ui->biography->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->biography->setFont( f );
TomahawkUtils::styleScrollBar( ui->biography->verticalScrollBar() );
QPalette p = ui->biography->palette();
p.setColor( QPalette::Foreground, Qt::white );
p.setColor( QPalette::Text, Qt::gray );
ui->biography->setPalette( p );
ui->label->setPalette( p );
ui->label_2->setPalette( p );
ui->label_3->setPalette( p );
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setWidget( widget );
area->setStyleSheet( "QScrollArea { background-color: #454e59; }" );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
TomahawkUtils::styleScrollBar( ui->albums->horizontalScrollBar() );
TomahawkUtils::styleScrollBar( ui->relatedArtists->horizontalScrollBar() );
ui->biography->setStyleSheet( "QTextBrowser#biography { background-color: transparent; }" );
ui->biography->document()->setDefaultStyleSheet( "a { text-decoration: none; font-weight: bold; color: #ffffff; }" );
ui->albums->setStyleSheet( "QListView { background-color: transparent; }" );
ui->albumFrame->setStyleSheet( "QFrame#albumFrame { background-color: transparent; }"
"QFrame#albumFrame { "
"border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;"
"border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" );
ui->relatedArtists->setStyleSheet( "QListView { background-color: transparent; }" );
ui->artistFrame->setStyleSheet( "QFrame#artistFrame { background-color: transparent; }"
"QFrame#artistFrame { "
//.........这里部分代码省略.........
示例7: 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 );
}
示例8: 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() ) );
}
示例9: 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 );
}
示例10: 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();
//.........这里部分代码省略.........
示例11: QWidget
AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* parent )
: QWidget( parent )
, ui( new Ui::AlbumInfoWidget )
{
QWidget* widget = new QWidget;
ui->setupUi( widget );
QPalette pal = palette();
pal.setColor( QPalette::Window, TomahawkStyle::PAGE_BACKGROUND );
widget->setPalette( pal );
widget->setAutoFillBackground( true );
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!" ) );
m_tracksModel = new TreeModel( ui->tracks );
m_tracksModel->setMode( Mixed );
ui->tracks->setRootIsDecorated( false );
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 );
AlbumItemDelegate* del = new AlbumItemDelegate( ui->tracks, ui->tracks->proxyModel() );
ui->tracks->setPlaylistItemDelegate( del );
ui->albums->setAutoFitItems( false );
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 );
ui->tracks->setFrameShape( QFrame::StyledPanel );
ui->tracks->setAttribute( Qt::WA_MacShowFocusRect, 0 );
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( true );
ui->biography->setFrameShape( QFrame::NoFrame );
ui->biography->setAttribute( Qt::WA_MacShowFocusRect, 0 );
TomahawkUtils::styleScrollBar( ui->biography->verticalScrollBar() );
QPalette p = ui->biography->palette();
p.setColor( QPalette::Foreground, Qt::white );
p.setColor( QPalette::Text, Qt::white );
ui->biography->setPalette( p );
ui->label->setPalette( p );
ui->label_2->setPalette( p );
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
area->setStyleSheet( "QScrollArea { background-color: #454e59; }" );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
TomahawkUtils::styleScrollBar( ui->tracks->horizontalScrollBar() );
TomahawkUtils::styleScrollBar( ui->albums->horizontalScrollBar() );
ui->biography->setStyleSheet( "QTextBrowser#biography { background-color: transparent; }" );
ui->albums->setStyleSheet( "QListView { background-color: transparent; }" );
ui->albumFrame->setStyleSheet( "QFrame#albumFrame { background-color: transparent; }"
"QFrame#albumFrame { "
"border-image: url(" RESPATH "images/widget-border.png) 3 3 3 3 stretch stretch;"
"border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" );
ui->trackFrame->setStyleSheet( "QFrame#trackFrame { background-color: transparent; }"
"QFrame#trackFrame { "
"border-image: url(" RESPATH "images/widget-border.png) 3 3 3 3 stretch stretch;"
"border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" );
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
mpl->addChildInterface( ui->tracks->playlistInterface() );
mpl->addChildInterface( ui->albums->playlistInterface() );
m_playlistInterface = playlistinterface_ptr( mpl );
load( album );
}
示例12: QWidget
TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* parent )
: QWidget( parent )
, ui( new Ui::TrackInfoWidget )
{
QWidget* widget = new QWidget;
ui->setupUi( widget );
QPalette pal = palette();
pal.setColor( QPalette::Window, QColor( "#454e59" ) );
widget->setPalette( pal );
widget->setAutoFillBackground( true );
ui->rightBar->setPalette( pal );
ui->rightBar->setAutoFillBackground( true );
ui->statsLabel->setStyleSheet( "QLabel { background-image:url(); border: 2px solid #dddddd; background-color: #faf9f9; border-radius: 4px; padding: 12px; }" );
ui->lyricsView->setStyleSheet( "QTextBrowser#lyricsView { background-color: transparent; }" );
ui->lyricsView->setFrameShape( QFrame::NoFrame );
ui->lyricsView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->similarTracksView->setAutoResize( true );
ui->similarTracksView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
// TomahawkUtils::styleScrollBar( ui->similarTracksView->verticalScrollBar() );
TomahawkUtils::styleScrollBar( ui->lyricsView->verticalScrollBar() );
QFont f = font();
f.setBold( true );
f.setPixelSize( 18 );
ui->trackLabel->setFont( f );
// ui->similarTracksLabel->setFont( f );
f.setPixelSize( 14 );
ui->artistLabel->setFont( f );
ui->albumLabel->setFont( f );
f.setPixelSize( 12 );
ui->statsLabel->setFont( f );
// ui->similarTracksView->setStyleSheet( "QListView { background-color: transparent; } QListView::item { background-color: transparent; }" );
QPalette p = ui->trackLabel->palette();
p.setColor( QPalette::Foreground, Qt::white );
p.setColor( QPalette::Text, Qt::white );
ui->trackLabel->setPalette( p );
ui->artistLabel->setPalette( p );
ui->albumLabel->setPalette( p );
ui->lyricsView->setPalette( p );
ui->label->setPalette( p );
// ui->similarTracksLabel->setPalette( p );
ui->artistLabel->setType( QueryLabel::Artist );
ui->albumLabel->setType( QueryLabel::Album );
m_relatedTracksModel = new PlayableModel( ui->similarTracksView );
ui->similarTracksView->setPlayableModel( m_relatedTracksModel );
ui->similarTracksView->proxyModel()->sort( -1 );
ui->similarTracksView->setEmptyTip( tr( "Sorry, but we could not find similar tracks for this song!" ) );
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::ScaledCover, QSize( 48, 48 ) );
ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultTrackImage, TomahawkUtils::ScaledCover, QSize( ui->cover->sizeHint() ) ) );
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setWidget( widget );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setStyleSheet( "QScrollArea { background-color: #454e59 }" );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
ui->similarTracksView->setStyleSheet( "QListView { background-color: transparent; }" );
ui->frame->setStyleSheet( "QFrame#frame { background-color: transparent; }"
"QFrame#frame { "
"border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;"
"border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" );
load( query );
connect( ui->artistLabel, SIGNAL( clickedArtist() ), SLOT( onArtistClicked() ) );
connect( ui->albumLabel, SIGNAL( clickedAlbum() ), SLOT( onAlbumClicked() ) );
}
示例13: 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 );
}