m_friendListHeaderWidget->setAutoFillBackground(true);
m_routeButton = new QPushButton(tr("Route to friend"));
+ m_routeButton->setDisabled(true);
QPalette labelPalette = m_friendListHeaderWidget->palette();
labelPalette.setColor(QPalette::Background, Qt::black);
m_friendListView->setItemDelegate(new FriendListItemDelegate(this));
QVBoxLayout *listViewLayout = new QVBoxLayout;
- listViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
+ listViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
+ PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM);
listViewLayout->addWidget(m_friendListView);
friendListPanelLayout->addWidget(m_routeButton);
connect(m_routeButton, SIGNAL(clicked()),
this, SLOT(routeToSelectedFriend()));
+ connect(m_friendListView, SIGNAL(listItemSelectionChanged()),
+ this, SLOT(setRouteButtonDisabled()));
+
/// @todo remove old filterLayout when new panel are merged
//////////////////////////////////////////////////////////////////////////
updateKeyboardGrabbing();
clearFiltering();
+
+ m_friendListView->clearItemSelection();
+ setRouteButtonDisabled();
}
void FriendListPanel::anyPanelOpened()
QWidget::hideEvent(event);
updateKeyboardGrabbing();
clearFiltering();
+
+ m_friendListView->clearItemSelection();
+ setRouteButtonDisabled();
}
void FriendListPanel::routeToSelectedFriend()
}
}
+void FriendListPanel::setRouteButtonDisabled()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_routeButton->setDisabled(m_friendListView->selectedItems().isEmpty());
+}
+
void FriendListPanel::showEvent(QShowEvent *event)
{
qDebug() << __PRETTY_FUNCTION__;