diff --git a/applications/emsConfigurer/devicepropertypage.cpp b/applications/emsConfigurer/devicepropertypage.cpp index 51c78c4..c91af47 100644 --- a/applications/emsConfigurer/devicepropertypage.cpp +++ b/applications/emsConfigurer/devicepropertypage.cpp @@ -18,7 +18,7 @@ #define PER_PAGE_SIZE (30) DevicePropertyPage::DevicePropertyPage(QWidget *parent) : - QWidget(parent),m_nDownCounter(0),m_pTableView(nullptr),m_pButton(nullptr),m_totalPageCount(0),m_currentPage(0) + QWidget(parent),m_nDownCounter(0),m_pTableView(nullptr),m_pButton(nullptr),m_totalPageCount(1),m_currentPage(1) { InitializeTable(); @@ -363,14 +363,7 @@ void DevicePropertyPage::updatePageLabel() void DevicePropertyPage::updatePageButtonState() { - if ( m_currentPage == m_totalPageCount) //翻到底了,超过最大的页数 - { - m_pNextButton->setEnabled(false); - m_pForwardButton->setEnabled(true); - m_pLastButton->setEnabled(false); - m_pFirstButton->setEnabled(true); - } - else if (m_currentPage == 1) //翻到头了 + if (m_currentPage == 1) //翻到头了 { m_pNextButton->setEnabled(true); m_pForwardButton->setEnabled(false); @@ -384,6 +377,13 @@ void DevicePropertyPage::updatePageButtonState() m_pLastButton->setEnabled(true); m_pFirstButton->setEnabled(true); } + else if ( m_currentPage == m_totalPageCount) //翻到底了,超过最大的页数 + { + m_pNextButton->setEnabled(false); + m_pForwardButton->setEnabled(true); + m_pLastButton->setEnabled(false); + m_pFirstButton->setEnabled(true); + } else { assert(false); @@ -420,39 +420,48 @@ void DevicePropertyPage::onFirstButtonClicked() void DevicePropertyPage::onLastButtonClicked() { - m_currentPage = m_totalPageCount; + //if (m_currentPage < m_totalPageCount) + { + m_currentPage = m_totalPageCount; - updatePageButtonState(); + updatePageButtonState(); - pageTo(m_currentPage); + pageTo(m_currentPage); - updatePageLabel(); + updatePageLabel(); + } } void DevicePropertyPage::onForwardButtonClicked() { - m_currentPage--; + if (m_currentPage > 1) + { + m_currentPage--; - updatePageButtonState(); + updatePageButtonState(); - m_currentPageData.clear(); + m_currentPageData.clear(); - pageTo(m_currentPage); + pageTo(m_currentPage); - updatePageLabel(); + updatePageLabel(); + } } void DevicePropertyPage::onNextButtonClicked() { - m_currentPage++; + if (m_currentPage < m_totalPageCount) + { + m_currentPage++; - updatePageButtonState(); + updatePageButtonState(); - m_currentPageData.clear(); + m_currentPageData.clear(); - pageTo(m_currentPage); + pageTo(m_currentPage); - updatePageLabel(); + updatePageLabel(); + } } void DevicePropertyPage::onGotoButtonClicked()