Commit 00b4ef8e authored by ck's avatar ck
Browse files

Help documents list: Only show close button when closing is possible.

parent 9ece8a41
...@@ -68,7 +68,8 @@ void OpenPagesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt ...@@ -68,7 +68,8 @@ void OpenPagesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
QStyledItemDelegate::paint(painter, option, index); QStyledItemDelegate::paint(painter, option, index);
if (index.column() == 1 && option.state & QStyle::State_MouseOver) { if (index.column() == 1 && index.model()->rowCount() > 1
&& option.state & QStyle::State_MouseOver) {
QIcon icon((option.state & QStyle::State_Selected) QIcon icon((option.state & QStyle::State_Selected)
? ":/core/images/closebutton.png" : ":/core/images/darkclosebutton.png"); ? ":/core/images/closebutton.png" : ":/core/images/darkclosebutton.png");
...@@ -137,10 +138,12 @@ void OpenPagesWidget::allowContextMenu(bool ok) ...@@ -137,10 +138,12 @@ void OpenPagesWidget::allowContextMenu(bool ok)
void OpenPagesWidget::contextMenuRequested(QPoint pos) void OpenPagesWidget::contextMenuRequested(QPoint pos)
{ {
const QModelIndex &index = indexAt(pos); QModelIndex index = indexAt(pos);
if (!index.isValid() || !m_allowContextMenu) if (!index.isValid() || !m_allowContextMenu)
return; return;
if (index.column() == 1)
index = index.sibling(index.row(), 0);
QMenu contextMenu; QMenu contextMenu;
QAction *closeEditor = contextMenu.addAction(tr("Close %1").arg(index.data() QAction *closeEditor = contextMenu.addAction(tr("Close %1").arg(index.data()
.toString())); .toString()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment