Skip to content

Commit

Permalink
Add two buttons to navigate to the head and the tail.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunfzhan committed Dec 3, 2014
1 parent 6d7b402 commit 71cf053
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 39 deletions.
12 changes: 12 additions & 0 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,16 @@ void MainWindow::navigateNext()
selectTableLine(curRow);
}

void MainWindow::navigateBegin()
{
selectTableLine(0);
}

void MainWindow::navigateEnd()
{
selectTableLine(m_browseTableModel->totalRowCount()-1);
}


void MainWindow::navigateGoto()
{
Expand Down Expand Up @@ -1088,6 +1098,8 @@ void MainWindow::activateFields(bool enable)
ui->editCreateIndexAction->setEnabled(enable);
ui->buttonNext->setEnabled(enable);
ui->buttonPrevious->setEnabled(enable);
ui->buttonBegin->setEnabled(enable);
ui->buttonEnd->setEnabled(enable);
ui->scrollAreaWidgetContents->setEnabled(enable);
ui->buttonBoxPragmas->setEnabled(enable);
ui->buttonGoto->setEnabled(enable);
Expand Down
2 changes: 2 additions & 0 deletions src/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ private slots:
void selectTableLine( int lineToSelect );
void navigatePrevious();
void navigateNext();
void navigateBegin();
void navigateEnd();
void navigateGoto();
void setRecordsetLabel();
void createTable();
Expand Down
144 changes: 105 additions & 39 deletions src/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="buttonBegin">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Scroll to the beginning&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Clicking this button navigates to the beginning in the table view above.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;&lt;</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="buttonPrevious">
<property name="enabled">
Expand Down Expand Up @@ -220,6 +236,22 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="buttonEnd">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Scroll to the end</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&amp;lt;html&amp;gt;&amp;lt;head/&amp;gt;&amp;lt;body&amp;gt;&amp;lt;p&amp;gt;Clicking this button navigates up to the end in the table view above.&amp;lt;/p&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&gt;&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
Expand Down Expand Up @@ -278,8 +310,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>575</width>
<height>458</height>
<width>311</width>
<height>531</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
Expand Down Expand Up @@ -764,7 +796,7 @@
<x>0</x>
<y>0</y>
<width>1000</width>
<height>19</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="fileMenu">
Expand Down Expand Up @@ -1683,8 +1715,8 @@
<slot>populateTable(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>59</x>
<y>82</y>
<x>118</x>
<y>141</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand All @@ -1699,8 +1731,8 @@
<slot>addRecord()</slot>
<hints>
<hint type="sourcelabel">
<x>584</x>
<y>82</y>
<x>443</x>
<y>141</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand All @@ -1715,8 +1747,8 @@
<slot>deleteRecord()</slot>
<hints>
<hint type="sourcelabel">
<x>687</x>
<y>82</y>
<x>565</x>
<y>141</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand All @@ -1731,8 +1763,8 @@
<slot>navigatePrevious()</slot>
<hints>
<hint type="sourcelabel">
<x>27</x>
<y>380</y>
<x>74</x>
<y>585</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand All @@ -1747,8 +1779,8 @@
<slot>navigateNext()</slot>
<hints>
<hint type="sourcelabel">
<x>128</x>
<y>380</y>
<x>168</x>
<y>585</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand All @@ -1763,8 +1795,8 @@
<slot>navigateGoto()</slot>
<hints>
<hint type="sourcelabel">
<x>493</x>
<y>380</y>
<x>413</x>
<y>586</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand All @@ -1779,8 +1811,8 @@
<slot>navigateGoto()</slot>
<hints>
<hint type="sourcelabel">
<x>790</x>
<y>379</y>
<x>565</x>
<y>586</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand All @@ -1795,8 +1827,8 @@
<slot>browseRefresh()</slot>
<hints>
<hint type="sourcelabel">
<x>265</x>
<y>103</y>
<x>245</x>
<y>139</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand Down Expand Up @@ -2035,8 +2067,8 @@
<slot>createTreeContextMenu(QPoint)</slot>
<hints>
<hint type="sourcelabel">
<x>399</x>
<y>341</y>
<x>101</x>
<y>125</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand Down Expand Up @@ -2083,8 +2115,8 @@
<slot>loadPragmas()</slot>
<hints>
<hint type="sourcelabel">
<x>251</x>
<y>381</y>
<x>101</x>
<y>125</y>
</hint>
<hint type="destinationlabel">
<x>-1</x>
Expand All @@ -2099,8 +2131,8 @@
<slot>savePragmas()</slot>
<hints>
<hint type="sourcelabel">
<x>364</x>
<y>381</y>
<x>101</x>
<y>125</y>
</hint>
<hint type="destinationlabel">
<x>802</x>
Expand All @@ -2115,12 +2147,12 @@
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>794</x>
<y>441</y>
<x>989</x>
<y>126</y>
</hint>
<hint type="destinationlabel">
<x>103</x>
<y>476</y>
<x>691</x>
<y>163</y>
</hint>
</hints>
</connection>
Expand All @@ -2131,12 +2163,12 @@
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>794</x>
<y>441</y>
<x>989</x>
<y>126</y>
</hint>
<hint type="destinationlabel">
<x>611</x>
<y>576</y>
<x>990</x>
<y>240</y>
</hint>
</hints>
</connection>
Expand All @@ -2147,12 +2179,12 @@
<slot>setCurrentIndex(int)</slot>
<hints>
<hint type="sourcelabel">
<x>258</x>
<y>441</y>
<x>872</x>
<y>126</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>492</y>
<x>987</x>
<y>240</y>
</hint>
</hints>
</connection>
Expand All @@ -2179,8 +2211,8 @@
<slot>closeSqlTab(int)</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>90</y>
<x>81</x>
<y>125</y>
</hint>
<hint type="destinationlabel">
<x>-1</x>
Expand Down Expand Up @@ -2396,6 +2428,38 @@
</hint>
</hints>
</connection>
<connection>
<sender>buttonEnd</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>navigateEnd()</slot>
<hints>
<hint type="sourcelabel">
<x>189</x>
<y>573</y>
</hint>
<hint type="destinationlabel">
<x>499</x>
<y>314</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBegin</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>navigateBegin()</slot>
<hints>
<hint type="sourcelabel">
<x>69</x>
<y>140</y>
</hint>
<hint type="destinationlabel">
<x>499</x>
<y>314</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>fileOpen()</slot>
Expand All @@ -2405,6 +2469,8 @@
<slot>deleteRecord()</slot>
<slot>navigatePrevious()</slot>
<slot>navigateNext()</slot>
<slot>navigateBegin()</slot>
<slot>navigateEnd()</slot>
<slot>navigateGoto()</slot>
<slot>browseFind(bool)</slot>
<slot>browseRefresh()</slot>
Expand Down

0 comments on commit 71cf053

Please sign in to comment.