Skip to content

Commit

Permalink
After clicking the UseCameraLimitators_radioButton, we make the first…
Browse files Browse the repository at this point in the history
… listview item the default selected item to avoid SelectedLimitator = -1 (#453)

* this should fix #452

* update workflow

* Add Qt 6 build folder to the git ignore file

* let's try again to fly without architecture: 'x64'

* fly without installing python before installing qt

* fly by try fixing path allocation logic
  • Loading branch information
shinespeciall authored Sep 22, 2024
1 parent d3ab9b5 commit 8283891
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 19 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ jobs:
os: [windows-latest, macOS-latest, ubuntu-latest]
steps:
- name: Download Submodules
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Install Python 3.X version
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'
# - name: Install Python 3.X version
# uses: actions/setup-python@v5
# with:
# python-version: '3.10'
# architecture: 'x64'

# they put setup python logic inside install-qt-action
- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
with:
version: 6.4.2

Expand All @@ -39,15 +40,15 @@ jobs:
- name: Build WL4Editor on Windows
if: startsWith(matrix.os, 'windows')
run: |
dir %Qt6_Dir%/lib/cmake
dir %QT_ROOT_DIR%/lib/cmake
qmake WL4Editor.pro
nmake debug
shell: cmd

- name: Build WL4Editor on *nix
if: (!startsWith(matrix.os, 'windows'))
run: |
ls "$Qt6_DIR/lib/cmake"
ls "${QT_ROOT_DIR}/lib/cmake"
qmake WL4Editor.pro
make
shell: bash
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ vgcore.*
.vscode
*.aps
*.rc

# Qt 6 build folder
build/
37 changes: 27 additions & 10 deletions DockWidget/CameraControlDockWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,15 @@ void CameraControlDockWidget::ClearListView()
}
}


/// <summary>
/// Be called the listview is clicked and a limitator is selected.
/// Update all those spinboxes values and max/min properties by using the Room size and the limitator properties.
/// </summary>
/// <param name="index">
/// Reference of the selected QModelIndex from the listview.
/// </param>
void CameraControlDockWidget::on_CameraLimitators_listView_clicked(const QModelIndex &index)
void CameraControlDockWidget::UpdateSpinboxesByListviewItemID(int item_id)
{
IsSavingData = false;
ui->ExistingLimitators_groupBox->setEnabled(false);
std::vector<struct LevelComponents::__CameraControlRecord *> currentCameraLimitators =
currentRoom->GetCameraControlRecords();
int linenum = index.row();
SelectedLimitator = linenum;
LevelComponents::__CameraControlRecord *currentLimitator = currentCameraLimitators[linenum];
LevelComponents::__CameraControlRecord *currentLimitator = currentCameraLimitators[item_id];
int currentLimitatorTypeid =
(currentLimitator->ChangeValueOffset == 0xFF ? -1 : currentLimitator->ChangeValueOffset);
ui->CameraLimitatorTypePicker_comboBox->setCurrentIndex(currentLimitatorTypeid + 1);
Expand Down Expand Up @@ -290,6 +284,21 @@ void CameraControlDockWidget::on_CameraLimitators_listView_clicked(const QModelI
ui->TriggerBlockPositionY_spinBox->setEnabled(false);
}
SetCurrentLimitator(); // only used to set maximums for all the spinboxes
}

/// <summary>
/// Be called the listview is clicked and a limitator is selected.
/// </summary>
/// <param name="index">
/// Reference of the selected QModelIndex from the listview.
/// </param>
void CameraControlDockWidget::on_CameraLimitators_listView_clicked(const QModelIndex &index)
{
IsSavingData = false;
ui->ExistingLimitators_groupBox->setEnabled(false);
int linenum = index.row();
SelectedLimitator = linenum;
UpdateSpinboxesByListviewItemID(linenum);
ui->ExistingLimitators_groupBox->setEnabled(true);
IsSavingData = true;
}
Expand Down Expand Up @@ -513,6 +522,14 @@ void CameraControlDockWidget::on_UseCameraLimitators_radioButton_clicked(bool ch

// Rerender graphicview in MainWindow
singleton->RenderScreenElementsLayersUpdate((unsigned int) -1, -1);

// Now we select the first item in the listview as default
IsSavingData = false;
ui->ExistingLimitators_groupBox->setEnabled(false);
SelectedLimitator = 0;
UpdateSpinboxesByListviewItemID(0);
ui->ExistingLimitators_groupBox->setEnabled(true);
IsSavingData = true;
}

singleton->SetUnsavedChanges(true);
Expand Down
1 change: 1 addition & 0 deletions DockWidget/CameraControlDockWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CameraControlDockWidget : public QDockWidget
int CurrentRoomHeight = 0;
bool IsSavingData = false;
void SetCurrentLimitator();
void UpdateSpinboxesByListviewItemID(int item_id);
void SetListviewItemText(int row);
void PaintListView();
void ClearListView();
Expand Down

0 comments on commit 8283891

Please sign in to comment.