LibrePCB Developers Documentation
AddComponentDialog Class Referencefinal

The AddComponentDialog class. More...

#include <addcomponentdialog.h>

Inherits QDialog.

+ Collaboration diagram for AddComponentDialog:

Classes

struct  SearchResult
 
struct  SearchResultComponent
 
struct  SearchResultDevice
 

Public Member Functions

 AddComponentDialog (const WorkspaceLibraryDb &db, const QStringList &localeOrder, const QStringList &normOrder, const Theme &theme, QWidget *parent=nullptr)
 
 ~AddComponentDialog () noexcept
 
std::shared_ptr< const ComponentgetSelectedComponent () const noexcept
 
std::shared_ptr< const ComponentSymbolVariantgetSelectedSymbolVariant () const noexcept
 
std::shared_ptr< const DevicegetSelectedDevice () const noexcept
 
std::shared_ptr< const PartgetSelectedPart () const noexcept
 
tl::optional< Package::AssemblyTypegetSelectedPackageAssemblyType () const noexcept
 
bool getAutoOpenAgain () const noexcept
 Check if dialog shall be opened again after the current component. More...
 
void setLocaleOrder (const QStringList &order) noexcept
 
void setNormOrder (const QStringList &order) noexcept
 
void selectComponentByKeyword (const QString keyword, const tl::optional< Uuid > &selectedDevice=tl::nullopt) noexcept
 

Private Slots

void searchEditTextChanged (const QString &text) noexcept
 
void treeCategories_currentItemChanged (const QModelIndex &current, const QModelIndex &previous) noexcept
 
void treeComponents_currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *previous) noexcept
 
void treeComponents_itemDoubleClicked (QTreeWidgetItem *item, int column) noexcept
 
void cbxSymbVar_currentIndexChanged (int index) noexcept
 

Private Member Functions

void searchComponents (const QString &input, const tl::optional< Uuid > &selectedDevice=tl::nullopt, bool selectFirstDevice=false)
 
SearchResult search (const QString &input)
 
void setSelectedCategory (const tl::optional< Uuid > &categoryUuid)
 
void setSelectedComponent (std::shared_ptr< const Component > cmp)
 
void setSelectedSymbVar (std::shared_ptr< const ComponentSymbolVariant > symbVar)
 
void setSelectedDevice (std::shared_ptr< const Device > dev)
 
void setSelectedPart (std::shared_ptr< const Part > part)
 
void addPartItem (std::shared_ptr< Part > part, QTreeWidgetItem *parent)
 
void accept () noexcept
 

Private Attributes

const WorkspaceLibraryDbmDb
 
QStringList mLocaleOrder
 
QStringList mNormOrder
 
QScopedPointer< Ui::AddComponentDialog > mUi
 
QScopedPointer< GraphicsScenemComponentPreviewScene
 
QScopedPointer< GraphicsScenemDevicePreviewScene
 
QScopedPointer< DefaultGraphicsLayerProvidermGraphicsLayerProvider
 
QScopedPointer< CategoryTreeModelmCategoryTreeModel
 
QString mCurrentSearchTerm
 
tl::optional< UuidmSelectedCategoryUuid
 
std::shared_ptr< const ComponentmSelectedComponent
 
std::shared_ptr< const ComponentSymbolVariantmSelectedSymbVar
 
std::shared_ptr< const DevicemSelectedDevice
 
std::unique_ptr< PackagemSelectedPackage
 
std::shared_ptr< const PartmSelectedPart
 
QList< std::shared_ptr< Symbol > > mPreviewSymbols
 
QList< std::shared_ptr< SymbolGraphicsItem > > mPreviewSymbolGraphicsItems
 
QScopedPointer< FootprintGraphicsItemmPreviewFootprintGraphicsItem
 

Detailed Description

The AddComponentDialog class.

Constructor & Destructor Documentation

◆ AddComponentDialog()

AddComponentDialog ( const WorkspaceLibraryDb db,
const QStringList &  localeOrder,
const QStringList &  normOrder,
const Theme theme,
QWidget *  parent = nullptr 
)
explicit
+ Here is the call graph for this function:

◆ ~AddComponentDialog()

~AddComponentDialog ( )
noexcept

Member Function Documentation

◆ getSelectedComponent()

std::shared_ptr<const Component> getSelectedComponent ( ) const
inlinenoexcept

◆ getSelectedSymbolVariant()

std::shared_ptr<const ComponentSymbolVariant> getSelectedSymbolVariant ( ) const
inlinenoexcept

◆ getSelectedDevice()

std::shared_ptr<const Device> getSelectedDevice ( ) const
inlinenoexcept

