This reverts commit 288d3e4c1b.
remotes/origin/gsoc2015_layer_feature
parent
288d3e4c1b
commit
8f5fecfd5b
5 changed files with 0 additions and 77 deletions
@ -1,37 +0,0 @@ |
||||
/***************************************************************************
|
||||
* Copyright (C) 2015 by Saheb Preet Singh <saheb.preet@gmail.com> * |
||||
* * |
||||
* This program is free software; you can redistribute it and/or modify * |
||||
* it under the terms of the GNU General Public License as published by * |
||||
* the Free Software Foundation; either version 2 of the License, or * |
||||
* (at your option) any later version. * |
||||
***************************************************************************/ |
||||
|
||||
#include "layersitemdelegate.h" |
||||
|
||||
#include <kicon.h> |
||||
#include <QPainter> |
||||
#include <QDebug> |
||||
|
||||
Q_DECLARE_METATYPE( Qt::CheckState ); |
||||
|
||||
LayersItemDelegate::LayersItemDelegate( QWidget * parent ) |
||||
: QStyledItemDelegate( parent ) |
||||
{ |
||||
|
||||
} |
||||
|
||||
void LayersItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const |
||||
{ |
||||
Qt::CheckState state = (Qt::CheckState ) qvariant_cast<int>( index.data( Qt::CheckStateRole ) ); |
||||
if( option.state & QStyle::State_Selected ) |
||||
painter->fillRect( option.rect, option.palette.highlight() ); |
||||
KIcon icon = state == Qt::Checked ? KIcon( "layer-visible-on" ) : KIcon( "layer-visible-off" ); |
||||
QRect iconRect = option.rect; |
||||
iconRect.setWidth( iconRect.height() ); |
||||
painter->drawPixmap( iconRect, icon.pixmap( iconRect.size() ) ); |
||||
|
||||
QString text = qvariant_cast<QString>( index.data( Qt::DisplayRole ) ); |
||||
QRect textRect = QRect( iconRect.topRight() + QPoint( 5, 0 ), QSize( option.rect.width() - iconRect.width(), option.rect.height() ) ); |
||||
painter->drawText( textRect, Qt::AlignVCenter, text ); |
||||
} |
||||
@ -1,26 +0,0 @@ |
||||
/***************************************************************************
|
||||
* Copyright (C) 2015 by Saheb Preet Singh <saheb.preet@gmail.com> * |
||||
* * |
||||
* This program is free software; you can redistribute it and/or modify * |
||||
* it under the terms of the GNU General Public License as published by * |
||||
* the Free Software Foundation; either version 2 of the License, or * |
||||
* (at your option) any later version. * |
||||
***************************************************************************/ |
||||
|
||||
#ifndef _OKULAR_LAYERSITEMDELEGATE_H_ |
||||
#define _OKULAR_LAYERSITEMDELEGATE_H_ |
||||
|
||||
#include <QStyledItemDelegate> |
||||
|
||||
#include "okular_part_export.h" |
||||
|
||||
class OKULAR_PART_EXPORT LayersItemDelegate : public QStyledItemDelegate |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
LayersItemDelegate( QWidget * parent); |
||||
|
||||
virtual void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; |
||||
}; |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue