diff options
| -rw-r--r-- | src/plugins/Ui/skinned/listwidget.cpp | 12 | ||||
| -rw-r--r-- | src/plugins/Ui/skinned/listwidget.h | 1 | ||||
| -rw-r--r-- | src/plugins/Ui/skinned/playlistheader.cpp | 3 | ||||
| -rw-r--r-- | src/qmmpui/playlistheadermodel.cpp | 16 | ||||
| -rw-r--r-- | src/qmmpui/playlistheadermodel.h | 11 |
5 files changed, 27 insertions, 16 deletions
diff --git a/src/plugins/Ui/skinned/listwidget.cpp b/src/plugins/Ui/skinned/listwidget.cpp index b68614dcd..7eeb572e8 100644 --- a/src/plugins/Ui/skinned/listwidget.cpp +++ b/src/plugins/Ui/skinned/listwidget.cpp @@ -53,6 +53,7 @@ ListWidget::ListWidget(QWidget *parent) m_popupWidget = 0; m_header = 0; m_update = false; + m_resize = false; m_drop_index = INVALID_INDEX; m_scroll_direction = NONE; m_prev_y = 0; @@ -69,11 +70,7 @@ ListWidget::ListWidget(QWidget *parent) connect(m_skin, SIGNAL(skinChanged()), SLOT(updateSkin())); connect(m_ui_settings, SIGNAL(repeatableTrackChanged(bool)), SLOT(updateRepeatIndicator())); connect(m_timer, SIGNAL(timeout()), SLOT(autoscroll())); - connect(headerModel, SIGNAL(changed(int)), SLOT(updateColumns())); - connect(headerModel, SIGNAL(resized(int)), SLOT(updateColumns())); - connect(headerModel, SIGNAL(inserted(int)), SLOT(updateColumns())); - connect(headerModel, SIGNAL(removed(int)), SLOT(updateColumns())); - connect(headerModel, SIGNAL(moved(int, int)), SLOT(updateColumns())); + connect(headerModel, SIGNAL(headerChanged()), SLOT(updateColumns())); } ListWidget::~ListWidget() @@ -262,7 +259,9 @@ void ListWidget::mousePressEvent(QMouseEvent *e) void ListWidget::resizeEvent(QResizeEvent *e) { + m_resize = true; m_header->setGeometry(0,0,width(), m_drawer.rowHeight()); + m_resize = false; m_row_count = (e->size().height() - (m_header ? m_header->height() : 0)) / m_drawer.rowHeight(); updateList(PlayListModel::STRUCTURE); QWidget::resizeEvent(e); @@ -397,6 +396,9 @@ void ListWidget::updateList(int flags) void ListWidget::updateColumns() { + if(m_resize) //do no update while resize event + return; + m_header->updateColumns(); QList<PlayListItem *> items = m_model->mid(m_first, m_row_count); for(int i = 0; i < items.count(); ++i) diff --git a/src/plugins/Ui/skinned/listwidget.h b/src/plugins/Ui/skinned/listwidget.h index e236768f1..dd1c5a28f 100644 --- a/src/plugins/Ui/skinned/listwidget.h +++ b/src/plugins/Ui/skinned/listwidget.h @@ -115,6 +115,7 @@ private: PlayListModel *m_model; int m_row_count, m_first; Skin *m_skin; + bool m_resize; int m_anchor_index; /*! * Scroll direction that is preforming in current moment. diff --git a/src/plugins/Ui/skinned/playlistheader.cpp b/src/plugins/Ui/skinned/playlistheader.cpp index 1f80a34e2..212e7028a 100644 --- a/src/plugins/Ui/skinned/playlistheader.cpp +++ b/src/plugins/Ui/skinned/playlistheader.cpp @@ -262,7 +262,10 @@ void PlayListHeader::resizeEvent(QResizeEvent *e) int delta = e->size().width() - e->oldSize().width(); int index = m_model->autoResizeColumn(); if(index >= 0) + { m_model->resize(index, m_model->size(index) + delta); + updateColumns(); + } } void PlayListHeader::contextMenuEvent(QContextMenuEvent *e) diff --git a/src/qmmpui/playlistheadermodel.cpp b/src/qmmpui/playlistheadermodel.cpp index c39df388e..92b342c0b 100644 --- a/src/qmmpui/playlistheadermodel.cpp +++ b/src/qmmpui/playlistheadermodel.cpp @@ -72,7 +72,8 @@ void PlayListHeaderModel::insert(int index, const QString &name, const QString & col.autoResize = false; m_columns.insert(index, col); sync(); - emit inserted(index); + emit columnAdded(index); + emit headerChanged(); } void PlayListHeaderModel::remove(int index) @@ -88,7 +89,8 @@ void PlayListHeaderModel::remove(int index) delete m_columns.takeAt(index).titleFormatter; sync(); - emit removed(index); + emit columnRemoved(index); + emit headerChanged(); } void PlayListHeaderModel::resize(int index, int size) @@ -100,8 +102,8 @@ void PlayListHeaderModel::resize(int index, int size) } m_columns[index].size = qMax(size, 30); - //sync(); - emit resized(index); + emit columnResized(index); + emit headerChanged(); } void PlayListHeaderModel::setAutoResize(int index) @@ -133,7 +135,8 @@ void PlayListHeaderModel::move(int from, int to) } m_columns.move(from, to); - emit moved(from, to); + emit columnMoved(from, to); + emit headerChanged(); } void PlayListHeaderModel::execEdit(int index, QWidget *parent) @@ -153,7 +156,8 @@ void PlayListHeaderModel::execEdit(int index, QWidget *parent) m_columns[index].name = editor.name(); m_columns[index].pattern = editor.pattern(); m_columns[index].titleFormatter->setPattern(editor.pattern()); - emit changed(index); + emit columnChanged(index); + emit headerChanged(); } } diff --git a/src/qmmpui/playlistheadermodel.h b/src/qmmpui/playlistheadermodel.h index ac50d0842..be84aafae 100644 --- a/src/qmmpui/playlistheadermodel.h +++ b/src/qmmpui/playlistheadermodel.h @@ -52,11 +52,12 @@ public: int autoResizeColumn() const; signals: - void inserted(int index); - void removed(int index); - void changed(int index); - void resized(int index); - void moved(int from, int to); + void columnAdded(int index); + void columnRemoved(int index); + void columnChanged(int index); + void columnResized(int index); + void columnMoved(int from, int to); + void headerChanged(); private: void sync(); |