◆ getSelectedPart()

std::shared_ptr<const Part> getSelectedPart ( ) const
inlinenoexcept

◆ getSelectedPackageAssemblyType()

tl::optional< Package::AssemblyType > getSelectedPackageAssemblyType ( ) const
noexcept

◆ getAutoOpenAgain()

bool getAutoOpenAgain ( ) const
noexcept

Check if dialog shall be opened again after the current component.

Returns the checked state of the "Add More" checkbox, i.e. whether the caller should open this dialog again after finishing placement of the component.

Return values
trueMust open this dialog again after placing the component.
falseShall not open this dialog again, exit placement tool.

◆ setLocaleOrder()

void setLocaleOrder ( const QStringList &  order)
noexcept

◆ setNormOrder()

void setNormOrder ( const QStringList &  order)
inlinenoexcept

◆ selectComponentByKeyword()

void selectComponentByKeyword ( const QString  keyword,
const tl::optional< Uuid > &  selectedDevice = tl::nullopt 
)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ searchEditTextChanged

void searchEditTextChanged ( const QString &  text)
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treeCategories_currentItemChanged

void treeCategories_currentItemChanged ( const QModelIndex &  current,
const QModelIndex &  previous 
)
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treeComponents_currentItemChanged

void treeComponents_currentItemChanged ( QTreeWidgetItem *  current,
QTreeWidgetItem *  previous 
)
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treeComponents_itemDoubleClicked

void treeComponents_itemDoubleClicked ( QTreeWidgetItem *  item,
int  column 
)
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cbxSymbVar_currentIndexChanged

void cbxSymbVar_currentIndexChanged ( int  index)
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ searchComponents()

void searchComponents ( const QString &  input,
const tl::optional< Uuid > &  selectedDevice = tl::nullopt,
bool  selectFirstDevice = false 
)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ search()

AddComponentDialog::SearchResult search ( const QString &  input)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelectedCategory()

void setSelectedCategory ( const tl::optional< Uuid > &  categoryUuid)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelectedComponent()

void setSelectedComponent ( std::shared_ptr< const Component cmp)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelectedSymbVar()

void setSelectedSymbVar ( std::shared_ptr< const ComponentSymbolVariant symbVar)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelectedDevice()

void setSelectedDevice ( std::shared_ptr< const Device dev)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelectedPart()

void setSelectedPart ( std::shared_ptr< const Part part)
private
+ Here is the caller graph for this function:

◆ addPartItem()

void addPartItem ( std::shared_ptr< Part part,
QTreeWidgetItem *  parent 
)
private
+ Here is the caller graph for this function:

◆ accept()

void accept ( )
privatenoexcept
+ Here is the caller graph for this function:

Member Data Documentation

◆ mDb

const WorkspaceLibraryDb& mDb
private

◆ mLocaleOrder

QStringList mLocaleOrder
private

◆ mNormOrder

QStringList mNormOrder
private

◆ mUi

QScopedPointer<Ui::AddComponentDialog> mUi
private

◆ mComponentPreviewScene

QScopedPointer<GraphicsScene> mComponentPreviewScene
private

◆ mDevicePreviewScene

QScopedPointer<GraphicsScene> mDevicePreviewScene
private

◆ mGraphicsLayerProvider

QScopedPointer<DefaultGraphicsLayerProvider> mGraphicsLayerProvider
private

◆ mCategoryTreeModel

QScopedPointer<CategoryTreeModel> mCategoryTreeModel
private

◆ mCurrentSearchTerm

QString mCurrentSearchTerm
private

◆ mSelectedCategoryUuid

tl::optional<Uuid> mSelectedCategoryUuid
private

◆ mSelectedComponent

std::shared_ptr<const Component> mSelectedComponent
private

◆ mSelectedSymbVar

std::shared_ptr<const ComponentSymbolVariant> mSelectedSymbVar
private

◆ mSelectedDevice

std::shared_ptr<const Device> mSelectedDevice
private

◆ mSelectedPackage

std::unique_ptr<Package> mSelectedPackage
private

◆ mSelectedPart

std::shared_ptr<const Part> mSelectedPart
private

◆ mPreviewSymbols

QList<std::shared_ptr<Symbol> > mPreviewSymbols
private

◆ mPreviewSymbolGraphicsItems

QList<std::shared_ptr<SymbolGraphicsItem> > mPreviewSymbolGraphicsItems
private

◆ mPreviewFootprintGraphicsItem

QScopedPointer<FootprintGraphicsItem> mPreviewFootprintGraphicsItem
private

The documentation for this class was generated from the following files: