diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-08-18 20:52:17 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-08-18 20:52:17 +0200 |
commit | c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d (patch) | |
tree | 7be301a5123e216a41646f9639ec887609497a87 /gui/ModListView.cpp | |
parent | 253067c782955380bbf66ac0475dc954375b1ff4 (diff) | |
download | MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.tar MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.tar.gz MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.tar.lz MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.tar.xz MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.zip |
Drag and Drop, mod management.
Diffstat (limited to 'gui/ModListView.cpp')
-rw-r--r-- | gui/ModListView.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gui/ModListView.cpp b/gui/ModListView.cpp new file mode 100644 index 00000000..a9898851 --- /dev/null +++ b/gui/ModListView.cpp @@ -0,0 +1,32 @@ +#include "ModListView.h" +#include <QHeaderView> +#include <QMouseEvent> + +ModListView::ModListView ( QWidget* parent ) + :QTreeView ( parent ) +{ + setAllColumnsShowFocus ( true ); + setExpandsOnDoubleClick ( false ); + setRootIsDecorated ( false ); + setSortingEnabled ( false ); + setAlternatingRowColors ( true ); + setSelectionMode ( QAbstractItemView::SingleSelection ); + setHeaderHidden ( false ); + setSelectionBehavior(QAbstractItemView::SelectRows); + setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOn ); + setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded ); + setDropIndicatorShown(true); + setDragEnabled(true); + setDragDropMode(QAbstractItemView::DragDrop); + viewport()->setAcceptDrops(true); +} + +void ModListView::setModel ( QAbstractItemModel* model ) +{ + QTreeView::setModel ( model ); + auto head = header(); + head->setStretchLastSection(false); + head->setSectionResizeMode(0, QHeaderView::Stretch); + head->setSectionResizeMode(1, QHeaderView::ResizeToContents); + dropIndicatorPosition(); +} |