mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-14 03:52:39 -04:00
Add spacing again for forums, messages and channels.
Added a new base class "RSItemDelegate" for adding a spacing for the item and remove the focus rectangle of the empty text for items with only an icon. Removed existing classes "ForumsItemDelegate" and "MessagesItemDelegate". git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3771 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ca45c73dc2
commit
e20e9a529a
8 changed files with 139 additions and 68 deletions
|
@ -39,6 +39,7 @@
|
|||
#include "util/misc.h"
|
||||
#include "common/TagDefs.h"
|
||||
#include "common/PeerDefs.h"
|
||||
#include "common/RSItemDelegate.h"
|
||||
|
||||
#include <retroshare/rsinit.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
@ -92,36 +93,6 @@
|
|||
#define ACTION_TAGS_TAG 1
|
||||
#define ACTION_TAGS_NEWTAG 2
|
||||
|
||||
class MessagesItemDelegate : public QItemDelegate
|
||||
{
|
||||
public:
|
||||
MessagesItemDelegate(QObject *parent = 0) : QItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QStyleOptionViewItem ownOption (option);
|
||||
|
||||
if (index.column() == COLUMN_UNREAD) {
|
||||
ownOption.state &= ~QStyle::State_HasFocus; // don't show text and focus rectangle
|
||||
}
|
||||
|
||||
QItemDelegate::paint (painter, ownOption, index);
|
||||
}
|
||||
|
||||
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QStyleOptionViewItem ownOption (option);
|
||||
|
||||
if (index.column() == COLUMN_UNREAD) {
|
||||
ownOption.state &= ~QStyle::State_HasFocus; // don't show text and focus rectangle
|
||||
}
|
||||
|
||||
return QItemDelegate::sizeHint(ownOption, index);
|
||||
}
|
||||
};
|
||||
|
||||
class MessagesMenu : public QMenu
|
||||
{
|
||||
public:
|
||||
|
@ -309,8 +280,10 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||
ui.messagestreeView->setModel(proxyModel);
|
||||
ui.messagestreeView->setSelectionBehavior(QTreeView::SelectRows);
|
||||
|
||||
QItemDelegate *pDelegate = new MessagesItemDelegate(this);
|
||||
ui.messagestreeView->setItemDelegate(pDelegate);
|
||||
RSItemDelegate *itemDelegate = new RSItemDelegate(this);
|
||||
itemDelegate->removeFocusRect(COLUMN_UNREAD);
|
||||
itemDelegate->setSpacing(QSize(0, 2));
|
||||
ui.messagestreeView->setItemDelegate(itemDelegate);
|
||||
|
||||
ui.messagestreeView->setRootIsDecorated(false);
|
||||
ui.messagestreeView->setSortingEnabled(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue