aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Ui/skinned
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2015-04-10 09:16:00 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2015-04-10 09:16:00 +0000
commit76f1c92734c5a4b9432b07eb182c6e96908a29b0 (patch)
treee60f1404d267a30cf38d6c5db776b38c7a371a3d /src/plugins/Ui/skinned
parent33f541d7924b14e2cc911f2f32669d52688b5cb5 (diff)
downloadqmmp-76f1c92734c5a4b9432b07eb182c6e96908a29b0.tar.gz
qmmp-76f1c92734c5a4b9432b07eb182c6e96908a29b0.tar.bz2
qmmp-76f1c92734c5a4b9432b07eb182c6e96908a29b0.zip
refactoring and some optimizations
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4842 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Ui/skinned')
-rw-r--r--src/plugins/Ui/skinned/listwidget.cpp12
-rw-r--r--src/plugins/Ui/skinned/listwidget.h1
-rw-r--r--src/plugins/Ui/skinned/playlistheader.cpp3
3 files changed, 11 insertions, 5 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)