Renamed part selection events.

This commit is contained in:
Leonardo Zide 2024-07-25 17:56:29 -07:00
parent b2074a7c0a
commit 82463473d5
6 changed files with 23 additions and 22 deletions

View file

@ -707,8 +707,8 @@ void lcMainWindow::CreateToolBars()
addDockWidget(Qt::RightDockWidgetArea, mPartsToolBar); addDockWidget(Qt::RightDockWidgetArea, mPartsToolBar);
connect(mPartsToolBar, &QDockWidget::dockLocationChanged, mPartSelectionWidget, &lcPartSelectionWidget::DockLocationChanged); connect(mPartsToolBar, &QDockWidget::dockLocationChanged, mPartSelectionWidget, &lcPartSelectionWidget::DockLocationChanged);
connect(mPartSelectionWidget, &lcPartSelectionWidget::PartDoubleClicked, this, &lcMainWindow::PartListDoubleClicked); connect(mPartSelectionWidget, &lcPartSelectionWidget::PartPicked, this, &lcMainWindow::PartListPicked);
connect(mPartSelectionWidget, &lcPartSelectionWidget::PartChanged, this, &lcMainWindow::SetCurrentPieceInfo); connect(mPartSelectionWidget, &lcPartSelectionWidget::CurrentPartChanged, this, &lcMainWindow::SetCurrentPieceInfo);
mColorsToolBar = new QDockWidget(tr("Colors"), this); mColorsToolBar = new QDockWidget(tr("Colors"), this);
mColorsToolBar->setObjectName("ColorsToolbar"); mColorsToolBar->setObjectName("ColorsToolbar");
@ -1108,14 +1108,14 @@ void lcMainWindow::ColorChanged(int ColorIndex)
SetColorIndex(ColorIndex); SetColorIndex(ColorIndex);
} }
void lcMainWindow::PartListDoubleClicked(PieceInfo* Info) void lcMainWindow::PartListPicked(PieceInfo* Info)
{ {
if (!Info) if (!Info)
return; return;
quint32 ColorCode = lcGetColorCode(mPartSelectionWidget->GetColorIndex()); quint32 ColorCode = lcGetColorCode(mPartSelectionWidget->GetColorIndex());
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, true); PreviewPiece(Info->mFileName, ColorCode, true);
} }
void lcMainWindow::ColorButtonClicked() void lcMainWindow::ColorButtonClicked()

View file

@ -303,7 +303,7 @@ protected slots:
void ClipboardChanged(); void ClipboardChanged();
void ActionTriggered(); void ActionTriggered();
void ColorChanged(int ColorIndex); void ColorChanged(int ColorIndex);
void PartListDoubleClicked(PieceInfo* Info); void PartListPicked(PieceInfo* Info);
void ColorButtonClicked(); void ColorButtonClicked();
void Print(QPrinter* Printer); void Print(QPrinter* Printer);
void EnableWindowFlags(bool); void EnableWindowFlags(bool);

View file

@ -773,6 +773,7 @@ void lcPartSelectionWidget::SetCurrentPart(PieceInfo* Info)
{ {
mCategoriesWidget->setCurrentItem(mAllPartsCategoryItem); mCategoriesWidget->setCurrentItem(mAllPartsCategoryItem);
mPartsWidget->SetCurrentPart(Info); mPartsWidget->SetCurrentPart(Info);
mPartsWidget->setFocus();
} }
void lcPartSelectionWidget::SetOrientation(Qt::Orientation Orientation) void lcPartSelectionWidget::SetOrientation(Qt::Orientation Orientation)
@ -880,7 +881,7 @@ void lcPartSelectionWidget::PartViewSelectionChanged(const QModelIndex& Current,
Q_UNUSED(Current); Q_UNUSED(Current);
Q_UNUSED(Previous); Q_UNUSED(Previous);
emit PartChanged(mPartsWidget->GetCurrentPart()); emit CurrentPartChanged(mPartsWidget->GetCurrentPart());
} }
void lcPartSelectionWidget::PartViewDoubleClicked(const QModelIndex& Index) void lcPartSelectionWidget::PartViewDoubleClicked(const QModelIndex& Index)
@ -888,7 +889,7 @@ void lcPartSelectionWidget::PartViewDoubleClicked(const QModelIndex& Index)
PieceInfo* Info = mPartsWidget->GetListModel()->GetPieceInfo(Index.row()); PieceInfo* Info = mPartsWidget->GetListModel()->GetPieceInfo(Index.row());
if (Info) if (Info)
emit PartDoubleClicked(Info); emit PartPicked(Info);
} }
void lcPartSelectionWidget::OptionsMenuAboutToShow() void lcPartSelectionWidget::OptionsMenuAboutToShow()
@ -954,7 +955,7 @@ void lcPartSelectionWidget::OptionsMenuAboutToShow()
ListMode->setCheckable(true); ListMode->setCheckable(true);
ListMode->setChecked(ListModel->IsListMode()); ListMode->setChecked(ListModel->IsListMode());
QAction* FixedColor = Menu->addAction(tr("Lock Preview Color"), mPartsWidget, SLOT(ToggleFixedColor())); QAction* FixedColor = Menu->addAction(tr("Lock Color"), mPartsWidget, SLOT(ToggleFixedColor()));
FixedColor->setCheckable(true); FixedColor->setCheckable(true);
FixedColor->setChecked(ListModel->IsColorLocked()); FixedColor->setChecked(ListModel->IsColorLocked());
} }

