修改翻页处理中BUTTON的bug
parent
e2040a2c8a
commit
9389eb0030
|
@ -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,6 +420,8 @@ void DevicePropertyPage::onFirstButtonClicked()
|
|||
|
||||
void DevicePropertyPage::onLastButtonClicked()
|
||||
{
|
||||
//if (m_currentPage < m_totalPageCount)
|
||||
{
|
||||
m_currentPage = m_totalPageCount;
|
||||
|
||||
updatePageButtonState();
|
||||
|
@ -427,10 +429,13 @@ void DevicePropertyPage::onLastButtonClicked()
|
|||
pageTo(m_currentPage);
|
||||
|
||||
updatePageLabel();
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePropertyPage::onForwardButtonClicked()
|
||||
{
|
||||
if (m_currentPage > 1)
|
||||
{
|
||||
m_currentPage--;
|
||||
|
||||
updatePageButtonState();
|
||||
|
@ -440,10 +445,13 @@ void DevicePropertyPage::onForwardButtonClicked()
|
|||
pageTo(m_currentPage);
|
||||
|
||||
updatePageLabel();
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePropertyPage::onNextButtonClicked()
|
||||
{
|
||||
if (m_currentPage < m_totalPageCount)
|
||||
{
|
||||
m_currentPage++;
|
||||
|
||||
updatePageButtonState();
|
||||
|
@ -453,6 +461,7 @@ void DevicePropertyPage::onNextButtonClicked()
|
|||
pageTo(m_currentPage);
|
||||
|
||||
updatePageLabel();
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePropertyPage::onGotoButtonClicked()
|
||||
|
|
Loading…
Reference in New Issue