mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
[BookmarksImportDialog] Draw separators in imported bookmarks treeview
This commit is contained in:
parent
763183be88
commit
680ed27c22
|
@ -25,6 +25,7 @@
|
||||||
#include "bookmarks.h"
|
#include "bookmarks.h"
|
||||||
#include "bookmarkitem.h"
|
#include "bookmarkitem.h"
|
||||||
#include "bookmarksmodel.h"
|
#include "bookmarksmodel.h"
|
||||||
|
#include "bookmarksitemdelegate.h"
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
@ -41,6 +42,7 @@ BookmarksImportDialog::BookmarksImportDialog(QWidget* parent)
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->browserList->setCurrentRow(0);
|
ui->browserList->setCurrentRow(0);
|
||||||
|
ui->treeView->setItemDelegate(new BookmarksItemDelegate(ui->treeView));
|
||||||
|
|
||||||
connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextPage()));
|
connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextPage()));
|
||||||
connect(ui->backButton, SIGNAL(clicked()), this, SLOT(previousPage()));
|
connect(ui->backButton, SIGNAL(clicked()), this, SLOT(previousPage()));
|
||||||
|
|
|
@ -24,10 +24,11 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
|
||||||
BookmarksItemDelegate::BookmarksItemDelegate(BookmarksTreeView* parent)
|
BookmarksItemDelegate::BookmarksItemDelegate(QTreeView* parent)
|
||||||
: QStyledItemDelegate(parent)
|
: QStyledItemDelegate(parent)
|
||||||
, m_tree(parent)
|
, m_tree(parent)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(m_tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookmarksItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
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;
|
opt.state &= ~QStyle::State_Horizontal;
|
||||||
|
|
||||||
// We need to fake continuous line over 2 columns
|
// 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) {
|
if (index.column() == 1) {
|
||||||
opt.rect = m_lastRect;
|
opt.rect = m_lastRect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,19 +22,19 @@
|
||||||
|
|
||||||
#include "qz_namespace.h"
|
#include "qz_namespace.h"
|
||||||
|
|
||||||
class BookmarksTreeView;
|
class QTreeView;
|
||||||
|
|
||||||
class QT_QUPZILLA_EXPORT BookmarksItemDelegate : public QStyledItemDelegate
|
class QT_QUPZILLA_EXPORT BookmarksItemDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BookmarksItemDelegate(BookmarksTreeView* parent = 0);
|
explicit BookmarksItemDelegate(QTreeView* parent = 0);
|
||||||
|
|
||||||
void paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
void paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BookmarksTreeView* m_tree;
|
QTreeView* m_tree;
|
||||||
mutable QRect m_lastRect;
|
mutable QRect m_lastRect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user