View file

@ -240,8 +240,8 @@ public:
} }
signals: signals:
void PartDoubleClicked(PieceInfo* Info); void PartPicked(PieceInfo* Info);
void PartChanged(PieceInfo* Info); void CurrentPartChanged(PieceInfo* Info);
public slots: public slots:
void AddToPalette(); void AddToPalette();
@ -267,14 +267,14 @@ protected:
void resizeEvent(QResizeEvent* Event) override; void resizeEvent(QResizeEvent* Event) override;
bool event(QEvent* Event) override; bool event(QEvent* Event) override;
QTreeWidget* mCategoriesWidget; QTreeWidget* mCategoriesWidget = nullptr;
QLineEdit* mFilterCategoriesWidget; QLineEdit* mFilterCategoriesWidget = nullptr;
QAction* mFilterCategoriesAction; QAction* mFilterCategoriesAction = nullptr;
QAction* mFilterCaseAction; QAction* mFilterCaseAction = nullptr;
QLineEdit* mFilterWidget; QLineEdit* mFilterWidget = nullptr;
QAction* mFilterAction; QAction* mFilterAction = nullptr;
lcPartSelectionListView* mPartsWidget; lcPartSelectionListView* mPartsWidget = nullptr;
QSplitter* mSplitter; QSplitter* mSplitter = nullptr;
QTreeWidgetItem* mAllPartsCategoryItem; QTreeWidgetItem* mAllPartsCategoryItem = nullptr;
std::vector<lcPartPalette> mPartPalettes; std::vector<lcPartPalette> mPartPalettes;
}; };

View file

@ -181,7 +181,7 @@ lcPieceIdPickerPopup::lcPieceIdPickerPopup(PieceInfo* Current, QWidget* Parent)
mPartSelectionWidget->setMinimumWidth(450); mPartSelectionWidget->setMinimumWidth(450);
connect(mPartSelectionWidget, &lcPartSelectionWidget::PartDoubleClicked, this, &lcPieceIdPickerPopup::PartDoubleClicked); connect(mPartSelectionWidget, &lcPartSelectionWidget::PartPicked, this, &lcPieceIdPickerPopup::PartPicked);
QDialogButtonBox* ButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this); QDialogButtonBox* ButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this);
Layout->addWidget(ButtonBox); Layout->addWidget(ButtonBox);
@ -212,7 +212,7 @@ void lcPieceIdPickerPopup::Reject()
Close(); Close();
} }
void lcPieceIdPickerPopup::PartDoubleClicked(PieceInfo* Info) void lcPieceIdPickerPopup::PartPicked(PieceInfo* Info)
{ {
emit PieceIdSelected(Info); emit PieceIdSelected(Info);

View file

@ -180,7 +180,7 @@ signals:
protected slots: protected slots:
void Accept(); void Accept();
void Reject(); void Reject();
void PartDoubleClicked(PieceInfo* Info); void PartPicked(PieceInfo* Info);
protected: protected:
void showEvent(QShowEvent* ShowEvent) override; void showEvent(QShowEvent* ShowEvent) override;