summaryrefslogtreecommitdiffstats
path: root/fileview.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-04-10 21:36:26 +0200
committerArno <am@disconnect.de>2013-04-10 21:36:26 +0200
commita39a1118320c2c2e291f9e771ab75d32549431a7 (patch)
treea82ae27aa4e0e398e99b1127b51d65da36f1c5b9 /fileview.cpp
parent69791ade746638180a959c190fa5db6519c83a38 (diff)
downloadSheMov-a39a1118320c2c2e291f9e771ab75d32549431a7.tar.gz
SheMov-a39a1118320c2c2e291f9e771ab75d32549431a7.tar.bz2
SheMov-a39a1118320c2c2e291f9e771ab75d32549431a7.zip
Fix setAlternatignRowColors
Well, what started as a try to simplify QTreeView ended in a mass header murder... What happened: * I searched for a way to let every QTreeView honor the setAlternatingRowcolors() setting. Unfortunately it isn't enough to just set the global palette and set it to true. So every QTreeView is now derived from SmTreeView * SmTreeView registers itself with SmGlobals, so the property is set _after_ it's constructed. It's definitely not enough to call it in the constructor. I guess that's a bug. But it's enough to append the SmTreeView to a QList<QWidget*> in SmGlobals and call it _after_ the painting is done. * As an added Bonus we can add virt. funcs to every SmTreeView at will While at it I realized that most of the included headers were void, so remove them. No idea what impact it has on the bin size...
Diffstat (limited to 'fileview.cpp')
-rw-r--r--fileview.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/fileview.cpp b/fileview.cpp
index a6108bb..1720552 100644
--- a/fileview.cpp
+++ b/fileview.cpp
@@ -42,13 +42,12 @@ FileView::FileView(QWidget *parent) : SmTreeView("ui/fsheaderpos", parent), mDel
mHoverWin = new HoverWindow(this);
QSize curSize = SmGlobals::instance()->cursorSize();
mHoverWin->setHoverOffset(QPoint(curSize.width() + 30, 0));
- SmGlobals::instance()->treeWidgets().append(this);
}
void FileView::setModel(QAbstractItemModel *model){
mProxy = qobject_cast<FilesystemFileProxy*>(model);
mModel = qobject_cast<SmDirModel*>(mProxy->sourceModel());
- QTreeView::setModel(model);
+ SmTreeView::setModel(model);
}
const QVariant FileView::duration() const {
@@ -119,7 +118,7 @@ void FileView::writeConfig(){
}
void FileView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint){
- QTreeView::closeEditor(editor, hint);
+ SmTreeView::closeEditor(editor, hint);
QSortFilterProxyModel *proxy = qobject_cast<QSortFilterProxyModel*>(model());
QModelIndex sourceIdx = proxy->mapToSource(currentIndex());
emit editorClosed(sourceIdx);
@@ -137,7 +136,7 @@ void FileView::contextMenuEvent(QContextMenuEvent *e){
void FileView::keyPressEvent(QKeyEvent *e){
if(!hasFocus()){
- QTreeView::keyPressEvent(e);
+ SmTreeView::keyPressEvent(e);
return;
}
switch(e->key()){
@@ -155,7 +154,7 @@ void FileView::keyPressEvent(QKeyEvent *e){
e->accept();
break;
default:
- QTreeView::keyPressEvent(e);
+ SmTreeView::keyPressEvent(e);
}
}
@@ -222,7 +221,7 @@ bool FileView::event(QEvent *e){
}else if(e->type() == QEvent::HoverLeave){
return exitHover();
}
- return QTreeView::event(e);
+ return SmTreeView::event(e);
}
void FileView::selectedFilesChanged(){