diff --git a/src/lib/bookmarks/bookmarksimport/bookmarksimportdialog.cpp b/src/lib/bookmarks/bookmarksimport/bookmarksimportdialog.cpp index fc173bfeb..410e0b58c 100644 --- a/src/lib/bookmarks/bookmarksimport/bookmarksimportdialog.cpp +++ b/src/lib/bookmarks/bookmarksimport/bookmarksimportdialog.cpp @@ -25,6 +25,7 @@ #include "bookmarks.h" #include "bookmarkitem.h" #include "bookmarksmodel.h" +#include "bookmarksitemdelegate.h" #include "mainapplication.h" #include @@ -41,6 +42,7 @@ BookmarksImportDialog::BookmarksImportDialog(QWidget* parent) ui->setupUi(this); ui->browserList->setCurrentRow(0); + ui->treeView->setItemDelegate(new BookmarksItemDelegate(ui->treeView)); connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextPage())); connect(ui->backButton, SIGNAL(clicked()), this, SLOT(previousPage())); diff --git a/src/lib/bookmarks/bookmarksitemdelegate.cpp b/src/lib/bookmarks/bookmarksitemdelegate.cpp index 6f3c1ae30..aad46f27a 100644 --- a/src/lib/bookmarks/bookmarksitemdelegate.cpp +++ b/src/lib/bookmarks/bookmarksitemdelegate.cpp @@ -24,10 +24,11 @@ #include #include -BookmarksItemDelegate::BookmarksItemDelegate(BookmarksTreeView* parent) +BookmarksItemDelegate::BookmarksItemDelegate(QTreeView* parent) : QStyledItemDelegate(parent) , m_tree(parent) { + Q_ASSERT(m_tree); } void BookmarksItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const @@ -39,7 +40,7 @@ void BookmarksItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem opt.state &= ~QStyle::State_Horizontal; // We need to fake continuous line over 2 columns - if (m_tree->viewType() == BookmarksTreeView::BookmarksManagerViewType) { + if (m_tree->model()->columnCount(index) == 2) { if (index.column() == 1) { opt.rect = m_lastRect; } diff --git a/src/lib/bookmarks/bookmarksitemdelegate.h b/src/lib/bookmarks/bookmarksitemdelegate.h index 619f4ccba..aa04a653c 100644 --- a/src/lib/bookmarks/bookmarksitemdelegate.h +++ b/src/lib/bookmarks/bookmarksitemdelegate.h @@ -22,19 +22,19 @@ #include "qz_namespace.h" -class BookmarksTreeView; +class QTreeView; class QT_QUPZILLA_EXPORT BookmarksItemDelegate : public QStyledItemDelegate { Q_OBJECT public: - explicit BookmarksItemDelegate(BookmarksTreeView* parent = 0); + explicit BookmarksItemDelegate(QTreeView* parent = 0); void paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; private: - BookmarksTreeView* m_tree; + QTreeView* m_tree; mutable QRect m_lastRect; };