m_listView = new ProjectListView(this);;
QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
-
-
+ layout->setSpacing(0);
// setup toolbar
KTreeWidgetSearchLine *searchView = new KTreeWidgetSearchLine(this);
setAlternatingRowColors(true);
setDragEnabled(true);
setAcceptDrops(true);
-
+ setFrameShape(QFrame::NoFrame);
+ setRootIsDecorated(false);
setColumnCount(3);
QStringList headers;
emit requestMenu(event->globalPos(), itemAt(event->pos()));
}
+// virtual
+void ProjectListView::keyPressEvent(QKeyEvent * event)
+{
+ if (event->key() == Qt::Key_Return) {
+ QTreeWidgetItem *it = currentItem();
+ if (it) it->setExpanded(!it->isExpanded());
+ } else QTreeWidget::keyPressEvent(event);
+}
+
// virtual
void ProjectListView::mouseDoubleClickEvent(QMouseEvent * event)
{
}
ProjectItem *item;
if (it->type() == PROJECTFOLDERTYPE) {
- if ((columnAt(event->pos().x()) == 0)) QTreeWidget::mouseDoubleClickEvent(event);
+ if ((columnAt(event->pos().x()) == 0)) {
+ QPixmap pix = qVariantValue<QPixmap>(it->data(0, Qt::DecorationRole));
+ int offset = pix.width() + indentation();
+ if (event->pos().x() < offset) {
+ it->setExpanded(!it->isExpanded());
+ event->accept();
+ } else QTreeWidget::mouseDoubleClickEvent(event);
+ }
return;
}
if (it->type() == PROJECTSUBCLIPTYPE) {
virtual QStringList mimeTypes() const;
virtual Qt::DropActions supportedDropActions() const;
virtual void dragMoveEvent(QDragMoveEvent * event);
+ virtual void keyPressEvent(QKeyEvent * event);
public slots: