QML 关于ListView求助
我用ListView显示了
我加了二个button来控制
ListView 内容向前翻页和向后翻页,但速度分成按
即我按下button半天才有效果
const_word_width 为显示的最大值
m_page_max 为ListView.count
function up_page(){ var page_t = listview1.indexAt(listview1.contentX+1,listview1.contentY+1); if(page_t>=const_word_width){ m_page = page_t-const_word_width; listview1.currentIndex = m_page; } else{ m_page = 0; listview1.currentIndex = 0; } set_button_show(m_page); } function down_page(){ var page_t = listview1.indexAt(listview1.contentX+listview1.width-1,listview1.contentY+listview1.height-1); vrf_view.debug_s(page_t); if(page_t+const_word_width>=m_page_max){ m_page = m_page_max-1; listview1.currentIndex = m_page_max-1; } else{ m_page = page_t+const_word_width-1; listview1.currentIndex = page_t+const_word_width-1; } vrf_view.debug_s(m_page); set_button_show(m_page); } function set_button_show(page_){ pbutton1.visible = page_>0?true:false; pbutton2.visible = (page_+const_word_width<m_page_max)?true:false; }