mirror of
https://github.com/leozide/leocad.git
synced 2026-10-26 22:10:32 +00:00
Use PieceData consistently for the shared part/model record, its related APIs and variables, and its source files. Keep the existing reference counting and loading behavior so ownership and readiness changes can be reviewed separately.
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
#pragma once
|
|
|
|
class lcPieceData;
|
|
class lcPartSelectionWidget;
|
|
class lcPartSelectionListView;
|
|
|
|
class lcPartSelectionPopup : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
lcPartSelectionPopup(lcPieceData* InitialPart, QWidget* Parent);
|
|
virtual ~lcPartSelectionPopup() = default;
|
|
QSize sizeHint() const override;
|
|
void SetHeightLimit(int Height);
|
|
|
|
std::optional<lcPieceData*> GetPickedPart() const
|
|
{
|
|
return mAccepted ? std::optional<lcPieceData*>(mPickedPiece) : std::nullopt;
|
|
}
|
|
|
|
lcPartSelectionWidget* GetPartSelectionWidget() const
|
|
{
|
|
return mPartSelectionWidget;
|
|
}
|
|
|
|
protected slots:
|
|
void Accept();
|
|
void Reject();
|
|
void ResizeToContents();
|
|
|
|
protected:
|
|
void showEvent(QShowEvent* ShowEvent) override;
|
|
void Close();
|
|
void UpdateHeightLimit();
|
|
QSize GetPartsViewSizeHint(const lcPartSelectionListView* PartsView, const QSize& PopupSize) const;
|
|
|
|
lcPartSelectionWidget* mPartSelectionWidget = nullptr;
|
|
lcPieceData* mInitialPart = nullptr;
|
|
lcPieceData* mPickedPiece = nullptr;
|
|
bool mAccepted = false;
|
|
int mHeightLimit = QWIDGETSIZE_MAX;
|
|
};
|
|
|
|
std::optional<lcPieceData*> lcShowPartSelectionPopup(lcPieceData* InitialPart, const std::vector<std::pair<lcPieceData*, std::string>>& CustomParts, int ColorIndex, QWidget* Parent, QPoint Position);
|