1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[BookmarksImportDialog] Draw separators in imported bookmarks treeview

This commit is contained in:
nowrep 2014-02-15 22:18:11 +01:00
parent 763183be88
commit 680ed27c22
3 changed files with 8 additions and 5 deletions

View File

@ -25,6 +25,7 @@
#include "bookmarks.h"
#include "bookmarkitem.h"
#include "bookmarksmodel.h"
#include "bookmarksitemdelegate.h"
#include "mainapplication.h"
#include <QMessageBox>
@ -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()));

View File

@ -24,10 +24,11 @@
#include <QApplication>
#include <QStyle>
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;
}

View File

@ -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;
};