diff options
author | ck <qt-info@nokia.com> | 2010-04-26 09:11:46 (GMT) |
---|---|---|
committer | ck <qt-info@nokia.com> | 2010-04-26 09:11:46 (GMT) |
commit | 2c99794e486234580fc0e149c1f176edb57d6565 (patch) | |
tree | f864edabd4c5e3c2c0d491b19011087d0f175386 /tools/assistant | |
parent | ceab797e9ff58148fe6218c411a4ee1734acac40 (diff) | |
download | Qt-2c99794e486234580fc0e149c1f176edb57d6565.zip Qt-2c99794e486234580fc0e149c1f176edb57d6565.tar.gz Qt-2c99794e486234580fc0e149c1f176edb57d6565.tar.bz2 |
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
Diffstat (limited to 'tools/assistant')
-rw-r--r-- | tools/assistant/tools/assistant/openpageswidget.cpp | 7 |
1 files 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()));
|