Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -601,35 +601,24 @@ lmms--gui--TrackLabelButton:hover {
background: #3B424A;
border: 1px solid #515B66;
border-radius: none;
font-size: 11px;
font-weight: normal;
padding: 2px 1px;
}

lmms--gui--TrackLabelButton:pressed {
background: #262B30;
border-radius: none;
font-size: 11px;
font-weight: normal;
padding: 2px 1px;
}

lmms--gui--TrackLabelButton:checked {
border: 1px solid #485059;
background: #1C1F24;
background-image: url("resources:track_shadow_p.png");
border-radius: none;
font-size: 11px;
font-weight: normal;
padding: 2px 1px;
}

lmms--gui--TrackLabelButton:checked:pressed {
border: 1px solid #2f353b;
background: #0e1012;
background-image: url("resources:track_shadow_p.png");
font-size: 11px;
padding: 2px 1px;
font-weight: solid;
}

Expand Down
20 changes: 15 additions & 5 deletions src/gui/tracks/TrackLabelButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ TrackLabelButton::TrackLabelButton( TrackView * _tv, QWidget * _parent ) :
setAcceptDrops( true );
setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) );
setToolButtonStyle( Qt::ToolButtonTextBesideIcon );

m_renameLineEdit = new TrackRenameLineEdit( this );
m_renameLineEdit->hide();

Expand All @@ -60,8 +61,6 @@ TrackLabelButton::TrackLabelButton( TrackView * _tv, QWidget * _parent ) :
else
{
setFixedSize( 160, 29 );
m_renameLineEdit->move( 30, ( height() / 2 ) - ( m_renameLineEdit->sizeHint().height() / 2 ) );
m_renameLineEdit->setFixedWidth( width() - 33 );
connect( m_renameLineEdit, SIGNAL(editingFinished()), this, SLOT(renameFinished()));
}

Expand Down Expand Up @@ -89,11 +88,22 @@ void TrackLabelButton::rename()
}
else
{
QString txt = m_trackView->getTrack()->name();
m_renameLineEdit->show();
m_renameLineEdit->setText( txt );
const auto & trackName = m_trackView->getTrack()->name();
m_renameLineEdit->setText(trackName);
m_renameLineEdit->selectAll();
m_renameLineEdit->setFocus();

// Make sure that the rename line edit uses the same font as the widget
// which is set via style sheets
m_renameLineEdit->setFont(font());

// Move the line edit to the correct position by taking the size of the
// icon into account.
const auto iconWidth = iconSize().width();
m_renameLineEdit->move(iconWidth + 1, (height() / 2 - m_renameLineEdit->sizeHint().height() / 2) + 1);
m_renameLineEdit->setFixedWidth(width() - (iconWidth + 6));

m_renameLineEdit->show();
}
}

Expand Down