Add expand-all and collapse-all buttons for map list

This commit is contained in:
Marcus Huderle 2019-01-08 09:30:36 -06:00
parent 48a0d13926
commit 8317dc2276
6 changed files with 112 additions and 13 deletions

View file

@ -65,6 +65,9 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sort map list&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="icon">
<iconset resource="../resources/images.qrc">
<normaloff>:/icons/sort_alphabet.ico</normaloff>:/icons/sort_alphabet.ico</iconset>
@ -89,6 +92,82 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_ExpandAll">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Expand all map folders&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/images.qrc">
<normaloff>:/icons/expand_all.ico</normaloff>:/icons/expand_all.ico</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_CollapseAll">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>23</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>23</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Collapse all map list folders&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/images.qrc">
<normaloff>:/icons/collapse_all.ico</normaloff>:/icons/collapse_all.ico</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -482,8 +561,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>545</width>
<height>587</height>
<width>469</width>
<height>608</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
@ -797,8 +876,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>256</width>
<height>74</height>
<width>324</width>
<height>77</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
@ -907,10 +986,10 @@
</property>
<property name="geometry">
<rect>
<x>8</x>
<x>0</x>
<y>0</y>
<width>222</width>
<height>353</height>
<width>307</width>
<height>387</height>
</rect>
</property>
<property name="sizePolicy">
@ -1249,8 +1328,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>371</width>
<height>643</height>
<width>381</width>
<height>657</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_7">
@ -1523,7 +1602,7 @@
<x>0</x>
<y>0</y>
<width>430</width>
<height>534</height>
<height>568</height>
</rect>
</property>
<property name="sizePolicy">
@ -2308,8 +2387,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>818</width>
<height>539</height>
<width>826</width>
<height>557</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_14">
@ -2481,7 +2560,7 @@
<x>0</x>
<y>0</y>
<width>1117</width>
<height>22</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">

View file

@ -151,6 +151,10 @@ private slots:
void on_horizontalSlider_CollisionTransparency_valueChanged(int value);
void on_toolButton_ExpandAll_clicked();
void on_toolButton_CollapseAll_clicked();
private:
Ui::MainWindow *ui;
TilesetEditor *tilesetEditor = nullptr;

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View file

@ -28,5 +28,7 @@
<file>icons/sort_alphabet.ico</file>
<file>icons/sort_map.ico</file>
<file>icons/sort_number.ico</file>
<file>icons/collapse_all.ico</file>
<file>icons/expand_all.ico</file>
</qresource>
</RCC>

View file

@ -1845,6 +1845,20 @@ void MainWindow::on_actionTileset_Editor_triggered()
}
}
void MainWindow::on_toolButton_ExpandAll_clicked()
{
if (ui->mapList) {
ui->mapList->expandToDepth(0);
}
}
void MainWindow::on_toolButton_CollapseAll_clicked()
{
if (ui->mapList) {
ui->mapList->collapseAll();
}
}
void MainWindow::closeEvent(QCloseEvent *event) {
porymapConfig.setGeometry(
this->saveGeometry(),