修改翻页处理中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);
|
||||
|
@ -419,6 +419,8 @@ void DevicePropertyPage::onFirstButtonClicked()
|
|||
}
|
||||
|
||||
void DevicePropertyPage::onLastButtonClicked()
|
||||
{
|
||||
//if (m_currentPage < m_totalPageCount)
|
||||
{
|
||||
m_currentPage = m_totalPageCount;
|
||||
|
||||
|
@ -428,8 +430,11 @@ void DevicePropertyPage::onLastButtonClicked()
|
|||
|
||||
updatePageLabel();
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePropertyPage::onForwardButtonClicked()
|
||||
{
|
||||
if (m_currentPage > 1)
|
||||
{
|
||||
m_currentPage--;
|
||||
|
||||
|
@ -441,8 +446,11 @@ void DevicePropertyPage::onForwardButtonClicked()
|
|||
|
||||
updatePageLabel();
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePropertyPage::onNextButtonClicked()
|
||||
{
|
||||
if (m_currentPage < m_totalPageCount)
|
||||
{
|
||||
m_currentPage++;
|
||||
|
||||
|
@ -454,6 +462,7 @@ void DevicePropertyPage::onNextButtonClicked()
|
|||
|
||||
updatePageLabel();
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePropertyPage::onGotoButtonClicked()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue