1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-14 01:54:07 +02:00

If the current crumb doesn't have any children, do not show the arrow.

This commit is contained in:
Casey Link
2011-08-31 17:00:04 -05:00
parent a6452dbeee
commit e05b8b1843
3 changed files with 14 additions and 1 deletions

View File

@@ -71,7 +71,8 @@ bool SiblingCrumbButton::isActive() const
QSize SiblingCrumbButton::sizeHint() const QSize SiblingCrumbButton::sizeHint() const
{ {
// our width = width of combo + 20px for right-arrow and spacing // our width = width of combo + 20px for right-arrow and spacing
return m_combo->sizeHint() + QSize(20,0); const int padding = hasChildren() ? 20 : 5;
return m_combo->sizeHint() + QSize(padding,0);
} }
void SiblingCrumbButton::paintEvent(QPaintEvent *event) void SiblingCrumbButton::paintEvent(QPaintEvent *event)
@@ -85,6 +86,9 @@ void SiblingCrumbButton::paintEvent(QPaintEvent *event)
StyleHelper::horizontalHeader(&p, r); // draw the background StyleHelper::horizontalHeader(&p, r); // draw the background
if( !hasChildren() )
return;
bool reverse = opt.direction == Qt::RightToLeft; bool reverse = opt.direction == Qt::RightToLeft;
int menuButtonWidth = 12; int menuButtonWidth = 12;
int rightSpacing = 10; int rightSpacing = 10;
@@ -147,3 +151,8 @@ void SiblingCrumbButton::activateSelf()
{ {
comboboxActivated(m_index.row()); comboboxActivated(m_index.row());
} }
bool SiblingCrumbButton::hasChildren() const
{
return m_index.model()->hasChildren(m_index);
}

View File

@@ -71,6 +71,8 @@ private slots:
void activateSelf(); void activateSelf();
private: private:
bool hasChildren() const;
QModelIndex m_index; /*!< our current index */ QModelIndex m_index; /*!< our current index */
ComboBox *m_combo; /*!< our combobox! */ ComboBox *m_combo; /*!< our combobox! */

View File

@@ -55,6 +55,8 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
TomahawkUtils::unmarginLayout( layout() ); TomahawkUtils::unmarginLayout( layout() );
TomahawkUtils::unmarginLayout( ui->verticalLayout->layout() ); TomahawkUtils::unmarginLayout( ui->verticalLayout->layout() );
TomahawkUtils::unmarginLayout( ui->verticalLayout_2->layout() ); TomahawkUtils::unmarginLayout( ui->verticalLayout_2->layout() );
TomahawkUtils::unmarginLayout( ui->breadCrumbLeft->layout() );
TomahawkUtils::unmarginLayout( ui->breadCrumbRight->layout() );
//set crumb widgets //set crumb widgets