Originally Posted by
wysota
sort() is a method of the LISTVIEW, not of the ITEM.
I reimplemented it in subclass of QListView.
class KMListView : public KListView
{
Q_OBJECT
public:
KMListView
(QWidget * parent
= 0,
const char * name
= 0);
~KMListView();
void setSelected(QListViewItem * item, bool selected);
void clearSelection();
QListViewItem * selectedItem() const;
void sort();
public slots:
void selectAll();
signals:
void mouseButtonReleased
(const QPoint &);
void rightMouseButtonClicked
(const QPoint &);
void sortRequested(const int, const SortOrder);
protected:
void enforceSortOrder() const;
private:
bool dndPerm;
};
class KMListView : public KListView
{
Q_OBJECT
public:
KMListView(QWidget * parent = 0, const char * name = 0);
~KMListView();
void setSelected(QListViewItem * item, bool selected);
void clearSelection();
QListViewItem * selectedItem() const;
void sort();
public slots:
void selectAll();
signals:
void mouseButtonReleased(const QPoint &);
void keyPressed(QKeyEvent * e);
void rightMouseButtonClicked(const QPoint &);
void sortRequested(const int, const SortOrder);
protected:
bool acceptDrag(QDropEvent * event) const;
void contentsMousePressEvent(QMouseEvent * e);
void contentsMouseReleaseEvent(QMouseEvent * e);
void contentsMouseMoveEvent(QMouseEvent * e);
void keyPressEvent(QKeyEvent * e);
void enforceSortOrder() const;
private:
bool dndPerm;
};
To copy to clipboard, switch view to plain text mode
void KMListView::sort()
{
qDebug("sort");
emit sortRequested(sortColumn(), sortOrder());
}
void KMListView::sort()
{
qDebug("sort");
emit sortRequested(sortColumn(), sortOrder());
}
To copy to clipboard, switch view to plain text mode
sort() is executed only when I call it:
KMListView * lv = new KMListView(this);
lv->sort();
KMListView * lv = new KMListView(this);
lv->sort();
To copy to clipboard, switch view to plain text mode
Bookmarks