From 2c99794e486234580fc0e149c1f176edb57d6565 Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 26 Apr 2010 11:11:46 +0200 Subject: Assistant: Don't display close button when it's not functional. Plus: Show page title in context menu also when right-clicking on the close button. Reviewed-by: kh1 --- tools/assistant/tools/assistant/openpageswidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/assistant/tools/assistant/openpageswidget.cpp b/tools/assistant/tools/assistant/openpageswidget.cpp index 648ead8..bbc86c3 100644 --- a/tools/assistant/tools/assistant/openpageswidget.cpp +++ b/tools/assistant/tools/assistant/openpageswidget.cpp @@ -63,7 +63,8 @@ void OpenPagesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt 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) ? ":/trolltech/assistant/images/closebutton.png" : ":/trolltech/assistant/images/darkclosebutton.png"); @@ -113,10 +114,12 @@ OpenPagesWidget::~OpenPagesWidget() void OpenPagesWidget::contextMenuRequested(QPoint pos) { - const QModelIndex &index = indexAt(pos); + QModelIndex index = indexAt(pos); if (!index.isValid()) return; + if (index.column() == 1) + index = index.sibling(index.row(), 0); QMenu contextMenu; QAction *closeEditor = contextMenu.addAction(tr("Close %1").arg(index.data() .toString())); -- cgit v0.12